
1142
Part VII
Extending Dreamweaver
The called command’s dialog box is presented and must be completed or canceled before the origi-
nating command can continue.
Many commands—especially those disguised as objects—are not intended to be directly
accessed by the user. However, Dreamweaver lists any valid command found in the
Commands folder on the menu—unless you add a comment as the first line of your HTML file in the
following format:
<!-- MENU-LOCATION=NONE -->
This code line inhibits the command name from being automatically displayed in the Commands menu list.
Creating a blank document
Commands aren’t limited to working on the current document—you can use a command to read,
modify, and even create new files. Any new file created using
createDocument() or createXHTML-
Document()
is an HTML or XHTML page based on the Default.html or Default.xhtml file found
in the Dreamweaver CS4\Configuration\DocumentTypes\NewDocuments folder.
Occasionally, however, a command must make a new non-HTML/XHTML document, such as an
XML or SMIL file or other file type that doesn’t use the
<html> ... </html> structure. To accom-
plish this task, you first create an HTML file and then replace its entire contents with your own
data—or nothing at all. The following custom function, developed by Andrew Wooldridge, makes
and saves a new, blank text file:
function doNew() {
var newDOM = dreamweaver.createDocument(); ...