Using JavaScript in HomeSite 4.0, Part II: Manipulating Projects, Part I | WebReference

Using JavaScript in HomeSite 4.0, Part II: Manipulating Projects, Part I

Using JavaScript in HomeSite 4.0, Part II

Manipulating Projects, Part I

In this page we'll teach you how to use HomeSite's Projects via JavaScript. First, familiarize yourself with the Project concept. A project is a collection of files. You can add to and remove files from a project. Files belonging to a certain project need not reside in the same directory and a single file can belong to several projects. The advantage of using projects is that you can operate on a project as a single entity. One of the most powerful command is the Upload Project that allows you to upload all project's files to a server with a single command. The Project configuration file has an extension of .apj. All Project-related commands are in the Project menu. You can also access your projects through the Projects window, reachable from the Project Tab:

Once you created your projects, you can activate one of them via the pulldown menu at the top of the Projects Window. The three buttons next to the pulldown menu are for creating a new project, opening an existing project, and for uploading a project to a server:

Right clicking on the active project opens the Project menu from which you can access many immediate commands such as adding files to the project, opening all its files, etc. Now that you are familiar with HomeSite's Projects, the following Application Object's property and methods will be more intuitive.


This property returns the currently-active project. If the current project is column49proj as shown above in the pulldown menu, then the following JavaScript line:

app.MessageBox(app.ActiveProjectFile, "test", 0);

will yield the following window:


Adds the given file (fileName) to the active project. The file must reside in the project folder or in one of its subfolders. Returns a true value when successful, a false value otherwise. When successful, you will see immediately the new file in the Projects window.


Closes the active project. It also closes all open files if the given flag (CloseFilesFlag) is true (regardless if they belong to the active project.) Returns a true value if successful, a false value otherwise. You will be prompted for each modified file whether to save its changes or not. Hitting the Cancel button on this prompt will return a false value from this method.


Opens a given project. The parameter should include the full file name, as in the following example:


You can also pass an empty string as a parameter to this method and force the Open Project dialog.

Produced by Yehuda Shiran and Tomer Shiran

Created: September 27, 1999
Revised: September 27, 1999