ActiveDocument (object, read-only)
Returns the active document. See the ActiveDocument reference for details.
AppPath (OleString, read-only)
Path to application executable.
CurrentFolder (OleString)
Path currently displayed in the local file list.
CurrentView (ITCurrentViewType)
Sets/gets the current view. Allowed values are:
1 - vwEditSource
2 - vwPreview (browse)
3 - vwDesign
DocumentCache (array of objects, read-only)
See the Document Cache reference for details.
DocumentIndex (Integer)
Tab index of current document.
DocumentCount (integer, read-only)
Number of open documents.
ExeName (OleString, read-only)
Filename of application executable, including path.
Height (integer)
Height of main window.
HInstance (integer, read-only)
Instance handle of the application.
hWnd (integer, read-only)
Handle to the main window.
IsColdFusionStudio (WordBool, read-only)
Returns True if the application is Cold Fusion Studio, False if HomeSite.
Left (integer)
Left (x-coordinate) of main window.
ResourceTabShowing (WordBool)
Specifies whether the resource tab is displayed.
ResultsShowing (WordBool)
Specifies whether the results tab is displayed.
Top (integer)
Top (y-coordinate) of main window.
VersionText (OleString, read-only)
Returns a string containing the application name and version
WindowState (integer)
Allowed values are:
1 - Normal
2 - Minimized
3 - Maximized
BringToFront
procedure BringToFront;
Brings the main window to the front of other applications.
BrowseText
procedure BrowseText(sText, BaseHREF: OleVariant);
Displays the passed text in the internal browser. The BaseHREF parameter is used to interpret relative paths.
For local files, BaseHREF should be the folder the file is in.
CloseAll
function CloseAll(wbPromptToSave: WordBool): WordBool;
Closes all open documents. If wbPromptToSave is True, the user will be prompted to save any changes.
Returns True if successful (ie: the user didn't cancel if wbPromptToSave is True).
ExtractFileName
function ExtractFileName(const wsFile: WideString): WideString;
Returns only the file portion of the passed filename.
ExtractFilePath
function ExtractFilePath(const wsFile: WideString): WideString;
Returns the path of the passed file (includes trailing '\').
GetImageSize
function GetImageSize(const wsImageFile: WideString; var nHeight, nWidth: Integer): WordBool;
Retrieves the size of the passed image. Returns False on error.
GetRelativePath
function GetRelativePath(const wsBaseURL, wsFolderURL: WideString): WideString;
Returns the relative path of a folder give a base URL. For example,
GetRelativePath("http://www.allaire.com/", "http://www.allaire.com/products/")
returns "products/".
GetTabIndexForFile
function GetTabIndexForFile(const wsFile: WideString): Integer;
Returns the index in the document tab of the passed file. Returns -1 If the file isn't open.
GetURL
function GetURL(const wsURL: WideString): widestring;
Retrieves a URL and returns its contents.
GetURLStatus
function GetURLStatus(const wsURL: WideString; var vResponse: OleVariant): Integer;
Returns the HTTP status code for the passed URL. The text of the server response is returned in the second parameter.
HideProgress
procedure HideProgress;
Hides the progress bar.
HTMLConvertTagCase
function HTMLConvertTagCase(const wsHTML: WideString; const wbUpperCase: WordBool): WideString;
Converts the case of the passed HTML string. Doesn't change the contents of SCRIPT, STYLE or COMMENT tags, and doesn't
change the case of attribute values.
HTMLGetAttribute
function HTMLGetAttribute(const wsInTag, wsAttr: WideString): WideString;
Returns the value for a particular attribute of a tag. For example,
HTMLGetAttribute("<TABLE WIDTH=100>", "WIDTH")
returns 100.
HTMLGetTitle
function HTMLGetTitle(const wsFile: WideString): WideString;
Returns the contents of an HTML file's <TITLE> tag. Note that this only operates on local files.
InputBox
InputBox(const wsCaption, wsPrompt, wsDefault: WideString): WideString;
Displays a dialog for obtainining user input.
IsFileOpen
function IsFileOpen(sFile: OleVariant): WordBool;
Returns True if the passed file is open in the document tab.
IsFileModified
function IsFileModified(sFile: OleVariant): WordBool;
Returns True if the passed file is open in the document tab and has been modified.
InstallParserScript
InstallParserScript(const wsScriptFile, wsFileExtAssoc: WideString): WordBool;
Installs a parser (color-coding) script and associates it with the passed list of semi-colon separated file
extensions. If an existing parser is assigned to any of these extensions, they are removed from the existing
parser and assigned to the new one. The parser script is copied from the passed location to the application
\Parsers subdirectory. Returns False on error.
MessageBox
MessageBox(const wsText, wsCaption: WideString; nType: Integer): Integer;
Displays a message dialog for obtaining a user response. The nType parameter determines the type of dialog displayed, and should be a combination of the following sets of values:
MB_ICONINFORMATION = 64
MB_ICONWARNING = 48
MB_ICONQUESTION = 32
MB_ICONSTOP = 16
MB_ABORTRETRYIGNORE = 2
MB_OK = 0 (Default)
MB_OKCANCEL = 1
MB_RETRYCANCEL = 5
MB_YESNO = 4
MB_YESNOCANCEL = 3
The function's result will contain the ID of the button that was pressed, which will be one of the following:
IDOK = 1
IDCANCEL = 2
IDABORT = 3
IDRETRY = 4
IDIGNORE = 5
IDYES = 6
IDNO = 7
IDCLOSE = 8
NewDocument
procedure NewDocument(wbUseDefaultTemplate: WordBool);
Creates a new document, optionally from the default template.
OpenFile
function OpenFile(const wsFile: WideString): WordBool;
Opens the passed file, returning True if successful. Note that this will return True if the file is already open.
Passing an empty string to OpenFile will display the "Open File" dialog, enabling the user select the
file(s) to open.
NextDoc
procedure NextDoc;
Moves to the next document in the document tab. If the last document is showing, wraps to the first.
PreviousDoc
procedure PreviousDoc;
Moves to the previous document in the document tab. If the first document is showing, wraps to the last.
RunCodeSweeper
procedure RunCodeSweeper;
Runs the "CodeSweeper" on the active document using the active CodeSweeper. To change the active CodeSweeper, use
SetActiveCodeSweeper
.
SaveAll
function SaveAll: WordBool;
Saves all open documents, returing True if successful.
SendToBack
procedure SendToBack;
Sends the main window to the back of other applications.
SetActiveCodeSweeper
function SetActiveCodeSweeper(const wsFileName: WideString): WordBool;
Changes the active CodeSweeper format file.
SetActiveResults
procedure SetActiveResults(resType: TCurrentResultsType);
Sets the active page in the results tab. Allowed values are:
resSearch
resValidator
resLinks
resThumbnails
SetProgress
procedure SetProgress(nProgress: Integer);
Sets the position of the progress bar in the status area. Allowed values are 1-100.
SetStatusText
procedure SetStatusText(sMessage: OleString);
Sets the text to be displayed in the status area.
StatusWarning
procedure StatusWarning(const wsMsg: WideString);
Displays a "warning" message in the status bar - message will appear on a blue background
and display for at least 5 seconds.
StatusError
procedure StatusError(const wsMsg: WideString);
Displays a "error" message in the status bar - message will appear on a red background
and display for at least 5 seconds.
ShowThumbnails
procedure ShowThumbnails(sFolder: OleString);
Shows thumbnails for all images in the passed folder.
ShowProgress
procedure ShowProgress;
Shows the progress bar.
ShellToApp
function ShellToApp(const wsAppFileName: WideString): WordBool;
Executes an external application. Returns True if application launched successfully. Note that command lines
may be included in the filename parameter, so this is valid:
Application.ShellToApp("notepad.exe " + Application.ActiveDocument.Filename)
ShellToAppAndWait
procedure ShellToAppAndWait(const wsAppFileName: WideString);
Same as ShellToApp
but waits for the external program to be closed before returning.
Note that the application will be locked until ShellToAppAndWait returns, so use with caution.
TagCase
function TagCase(const wsTag: WideString): WideString;
Changes the case of the passed string based on the "Lowercase all inserted tags" preference
(defined on the HTML page in Settings). Does not modify the case of attribute values.
Wait
procedure Wait(nMilliseconds: Integer);
Pauses for given number of milliseconds. Use "Wait" to enable scripts to execute loops yet still allow access
to the UI. The JavaScript sample below waits for the user to return to edit source view:
var app = Application; while (app.CurrentView != 1) { app.Wait(100); }Here's the same code in VBScript:
set app = Application while app.CurrentView <> 1 app.Wait(100) wendWithout the call to Wait in the loop, the app will appear locked and the user will be unable to change views.
ActiveProjectFile (read-only string)
Returns the filename of the active project, or the empty string if no project is open.
AddFileToProject
function AddFileToProject(const wsFilename: WideString): WordBool;
Adds the passed file to the active project. Note that the file must be contained under the main project folder or a
subfolder of the main project.
CloseProject
function CloseProject(wbCloseOpenFiles: WordBool): WordBool;
Closes the active project, if any. If wbCloseOpenFiles is True, then all open files are closed.
OpenProject
function OpenProject(const wsProjectFile: WideString): WordBool;
Opens the passed project file, making it the active project. Pass an empty string to display the "Open Project" dialog.
RemoveFileFromProject
function RemoveFileFromProject(const wsFilename: WideString): WordBool;
Removes the passed file from the active project.
ShowLastProjectError
function ShowLastProjectError;
Displays an error message for the last project-related error.
UploadProjectDlg
function UploadProjectDlg: WordBool;
Displays the upload project dialog for the active project.
UploadProject
function UploadProject(const wsTargetDir: WideString; const wbForceLCase, wbUploadOnlyNewer, wbEncryptCFML: WordBool): WordBool;
Uploads a project based on the passed criteria. Note that wbEncryptCFML
is specific to ColdFusion Studio.
Note: Each toolbar is identified by name, which is the same as the title bar caption that appears when the
toolbar is undocked. Names are unique, so two toolbars will never have the same name/caption.
Toolbars are loaded from files in the toolbar directory, which can be obtained from the
ToolbarDir
property. Toolbars names are the same as their file names without the
path or extension. For example, if the toolbar file is c:\homesite\toolbars\Custom.tbr
,
then the toolbar name is Custom
. Also note that toolbutton captions are limited to
two characters.
ToolbarDir (widestring, read-only property)
Returns the path where toolbar files are located.
CreateToolbar
function CreateToolbar(wsToolbarName: WideString): WordBool;
Creates a new, undocked toolbar of the passed name. Fails if a toolbar of the same name already exists.
HideToolbar
function HideToolbar(wsToolbarName: WideString): WordBool;
Hides a toolbar. Fails if the toolbar doesn't exist.
DeleteToolbar
function DeleteToolbar(wsToolbarName: WideString): WordBool;
Physically deletes the toolbar. Fails if toolbar doesn't exist or if toolbar is one of the
built-in toolbars (only works on custom toolbars - built-in toolbars can be hidden, but
not deleted).
ShowToolbar
function ShowToolbar(wsToolbarName: WideString): WordBool;
Displays a toolbar if it's not already showing. Fails if the toolbar doesn't exist.
AddAppToolbutton
AddAppToolbutton(wsToolbarName, wsExeFile, wsCmdLine, wsHint: WideString): WordBool;
Adds a toolbutton for an external application to the passed toolbar. Fails if the toolbar doesn't exist or if the
toolbutton could not be added. Returns True if the same toolbutton (based on wsExeFile and wsCmdLine) already
exists on the toolbar, but doesn't add a duplicate button.
The JavaScript example below creates a toolbar named "Apps" if one doesn't exist already, and then adds two custom
toolbuttons to it. The first toolbutton launches Windows Explorer, while the second one opens Windows Explorer
at the current folder in the editor:
function Main() { var TB_NAME = 'Apps'; var app = Application; if (!app.ToolbarExists(TB_NAME)) { app.CreateToolbar(TB_NAME); } app.AddAppToolbutton(TB_NAME, 'c:\\windows\\explorer.exe', '', 'Explorer'); app.AddAppToolbutton(TB_NAME, 'c:\\windows\\explorer.exe', app.CurrentFolder, 'Explorer - Current Folder'); }Here's the same code in VBScript:
Sub Main const TB_NAME = "Apps" Dim app set app = Application if not app.ToolbarExists(TB_NAME) then app.CreateToolbar TB_NAME end if app.AddAppToolbutton TB_NAME, "c:\windows\explorer.exe", "", "Explorer" app.AddAppToolbutton TB_NAME, "c:\windows\explorer.exe", app.CurrentFolder, "Explorer - Current Folder" End Sub
AddTagToolbutton
function AddTagToolbutton(wsToolbarName, wsTagStart, wsTagEnd, wsHint, wsCaption, wsImageFile: WideString): WordBool;
Adds a tag toolbutton (inserts tag pair when clicked) to the passed toolbar. Fails if toolbar doesn't exist.
Returns true if Toolbutton already exists, but doesn't add duplicate button.
AddScriptToolbutton
function AddScriptToolbutton(wsToolbarName, wsScriptFile, wsHint, wsCaption, wsImageFile: WideString): WordBool;
Adds a script toolbutton (executes passed JavaScript or VBScript file when clicked) to the passed toolbar.
Fails if toolbar doesn't exist. Returns true if Toolbutton already exists, but doesn't add duplicate button.
AddVTMToolbutton
function AddVTMToolbutton(wsToolbarName, wsScriptFile, wsHint, wsCaption, wsImageFile: WideString): WordBool;
Adds a VTM toolbutton (displays passed VTM dialog when clicked) to the passed toolbar. Fails if
toolbar doesn't exist. Returns true if Toolbutton already exists, but doesn't add duplicate button.
ToolbarExists
function ToolbarExists(wsToolbarName: WideString): WordBool;
Returns True if the passed toolbar exists.
SetToolbarDockPos
function SetToolbarDockPos(wsToolbarName: WideString; nDockPos: Integer): WordBool;
Sets the docking position of the toolbar. Allowed values for nDockPos are:
1 = Top
2 = Bottom
3 = Left
4 = Right
Fails if the toolbar doesn't exist.