FTPEdit Scripting Reference

FTPEdit currently uses Microsoft's VBScript. You can find a complete language reference at msdn.microsoft.com.

On startup, FTPEdit will look for a file named Startup.vbs in the FTPEdit directory and execute it.

The FTPEditApplication object is globally accessible so any functions and properties can be accessed directly without qualifying them.

There is a page of examples available.


IFTPEditApplication
function clear( )
Clear the output console. function exec(string sCommandLine, string sWorkingDirectory, boolean bCaptureOutput, optional out string sOutput )
Execute an external program and optionally capture the output from it.
If you pass true as bCaptureOutput then the program is run hidden in order to retrieve the output.
function print( string sOutput )
Print sOutput to the output console.
See also:
function clear
property useHTMLOutput

property accounts IFTPEditAccountCollection read-only
Collection of accounts configured in FTPEdit. Use a for each loop to iterate through the accounts.
See also:
interface IFTPEditAccount
property activeFile IFTPEditFile read-only
Returns the focused file in the editor. Raises an exception if no files are open.
See also:
property Files
interface IFTPEditFile
property files IFTPEditFileCollection read-only
Collection of files currently open in FTPEdit. Use a for each loop to iterate through the open files.
files.count returns 0 if there are no open files.
See also:
property activeFile
interface IFTPEditFile
property localAccount IFTPEditAccount read-only
The local file system.
See also:
interface IFTPEditAccount
property menu IFTPEditMenu read-only
Access to the FTPEdit main menu. Use this property to add/remove your own custom menu items. You can also change the shortcut key of any item.
See also:
interface IFTPEditMenu
property useHTMLOutput boolean read/write
If true then all arguments to print will be parsed for the HTML commands <b>, <i>, and <u> to allow your output to be bold, italic, and underline.
Tags may be combined to create bold italic text for example.
See also:
function print

IFTPEditFile

function beginUndoOperation( )
Begin an undo operation. All screen updates will not happen until a call to endUndoOperation or the script ends. This will group all text operations into one undoable command as well. Do not nest calls to beginUndoOperation.
Call this function before any lengthy text operations. See also:
function endUndoOperation
function endUndoOperation( )
End the undo operation started by beginUndoOperation. This function is automatically called at the end of the current script for each file that has had beginUndoOperation called on it.
See also:
function beginUndoOperation
function lineCount( ) returns integer
Returns the number of lines in the current file. See also:
property lines
function save( ) returns boolean
Saves the file. Returns false if the file could not be saved for any reason.
property account IFTPEditAccount read/write
Get or set the account associated with the file. If the file has is new and unsaved, reading this property will raise an error. Examine the isNew property before reading to avoid this error.
See also:
property isNew
property asText string read/write
Access the contents of the file as a string.
See also:
property lines
property directory string read-only
The directory associated with the file.
See also:
function isNew
property filename
property filename string read-only
The filename associated with the file.
See also:
function isNew
property directory
property isNew boolean read-only
Returns true if the file is newly created.
See also:
property account
property lines[Integer] string read/write
Access each line of the file. If you are setting this property repeatedly, you should call beginUndoOperation to speed up the script and make the script undoable in with one press.
See also:
function beginUndoOperation
property modified boolean read-only
Returns true if the file has been modified since loading/creating it.
See also:
function directory
function isNew
property selLength integer read/write
The length of the currently selected text. property selStart integer read/write
The position of the start of the current selection. If there is no selection, the position of the cursor in the stream. property selText string read/write
The currently selected text. property syntaxHighlighter string read/write
The syntax highlighter associated with the file.

IFTPEditMenu

function delete(integer iIndex )
If main menu, delete the top-level item specified by iIndex.
If a sub-menu, delete the sub-item specified by iIndex.
If delete is called on a regular menu item, an error is raised.
See also:
function insert
function insert(integer iIndex, string sCaption, string sOnClick, boolean bIsSubmenu ) returns IFTPEditMenuItem
Insert a menu item at index sIndex with the specified caption.
If bIsSubmenu is true, then the returned menu item can have menu items of its own.
If bIsSubmenu is false, then the returned menu item can be clicked on. The function specified by sOnClick is called.
See also:
function delete

property caption string read/write
The caption of the menu item.
See also:
property hint
property count integer read-only
Returns the number of subitems this menu item has.
See also:
property items
property hint string read/write
The hint that is displayed when the mouse moves over this menu item. See also:
property caption
property items [Integer] IFTPEditMenuItem read-only
Returns the specified sub-menu item.
See also:
property count
property onClick string read/write
The function that gets called when this menu item is clicked. This returns an error if you try to access it on any of the built-in menu items in FTPEdit. property shortcut string read/write
The shortcut-key for this menu item.
For example: "Ctrl+F9", "Alt+Shift+A"

IFTPEditAccount

function CDUP( )
Tries to change the current directory up one (for example, from "/home/test" to "/home"). Raises an exception if an error occurs.
See also:
property currentDirectory
function concatenateDirectoryFilename( string sDirectory, string sFilename ) returns string
Given a directory and a filename, returns the directory + directory separator (if needed) + filename.
For example, on the local account:
  concatenateDirectoryFilename("C:\temp", "test.txt") = "C:\temp\test.txt"
function createDirectory( string sName )
Tries to create a directory named sName. Raises an exception if an error occurs.
See also:
function deleteDirectory
function deleteDirectory( string sName )
Tries to delete the directory named sName. Raises an exception if an error occurs.
See also:
function createDirectory
function deleteFile( string sName )
Tries to delete the file named sName. Raises an exception if an error occurs.
See also:
function renameFile
function openFileForReading( string sFilename, boolean bBinary = false, boolean bOKToUseCache = true )
Opens the specified file and returns a stream with the contents.
See also:
function openFileForWriting
function openFileForWriting( string sFilename, mixed Content, boolean bBinary = false)
Opens the specified file and writes content to it, where content is either a stream (from openFileForReading) or a string.
See also:
function openFileForReading
function renameFile( string sOldName, string sNewName )
Tries to rename the file sOldName to sNewName. Raises an exception if an error occurs.
See also:
function deleteFile

property currentDirectory string read/write
The current directory.
See also:
function CDUP
property defaultDirectory string read/write
The default directory.
property hostname string read/write
The hostname or IP address to connect to. property isLocal boolean read-only
Returns true if this account represents the local filesystem. A large number of properties are only applicable to remote accounts.
property name string read/write
The name of the account as configured in Settings|Accounts. property userName string read/write
The username to log in as. property passive boolean read/write
Whether to transfer in passive mode (true) or active mode (false) property password string write-only
The password used to log in to the account with. This property is write-only for security purposes. property port integer read/write
The port to connect to.