Application Object

Properties

ActiveDocument (object, read-only)

Returns the active document. See the 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 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 ColdFusion 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

Width

Sets or returns the width in pixels, of the main application window. You can use this property with the Height property to investigate the size of the main window as well as to resize the window.

WindowState (integer)

Allowed values are:

1 - Normal
2 - Minimized
3 - Maximized

Methods

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 (that is, the user didn't cancel if wbPromptToSave is True).

ExecCommand (nCmdID: integer)

Execute a specific command based on its CommandID. See the "Table of CommandID Values" for details.

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 `\').

GetApplicationSetting (nSettingID: Integer)

Retrieves a specific application setting based on a SettingID. See the "Table of SettingID values" for details.

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&gt", "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 box for obtaining 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 box for obtaining a user response. The nType parameter determines the type of dialog box 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 box, 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.

Quit

procedure Quit;

This method will attempt to exit HS/CFS. It will prompt the user to save any unsaved documents prior to exiting.

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, returning 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

SetApplicationSetting (nSettingID: Integer; ovSettingVal: OleVariant)

Sets a specific application setting based on its SettingID. See the for specific SettingIDs.

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.

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.

ShowProgress

procedure ShowProgress;

Shows the progress bar.

ShowThumbnails

procedure ShowThumbnails(sFolder: OleString);

Shows thumbnails for all images in the passed folder.

StatusError

procedure StatusError(const wsMsg: WideString);

Displays an error message in the status bar - message will appear on a red background and display for at least 5 seconds.

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.

TagCase

function TagCase(const wsTag: WideString): WideString;

Changes the case of the passed string based on the "Lowercase all inserted tags" setting in the Options > HTML dialog box. 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)
wend        

Without the call to Wait in the loop, the application will appear locked and the user will be unable to change views.