Using JavaScript in HomeSite 4.0, Part I: The Application Object's Properties, Part I
Using JavaScript in HomeSite 4.0, Part I
The Application Object's Properties, Part I
ActiveDocument |
Read-only | Object |
Returns the active document, in the form of an object. As you know, several documents can be open at the same time. However, only one document, the active one, is visible in the editor's window. We'll discuss the ActiveDocument
object in our next column.
AppPath |
Read-only | String |
Reflects the path to the application executable. In other words, it holds the directory where HomeSite (homesite4.exe) is located. For example, the value of this property could be "D:\PROGRAM FILES\ALLAIRE\HOMESITE4\." Notice that the path is followed by a backslash.
CurrentFolder |
Read-Write | String |
Holds the path currently displayed in the local file list. The local file list is displayed on the left hand side of the workplace:
In this example, the value of the CurrentFolder
property is "F:\Games." Notice that the path is not followed by a backslash. A script can also change the current path in the local file list by assigning a value to this property.
CurrentView |
Read-Write | Integer (1-3) |
Reflects the current view. This property holds one of the following values:
- 1 (Edit)
- 2 (Browse)
- 3 (Design)
If you assign this property any other integer, the operation is ignored. However, if it is assigned a different value type, such as a string, an error is generated. The following image outlines HomeSite's three different modes:
The following script can be applied to a button that toggles the current view between Edit and Browse:
var app = Application;
function Main() {
if (app.CurrentView == 1)
app.CurrentView = 2 // Browse
else if (app.CurrentView == 2)
app.CurrentView = 1 // Edit
}
Notice that this is a read-write property.
Produced by Yehuda Shiran and Tomer Shiran
Created: September 13, 1999
Revised: September 13, 1999
URL: https://www.webreference.com/js/column48/apppro1.html