Page 2
Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally.
Introduction The Dreamweaver API Reference describes two application programming interfaces (APIs) that let you perform various supporting tasks when developing Macromedia Dreamweaver 8 extensions and adding program code to your Dreamweaver web pages. These two APIs are the utility API and the JavaScript API. The utility API contains subsets of related functions that let you perform specific types of tasks.
To communicate with other developers who are involved in writing extensions, you might want to join the Dreamweaver extensibility newsgroup. You can access the website for this newsgroup at www.macromedia.com/go/extending_newsgrp/. New functions in Dreamweaver 8 The following new functions have been added to the Dreamweaver 8 JavaScript API. The...
Page 9
Workspace The following new Window, Code collapse, and Code view toolbar functions have been added to the Workspace chapter. Window on page 231 (added support for the Macintosh) dreamweaver.cascade() on page 239 (added support for the Macintosh) dreamweaver.tileHorizontally() on page 240 (added support for the Macintosh) dreamweaver.tileVertically() Code collapse...
Page 10
Site on page 256 dom.getSiteURLPrefixFromDoc() on page 257 dom.localPathToSiteRelative() on page 257 dom.siteRelativeToLocalPath() on page 258 dreamweaver.compareFiles() on page 259 dreamweaver.siteSyncDialog.compare() on page 260 dreamweaver.siteSyncDialog.markDelete() on page 260 dreamweaver.siteSyncDialog.markGet() on page 261 dreamweaver.siteSyncDialog.markIgnore() on page 261 dreamweaver.siteSyncDialog.markPut() on page 262 dreamweaver.siteSyncDialog.markSynced() on page 267 site.compareFiles()
Page 11
Design The following new CSS, Layout view, and Zoom functions have been added to the Design chapter: on page 419 cssStylePalette.getInternetExplorerRendering() on page 420 cssStylePalette.setInternetExplorerRendering() on page 421 dom.getElementView() on page 422 dom.getShowDivBackgrounds() on page 422 dom.getShowDivBoxModel() on page 423 dom.getShowDivOutlines() on page 424 dom.resetAllElementViews()
Page 12
Layout view on page 459 dom.getShowBlockBackgrounds() on page 459 dom.getShowBlockBorders() on page 460 dom.getShowBlockIDs() on page 461 dom.getShowBoxModel() on page 461 dom.setShowBlockBackgrounds() on page 462 dom.setShowBlockBorders() on page 462 dom.setShowBlockIDs() on page 463 dom.setShowBoxModel() Zoom on page 464 dreamweaver.activeViewScale() on page 465 dreamweaver.fitAll() on page 465 dreamweaver.fitSelection()
The following functions have been removed from the Dreamweaver 8 API because the associated features have been removed from the product. Errata A current list of known issues can be found in the Extensibility section of the Dreamweaver Support Center (www.macromedia.com/go/extending_errata). Errata...
Conventions used in this guide The following typographical conventions are used in this guide: font indicates code fragments and API literals, including class names, method Code names, function names, type names, scripts, SQL statements, and both HTML and XML tag and attribute names. font indicates replaceable items in code.
Page 15
PART 1 Utility APIs Learn about the Macromedia Dreamweaver 8 utility functions that you can use to access local and web-based files, work with Macromedia Fireworks, and Macromedia Flash objects, manage database connections, create new database connection types, access JavaBeans fscomponents, and integrate Dreamweaver with various source control systems.
CHAPTER 1 The File I/O API Macromedia Dreamweaver 8 includes a C shared library called DWfile, which gives authors of objects, commands, behaviors, data translators, floating panels, and Property inspectors the ability to read and write files on the local file system. This chapter describes the File I/O API and how to use it.
Page 18
Description This function copies the specified file to a new location. Arguments originalURL, copyURL argument, which is expressed as a file:// URL, is the file you want to originalURL copy. argument, which is expressed as a file:// URL, is the location where you copyURL want to save the copied file.
Page 19
Example The following code tries to create a folder called tempFolder at the top level of the C drive and displays an alert box that indicates whether the operation was successful: var folderURL = "file:///c|/tempFolder"; if (DWfile.createFolder(folderURL)){ alert("Created " + folderURL); }else{ alert("Unable to create "...
Page 20
Description This function gets the attributes of the specified file or folder. Arguments fileURL argument, which is expressed as a file:// URL, is the file or folder for which fileURL you want to get attributes. Returns A string that represents the attributes of the specified file or folder. If the file or folder does not exist, this function returns a value.
Page 21
Returns A string that contains a hexadecimal number that represents the number of time units that have elapsed since some base time. The exact meaning of time units and base time is platform-dependent; in Windows, for example, a time unit is 100ns, and the base time is January 1st, 1600.
Page 22
Example You can call this function and the function on a file to DWfile.getModificationDate() compare the modification date to the creation date: var file1 = "file:///c|/temp/file1.txt"; var time1 = DWfile.getCreationDate(file1); var time2 = DWfile.getModificationDate(file1); if (time1 == time2){ alert("file1 has not been modified since it was created"); }else if (time1 <...
Page 23
Arguments fileURL argument, which is expressed as a file:// URL, is the file for which you are fileURL checking the time of the most recent modification. Returns A JavaScript object that represents the date and time when the specified file was last Date modified.
Page 24
argument, if it is supplied, must be either (return only files) or constraint "files" (return only folders). If it is omitted, the function returns files and "directories" folders. Returns An array of strings that represents the contents of the folder. Example The following code gets a list of all the text (TXT) files in the C:/temp folder and displays the list in an alert message:...
Page 25
DWfile.remove() Availability Dreamweaver 3. Description This function deletes the specified file. Arguments fileURL argument, which is expressed as a file:// URL, is the file you want to fileURL remove. Returns A Boolean value: value if the operation succeeds; otherwise. true false Example The following example uses the...
Page 26
Arguments fileURL, strAttrs argument, which is expressed as a file:// URL, identifies the file for which fileURL you are setting the attributes. argument specifies the system-level attributes for the file that is identified strAttrs by the argument. The following table describes valid attribute values and their fileURL meaning: Attribute Value...
Page 27
Arguments fileURL, text, {mode} argument, which is expressed as a file:// URL, is the file to which you are fileURL writing. argument is the string to be written. text argument, if it is supplied, must be . If this argument is omitted, the mode "append"...
CHAPTER 2 The HTTP API Extensions are not limited to working within the local file system. Macromedia Dreamweaver 8 provides a mechanism to get information from and send information to a web server by using hypertext transfer protocol (HTTP). This chapter describes the HTTP API and how to use it.
Functions that return an object also have a callback version. Callback functions let other functions execute while the web server processes an HTTP request. This capability is useful if you are making multiple HTTP requests from Dreamweaver. The callback version of a function passes its ID and return value directly to the function that is specified as its first argument.
Page 31
</SCRIPT> <body onLoad="MMHttp.clearServerScriptsFolder()"> </body> </html> MMHttp.clearTemp() Description This function deletes all the files in the Configuration/Temp folder, which is located in the Dreamweaver application folder. Arguments None. Returns Nothing. Example The following code, when saved in a file within the Configuration/Shutdown folder, removes all the files from the Configuration/Temp folder when the user quits Dreamweaver: <html>...
Page 32
argument, which is optional, is a Boolean value that specifies whether to prompt prompt the user to save the file. If is outside the Configuration/Temp folder, a saveURL value of is ignored for security reasons. prompt false argument, which is optional, is the location on the user’s hard disk where saveURL the file should be saved, which is expressed as a file:// URL.
Page 33
Example The following code gets an HTML file, saves all the files in the Configuration/Temp folder, and then opens the local copy of the HTML file in a browser: var httpReply = MMHttp.getFile("http://www.dreamcentral.com/¬ people/profiles/scott.html", false); if (httpReply.statusCode == 200){ var saveLoc = httpReply.data; dw.browseDocument(saveLoc);...
Page 34
MMHttp.getFile() for a list of possible error codes. MMHttp.getText() Availability Macromedia Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Retrieves the contents of the document at the specified URL. Arguments URL, {serverScriptsFolder} argument is an absolute URL on a web server. If http:// is omitted from the URL, Dreamweaver assumes HTTP protocol.
Page 35
Arguments callbackFunc, URL, {serverScriptsFolder} argument is the JavaScript function to call when the HTTP request is callbackFunc complete. argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes HTTP protocol. argument is an optional string that names a particular serverScriptsFolder folder—relative to the Configuration folder on the application server—from which you want to retrieve server scripts.
Page 36
argument is an optional string that names a particular serverScriptsFolder folder—relative to the Configuration folder on the application server—to which you want to post the data. To post the data, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System). If an error occurs, Dreamweaver reports it in the property of the returned object.
Page 37
Arguments callbackFunc, URL, dataToPost, {contentType}, {serverScriptsFolder} argument is the name of the JavaScript function to call when the callbackFunc HTTP request is complete. argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes HTTP protocol. argument is the data to be posted.
CHAPTER 3 The Design Notes API Macromedia Dreamweaver 8, Macromedia Fireworks, and Macromedia Flash give web designers and developers a way to store and retrieve extra information about documents— information such as review comments, change notes, or the source file for a GIF or JPEG—in files that are called Design Notes.
The following example shows the Design Notes file for foghorn.gif.mno: <?xml version="1.0" encoding="iso-8859-1" ?> <info> <infoitem key="FW_source" value="file:///C|sites/¬ dreamcentral/images/sourceFiles/foghorn.png" /> <infoitem key="Author" value="Heidi B." /> <infoitem key="Status" value="Final draft, approved ¬ by Jay L." /> </info> The Design Notes JavaScript API All functions in the Design Notes JavaScript API are methods of the object.
Page 41
Arguments drivePath argument is a string that contains the full drive path. drivePath Returns A string that contains the file:// URL for the specified file. Example A call to returns MMNotes.filePathToLocalURL('C:\sites\webdev\index.htm') "file:///c|/sites/webdev/index.htm" MMNotes.get() Description This function gets the value of the specified key in the specified Design Notes file. Arguments fileHandle, keyName argument is the file handle that...
Page 42
MMNotes.getKeys() Description This function gets a list of all the keys in a Design Notes file. Arguments fileHandle argument is the file handle that the function returns. fileHandle MMNotes.open() Returns An array of strings where each string contains the name of a key. Example The following code might be used in a custom floating panel to display the Design Notes information for the active document:...
Page 43
MMNotes.getVersionName() Description This function gets the version name of the MMNotes shared library, which indicates the application that implemented it. Arguments None. Returns A string that contains the name of the application that implemented the MMNotes shared library. Example Calling the function from a Dreamweaver command, object, MMNotes.getVersionName() behavior, Property inspector, floating panel, or data translator returns...
Page 44
Returns A string that contains the local drive path for the specified file. Example A call to MMNotes.localURLToFilePath('file:///MacintoshHD/images/moon.gif') returns "MacintoshHD:images:moon.gif" MMNotes.open() Description This function opens the Design Notes file that is associated with the specified file or creates one if none exists. Arguments filePath, {bForceCreate} argument, which is expressed as a file:// URL, is the path to the main file...
MMNotes.set() Description This function creates or updates one key/value pair in a Design Notes file. Arguments fileHandle, keyName, valueString argument is the file handle that the function returns. fileHandle MMNotes.open() argument is a string that contains the name of the key. keyName argument is a string that contains the value.
Page 46
void CloseNotesFile() Description This function closes the specified Design Notes file and saves any changes. If all key/value pairs are removed from the Design Note file, Dreamweaver deletes it. Dreamweaver deletes the _notes folder when the last Design Notes file is deleted. Arguments FileHandle noteHandle argument is the file handle that the...
Page 47
argument is a string that contains the name of the key. keyName[64] argument is the buffer where the value is stored. valueBuf argument is the integer that valueBufLength GetNoteLength(noteHandle returns, which indicates the maximum length of the value buffer. keyName) Returns A Boolean value: indicates the operation is successful;...
Page 48
int GetNotesKeyCount() Description This function gets the number of key/value pairs in the specified Design Notes file. Arguments FileHandle noteHandle argument is the file handle that the function returns. noteHandle OpenNotesFile() Returns An integer that represents the number of key/value pairs in the Design Notes file. BOOL GetNotesKeys() Description This function gets a list of all the keys in a Design Notes file.
Page 49
if (succeeded){ for (int i=0; i < keyCount; i++){ printf("Key is: %s\n", keys[i]); printf("Value is: %s\n\n", GetNote(noteHandle, keys[i]); delete []keys; CloseNotesFile(noteHandle); BOOL GetSiteRootForFile() Description This function determines the site root for the specified Design Notes file. Arguments const char* filePath, char* siteRootBuf, int siteRootBufMaxLen, {InfoPrefs* infoPrefs} argument is the file://URL of the file for which you want the site root.
Page 50
Arguments char* versionNameBuf, int versionNameBufMaxLen argument is the buffer where the version name is stored. versionNameBuf argument is the maximum size of the buffer that the versionNameBufMaxLen argument references. versionNameBuf Returns A Boolean value: indicates the operation is successful; otherwise. Dreamweaver true false stores...
Page 51
Returns A Boolean value: indicates the operation is successful; otherwise. The true false argument receives the local drive path. drivePathBuf FileHandle OpenNotesFile() Description This function opens the Design Notes file that is associated with the specified file or creates one if none exists. Arguments const char* localFileURL, {BOOL bForceCreate} argument, which is expressed as a file:// URL, is a string that contains...
Page 52
BOOL RemoveNote() Description This function removes the specified key (and its value) from the specified Design Notes file. Arguments FileHandle noteHandle, const char keyName[64] argument is the file handle that the function returns. noteHandle OpenNotesFile() argument is a string that contains the name of the key to remove. keyName[64] Returns A Boolean value:...
Fireworks through its own JavaScript API documented in the Extending Fireworks manual. For general information on how C libraries interact with the JavaScript interpreter in Macromedia Dreamweaver 8, see Extending Dreamweaver for details on C-level extensibility. The FWLaunch API The FWLaunch object lets extensions open Fireworks, perform Fireworks operations using the Fireworks JavaScript API, and then return values back to Dreamweaver.
Page 54
FWLaunch.bringFWToFront() Availability Dreamweaver 3, Fireworks 3. Description This function brings Fireworks to the front if it is running. Arguments None. Returns Nothing. FWLaunch.execJsInFireworks() Availability Dreamweaver 3, Fireworks 3. Description This function passes the specified JavaScript, or a reference to a JavaScript file, to Fireworks to execute.
Page 55
Error starting Fireworks process, which indicates that the function does not open a valid version of Fireworks (version 3 or later). User cancelled the operation. FWLaunch.getJsResponse() Availability Dreamweaver 3, Fireworks 3. Description This function determines whether Fireworks is still executing the JavaScript passed to it by the function, whether the script completed successfully, or FWLaunch.execJsInFireworks() whether an error occurred.
Page 56
Example The following code passes the string "prompt('Please enter your name:')" and checks for the result: FWLaunch.execJsInFireworks() var progressCookie = FWLaunch.execJsInFireworks("prompt('Please enter your name:')"); var doneFlag = false; while (!doneFlag){ // check for completion every 1/2 second setTimeout('checkForCompletion()',500); function checkForCompletion(){ if (progressCookie != null) { var response = FWLaunch.getJsResponse(progressCookie);...
Page 57
FWLaunch.optimizeInFireworks() Availability Dreamweaver 2, Fireworks 2. Description This function opens a Fireworks optimization session for the specified image. Arguments docURL, imageURL, {targetWidth}, {targetHeight} argument is the path to the active document, which is expressed as a file:// docURL URL. argument is the path to the selected image. If the path is relative, it is imageURL relative to the path that you specify in the argument.
Page 58
FWLaunch.validateFireworks() Availability Dreamweaver 2, Fireworks 2. Description This function looks for the specified version of Fireworks on the user’s hard disk. Arguments {versionNumber} argument is an optional floating-point number that is greater than versionNumber or equal to 2; it represents the required version of Fireworks. If this argument is omitted, the default is 2.
Page 59
function readyToCancel() { gCancelClicked = true; function promptInFireworks() { var isFireworks3 = FWLaunch.validateFireworks(3.0); if (!isFireworks3) { alert("You must have Fireworks 3.0 or later to use this ¬ command"); return; // Tell Fireworks to execute the prompt() method. gProgressTrackerCookie = FWLaunch.execJsInFireworks¬ ("prompt('Please enter your name:')");...
Page 60
if (response == null) { // still waiting for a response, call us again in 1/2 a // second checkOneMoreTime(); } else if (typeof(response) == "number") { // if the response was a number, it means an error // occurred // the user cancelled in Fireworks window.close();...
Flash elements are packaged as SWC files. A SWC file is a compiled component movie clip that is generated by Flash for use by Macromedia and third-party products. Dreamweaver can make these components available to users through the Insert bar, Insert menu, or a toolbar.
Inserting Flash elements Flash elements are installed through the Extension Manager. Dreamweaver adds Flash elements to documents in the same manner as the objects that are available on the Insert bar or the Insert menu (for details about working with Dreamweaver objects, see “Insert Bar Objects”...
Adding a Flash Element to a menu A Flash element can also reside on the Insert menu, or on other menus, in Dreamweaver. Use the JavaScript function dom.insertFlashElement() with the menus.xml file format (see “Menus and Menu Commands” in Extending Dreamweaver) to specify the Flash element menu item location.
Page 64
Arguments templateFile, templateParams, swfFileName, {gifFileName}, {pngFileName}, {jpgFileName}, {movFileName}, {generatorParams} argument is a path to a template file, which is expressed as a file:// templateFile URL. This file can be a SWT file. argument is an array of name/value pairs where the names are the templateParams parameters in the SWT file, and the values are what you want to specify for those parameters.
Page 65
means that one or more of the name/value pairs is "invalidData" templateParams invalid. means the Generator cannot be initialized. "initGeneratorFailed" means there is insufficient memory to complete the operation. "outOfMemory" means an unknown error occurred. "unknownError" Example The following JavaScript creates a Flash object file of type , which replaces any "myType"...
Page 66
SWFFile.getObjectType() Description This function returns the Flash object type; the value that passed in the parameter dwType when the function created the file. SWFFile.createFile() Arguments fileName argument, which is expressed as a file:// URL, is a path to a Flash Object fileName file.
Page 67
Example Calling returns the var params = SWFFile.readFile("file:///MyMac/test.swf") following values in the parameters array: "file:///MyMac/test.swt" // template file used to create this .swf file "dwType" // first parameter "myType" // first parameter value "text" // second parameter "Hello World" // second parameter value The Flash Objects API...
Database API functions are used at design time when users are building web applications, not at runtime when the web application is deployed. You can use these functions in any extension. In fact, the Macromedia Dreamweaver 8 Server Behavior, Data Format, and Data Sources API functions all use these database functions.
var bIsSimple = ParseSimpleSQL(statement); statement = stripCFIFSimple(statement); if (bIsSimple) { statement = RemoveWhereClause(statement,false); } else { var pa = new Array(); if (ss.ParamArray != null) { for (var i = 0; i < ss.ParamArray.length; i++) { pa[i] = new Array(); pa[i][0] = ss.ParamArray[i].name;...
Page 71
Returns Nothing. Example The following example deletes a database connection: function clickedDelete() var selectedObj = dw.serverComponents.getSelectedNode(); if (selectedObj && selectedObj.objectType=="Connection") var connRec = MMDB.getConnection(selectedObj.name); if (connRec) MMDB.deleteConnection(selectedObj.name); dw.serverComponents.refresh(); MMDB.getColdFusionDsnList() Availability Dreamweaver UltraDev 4. Description This function gets the ColdFusion data source names (DSNs) from the site server, using the functions.
Page 72
Arguments name argument is a string variable that specifies the name of the connection that you name want to reference. Returns A reference to a named connection object. Connection objects contain the following properties: Property Description Connection name name Indicates, if is a value of , which DLL to use for type...
Page 73
MMDB.getConnectionList() Availability Dreamweaver UltraDev 1. Description This function gets a list of all the connection strings that are defined in the Connection Manager. Arguments None. Returns An array of strings where each string is the name of a connection as it appears in the Connection Manager.
Page 74
The connection strings for Connection 1 and Connection 2 are the same. Connection 2 connects to a more recent version of the driver. You should pass the driver name TdsDriver to this function to fully qualify the connection name you want to return. Arguments connString, {driverName} argument is the connection string that gets the connection name.
Page 75
Example The code returns var connectionString = MMDB.getConnectionString ("EmpDB") different strings for an ADO or JDBC connection. For an ADO connection, the following string can return: "dsn=EmpDB;uid=;pwd="; For a JDBC connection, the following string can return: "jdbc:inetdae:192.168.64.49:1433?database=pubs&user=JoeUser&¬ password=joesSecret" MMDB.getDriverName() Availability Dreamweaver UltraDev 1.
Page 76
For Dreamweaver MX (or later), these drivers and URL templates are hard-coded in the JDBC dialog boxes. In addition, this function is an empty function definition to eliminate undefined-function errors. The following example shows how a JDBC driver and URL template are hard-coded: var DEFAULT_DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver";...
Page 77
Description This function gets the password that is used for the specified connection. Arguments connName argument is a connection name that is specified in the Connection connName Manager. It identifies the connection string that Dreamweaver should use to make a database connection to a live data source.
Page 78
Arguments None. Returns A string that contains the RDS user name. MMDB.getRemoteDsnList() Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description This function gets the ODBC DSNs from the site server. The getRDSUserName() functions are used when the server model of the current site is getRDSPassword() ColdFusion.
Page 79
Arguments connName argument is a connection name that is specified in the Connection connName Manager. It identifies the connection string that Dreamweaver should use to make a database connection to a live data source. Returns A string that corresponds to the connection type. This function can return one of the following values: , or "ADO"...
Page 80
MMDB.hasConnectionWithName() Availability Dreamweaver UltraDev 4. Description This function determines whether a connection of a given name exists. Arguments name argument is the connection name. name Returns Returns a Boolean value: indicates that a connection with the specified name exists; true otherwise.
Page 81
MMDB.needToRefreshColdFusionDsnList() Availability Dreamweaver MX. Description This function tells the Connection Manager to empty the cache and get the ColdFusion data source list from the application server the next time a user requests the list. Arguments None. Returns Nothing. MMDB.popupConnection() Availability Dreamweaver MX.
Page 82
connrec, bDuplicate argument is a string that contains the name of an HTML file that dialogFileName resides in the Configuration/Connections/server-model folder. This HTML file defines the dialog box that creates a connection. This file must implement three JavaScript API functions: , and findConnection() inspectConnection()
Page 83
Arguments username argument is a valid RDS user name. username Returns Nothing. MMDB.showColdFusionAdmin() Availability Dreamweaver MX. Description This function displays the ColdFusion Administrator dialog box. Arguments None. Returns Nothing. The ColdFusion Administrator dialog box appears. MMDB.showConnectionMgrDialog() Availability Dreamweaver UltraDev 1. Description This function displays the Connection Manager dialog box.
Page 84
Description This function displays the System ODBC Administration dialog box or the ODBC Data Source Administrator dialog box. Arguments None. Returns Nothing. The System ODBC Administration dialog box or the ODBC Data Source Administrator dialog box appears. MMDB.showRdsUserDialog() Availability Dreamweaver UltraDev 4. Description This function displays the RDS user name and password dialog box.
Page 85
Arguments catalog, schema argument is the initial catalog value. catalog argument is the initial schema value. schema Returns An object that contains the new values in the properties. If either catalog schema property is not defined, it indicates that the user cancelled the dialog box. MMDB.testConnection() Availability Dreamweaver UltraDev 4.
Database access functions Database access functions let you query a database. For the collection of functions that manage a database connection, see “Database connection functions” on page The following list describes some of the arguments that are common to the functions that are available: Most database access functions use a connection name as an argument.
Page 87
Example The code var columnArray = MMDB.getColumnAndTypeList("EmpDB","Select * from returns the following array of strings: Employees") columnArray[0] = "EmpName" columnArray[1] = "varchar" columnArray[2] = "EmpFirstName" columnArray[3] = "varchar" columnArray[4] = "Age" columnArray[5] = "integer" MMDB.getColumnList() Availability Dreamweaver UltraDev 1. Description This function gets a list of columns from an executed SQL statement.
Page 88
Description This function returns an array of objects that describe the columns in the specified table. Arguments connName, tableName argument is the connection name. This value identifies the connection connName containing the string that Dreamweaver should use to make a database connection to a live data source.
Page 89
MMDB.getColumnsOfTable() Availability Dreamweaver UltraDev 1. Description This function gets a list of all the columns in the specified table. Arguments connName, tableName argument is a connection name that is specified in the Connection connName Manager. It identifies the connection string that Dreamweaver should use to make a database connection to a live data source.
Page 90
argument is the name of the table for which you want to retrieve the set tableName of columns that comprises the primary key of that table. Returns An array of strings. The array contains one string for each column that comprises the primary key.
Page 91
Returns An array of procedure objects where each procedure object has the following set of three properties: Property Name Description Name of the schema that is associated with the object. schema* This property identifies the user that is associated with the stored procedure in the SQL database that the function getProcedures()
Page 92
var procName = String(thisSchema + thisProcedure.procedure); MMDB.getSPColumnList() Availability Dreamweaver UltraDev 1. Description This function gets a list of result set columns that are generated by a call to the specified stored procedure. Arguments connName, statement, paramValuesArray argument is a connection name that is specified in the Connection connName Manager.
Page 93
MMDB.getSPColumnListNamedParams() Availability Dreamweaver UltraDev 1. Description This function gets a list of result set columns that are generated by a call to the specified stored procedure. Arguments connName, statement, paramNameArray, paramValuesArray argument is a connection name that is specified in the Connection connName Manager.
Page 94
The following values return: columnArray[0] = "EmpID", columnArray[1] = "LastName",¬ columnArray[2] ="startDate", columnArray[3] = "salary" MMDB.getSPParameters() Availability Dreamweaver MX. Description This function returns an array of parameter objects for a named procedure. Arguments connName, procName argument is a connection name that is specified in the Connection connName Manager.
Page 95
var tooltiptext = paramObj.datatype; tooltiptext+=" "; tooltiptext+=GetDirString(paramObj.directiontype); MMDB.getSPParamsAsString() Availability Dreamweaver UltraDev 1. Description This function gets a comma-delimited string that contains the list of parameters that the stored procedure takes. Arguments connName, procName argument is a connection name that is specified in the Connection connName Manager.
Page 96
Description This function gets a list of all the tables that are defined for the specified database. Each table object has three properties: , and table schema catalog Arguments connName argument is a connection name that is specified in the Connection connName Manager.
Page 97
Returns An array of view objects where each object has three properties: , and catalog schema view to restrict or filter the number of views that pertain to an individual catalog schema schema name or catalog name that is defined as part of the connection information. Example The following example returns the views for a given connection value, CONN_LIST.getValue()
Page 98
Returns Nothing. This function returns an error if the SQL statement or the connection string is invalid. Example The following code displays the results of the executed SQL statement: MMDB.showResultset("EmpDB","Select EmpName,EmpFirstName,Age ¬ from Employees") MMDB.showSPResultset() Availability Dreamweaver UltraDev 1. Description This function displays a dialog box that contains the results of executing the specified stored procedure.
Page 99
MMDB.showSPResultset("EmpDB", "getNewEmployeesMakingAtLeast", ¬ paramValueArray) MMDB.showSPResultsetNamedParams() Availability Dreamweaver UltraDev 1. Description This function displays a dialog box that contains the result set of the specified stored procedure. The dialog box displays a tabular grid in which the header provides column information that describes the result set. If the connection string or the stored procedure is invalid, an error appears.
As a developer, you can create new connection types and corresponding dialog boxes for new or existing server models for Macromedia Dreamweaver 8. Then, when a user sets up a site to start building pages, he or she creates a new connection object after selecting the particular type of connection that you created.
Page 102
Windows platform is stored in the ASP_Js/Win folder and is named Connection_ado_conn_string.htm. At runtime, Macromedia Dreamweaver dynamically builds the list of connection types that are available to the user from the collection of dialog boxes that are in the ASP_Js/Win folder.
Unless you need to define connection parameters other than the ones provided in the standard connection_includefile.edml file, these two steps are the minimum to create a new connection dialog box. The title of the dialog box that the user sees is in the title tag, which is specified in the HTML document.
Page 104
When the user clicks OK in a connection dialog box, Dreamweaver calls the function to build the HTML, which is placed in the connection include applyConnection() file that is located in the Configuration/Connections folder. The applyConnection() function returns an empty string that indicates there is an error in one of the fields and the dialog box should not be closed.
Page 105
Property Description Name of a JDBC driver used at runtime driver Name of the user for the runtime connection username Password used for the runtime connection password Design-time connection string (see designtimeString string Design-time data source name (see designtimeDsn Name of a JDBC driver used at design time designtimeDriver Name of the user used for the design-time connection designtimeUsername...
Page 106
Description Dreamweaver calls this function to initialize the dialog box data for defining a connection when the user edits an existing connection. This process lets Dreamweaver populate the dialog box with the appropriate connection information. Argument parameters argument is the same object that the function returns.
The generated include file The include file that generates declares all the properties of a applyConnection() connection.The filename for the include file is the connection name and has the file extension that is defined for the server model associated with the current site. Connections are shared, so set the allowMultiple value to false.
Page 108
The UltraDev 4 ColdFusion include file should be named MyConnection1.cfm, where MyConnection1 is the name of your connection. The following example shows the include file for a ColdFusion connection to a product table: <!-- FileName="Connection_cf_dsn.htm" "dsn=products" --> <!-- Type="ADO" --> <!-- Catalog=""...
The definition file for your connection type For each server model, there is a connection_includefile.edml file that defines the connection type and maps the properties that are defined in the include file to elements in the Dreamweaver interface. Dreamweaver provides seven default definition files, one for each of the predefined server models, as listed in the following table.
Page 110
// Schema="@@schema@@" var MM_@@cname@@_STRING = @@string@@ %> ]]> </insertText> <searchPatterns whereToSearch="directive"> <searchPattern paramNames="filename"> <![CDATA[/\/\/\s*FileName="([^"]*)"/]]></searchPattern> <searchPattern paramNames="type,designtimeString"> <![CDATA[/\/\/\s+Type="(\w*)"([^\r\n]*)/]]></searchPattern> <searchPattern paramNames="designtimeType" isOptional="true"> <![CDATA[/\/\/\s*DesigntimeType="(\w*)"/]]></searchPattern> <searchPattern paramNames="http"> <![CDATA[/\/\/\s*HTTP="(\w+)"/]]></searchPattern> <searchPattern paramNames="catalog"> <![CDATA[/\/\/\s*Catalog="(\w*)"/]]></searchPattern> <searchPattern paramNames="schema"> <![CDATA[/\/\/\s*Schema="(\w*)"/]]></searchPattern> <searchPattern paramNames="cname,string"> <![CDATA[/var\s+MM_(\w*)_STRING\s*=\s*([^\r\n]+)/]]></searchPattern> </searchPatterns> </participant> Tokens in an EDML file—such as in this example—map values in the @@filename@@ include file to properties of a connection object.
Java introspection calls for JavaBeans support. These functions get class names, methods, properties, and events from the JavaBeans, which can appear in the Dreamweaver user interface (UI). To use these JavaScript functions and let Macromedia Dreamweaver 8 access your JavaBeans, the JavaBeans must reside in the Configuration/Classes folder.
Page 112
MMJB.getClassesFromPackage() Availability Dreamweaver UltraDev 4. Description This function reads all the JavaBeans classes from the package. Arguments packageName.pathName argument is the path to the package. It must be a Java JAR packageName.pathName or ZIP Java archive (for example, C:/jdbcdrivers/Una2000_Enterprise.zip) Returns A string array of class names inside the particular JAR or ZIP Java archive;...
Page 113
Arguments packageName.className, {packagePath} argument is the name of the class. The class must reside in packageName.className a JAR or ZIP Java archive. If is omitted, the archive must reside in your packagePath system or be a class file that is installed in the Configuration/Classes folder. classpath argument is an optional string that points to the location of the JAR or packagePath...
Page 114
Description Introspects the JavaBeans class and returns its methods. Arguments packageName.className, {packagePath} argument is the name of the class. The class must reside in packageName.className a JAR or ZIP Java archive. If is omitted, the archive must reside in your packagePath system or be a class file that is installed in the Configuration/Classes folder.
Page 115
Description Gets read-only properties for JavaBeans that support get accessor calls. Arguments packageName.className, {packagePath} argument is the name of the class. The class must reside in packageName.className a JAR or ZIP Java archive. If is omitted, the archive must reside in your packagePath system or be a class file that is installed in the Configuration/Classes folder.
CHAPTER 9 The Source Control Integration API The Source Control Integration API lets you write shared libraries to extend the Macromedia Dreamweaver 8 Check In/Check Out feature using source control systems (such as Sourcesafe or CVS). Your libraries must support a minimum set of API functions for Dreamweaver to integrate with a source control system.
How source control integration with Dreamweaver works When a Dreamweaver user selects server connection, file transfer, or Design Notes features, Dreamweaver calls the DLL’s version of the corresponding API function ( Connect() , and Disconnect() Get() Put() Checkin() Checkout() Undocheckout() ).
The Source Control Integration API required functions The Source Control Integration API has required and optional functions. The functions listed in this section are required. bool SCS_GetAgentInfo() Description This function asks the DLL to return its name and description, which appear in the Edit Sites dialog box.
Page 120
bool SCS_Connect() Description This function connects the user to the source control system. If the DLL does not have log-in information, the DLL must display a dialog box to prompt the user for the information and must store the data for later use. Arguments void **connectionData, const char siteName[64] argument is a handle to the data that the agent wants...
Page 121
Arguments void *connectionData argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() Returns A Boolean value: if successful; otherwise. true false int SCS_GetRootFolderLength() Description This function returns the length of the name of the root folder. Arguments void *connectionData argument is a pointer to the agent’s data that passed into...
Page 122
int SCS_GetFolderListLength() Description This function returns the number of items in the passed-in folder. Arguments void *connectionData, const char *remotePath argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is the full path and name of the remote folder that the DLL remotePath checks for the number of items.
Page 123
name char[256] Name of file or folder Hour component of modification date 0-23 hour Minute component of modification date 0-59 minutes Second component of modification date 0-59 seconds char[256] Type of file (if not set by DLL, Dreamweaver uses file type extensions to determine type, as it does now) In bytes...
Page 124
bool SCS_Put() Description This function puts a list of local files or folders into the source control system. Arguments void *connectionData, const char *localPathList[], const char *remotePathList[], const int numItems argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call.
Page 125
Arguments void *connectionData, const char *remotePathList[], const int numItems argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is a list of remote filenames or folder paths to delete. remotePathList argument is the number of items in numItems remotePathList Returns...
bool SCS_ItemExists() Description This function determines whether a file or folder exists on the server. Arguments void *connectionData, const char *remotePath argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is a remote file or folder path. remotePath Returns A Boolean value:...
Page 127
bool SCS_SiteDeleted() Description This function notifies the DLL that the site has been deleted or that the site is no longer tied to this source control system. It indicates that the source control system can delete its persistent information for this site. Arguments const char siteName[64] argument is a string that points to the name of the site.
Page 128
Returns An integer that indicates the number of new features to add to Dreamweaver. If the function returns , Dreamweaver considers it an error and tries to retrieve the error message from the < 0 DLL, if supported. bool SCS_GetNewFeatures() Description This function returns a list of menu items to add to the Dreamweaver main and context menus.
Page 129
bool SCS_GetCheckoutName() Description This function returns the check-out name of the current user. If it is unsupported by the source control system and this feature is enabled by the user, this function uses the Dreamweaver internal Check In/Check Out functionality, which transports LCK files to and from the source control system.
Page 130
Returns A Boolean value: if successful; otherwise. true false bool SCS_Checkout() Description This function checks out a list of local files or folders from the source control system. The DLL is responsible for granting the privileges that let the file be writable. If it is unsupported by the source control system and this feature is enabled by the user, this function uses the Dreamweaver internal Check In/Check Out functionality, which transports LCK files to and from the source control system.
Page 131
Arguments void *connectionData, const char *remotePathList[], const char *localPathList[], bool successList[], const int numItems argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is a list of remote filenames or folder paths on which to remotePathList undo the check out.
Page 132
bool SCS_GetFileCheckoutList() Description This function returns a list of users who have a file checked out. If the list is empty, no one has the file checked out. Arguments void *connectionData, const char *remotePath, char checkOutList[][64], char emailAddressList[][64], const int numCheckedOut argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the...
Page 133
bool SCS_GetErrorMessage() Description This function returns the last error message. If you implement getErrorMessage() Dreamweaver calls it each time one of your API functions returns the value false If a routine returns , it indicates an error message should be available. false Arguments void *connectionData, char errorMsg[], const int *msgLength...
Page 134
int SCS_GetMaxNoteLength() Description This function returns the length of the largest Design Note for the specified file or folder. If it is unsupported by the source control system, Dreamweaver gets this information from the companionMNO file. Arguments void *connectionData, const char *remotePath argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the...
Page 135
argument is a list of Boolean values that correspond to the Design showColumnList Note keys, which indicate whether Dreamweaver can display the key as a column in the Site panel. argument is the number of Design Notes that are attached to a file or noteCount folder;...
Page 136
Returns A Boolean value: if successful; otherwise. true false bool SCS_IsRemoteNewer() Description This function checks each specified remote path to see if the remote copy is newer. If it is unsupported by the source control system, Dreamweaver uses its internal algorithm.
Enablers If the optional enablers are not supported by the source control system or the application is not connected to the server, Dreamweaver determines when the menu items are enabled, based on the information it has about the remote files. bool SCS_canConnect() Description This function returns whether the Connect menu item should be enabled.
Page 138
bool SCS_canCheckout() Description This function returns whether the Checkout menu item should be enabled. Arguments void *connectionData, const char *remotePathList[], const char *localPathList[], const int numItems argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call.
Page 139
bool SCS_canCheckin() Description This function returns whether the Checkin menu item should be enabled. Arguments void *connectionData, const char *localPathList[], const char *remotePathList[], const int numItems argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call.
Page 140
bool SCS_canNewFolder() Description This function returns whether the New Folder menu item should be enabled. Arguments void *connectionData, const char *remotePath argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is a list of remote filenames or folder paths that the user remotePath selected to indicate where the new folder will be created.
Page 141
Arguments void *connectionData, const char *remotePath argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call. Connect() argument is the remote filenames or folder paths that can be remotePathList renamed. Returns A Boolean value: if successful;...
Page 142
bool SCS_BeforePut() Description Dreamweaver calls this function before putting or checking in one or more files. This function lets your DLL perform one operation, such as adding a check-in comment, to a group of files. Arguments *connectionData The * argument is a pointer to the agent’s data that passed into connectionData Dreamweaver during the call.
Page 143
Example “bool SCS_BeforeGet()” on page 141. bool SCS_AfterPut() Description Dreamweaver calls this function after putting or checking in one or more files. This function lets the DLL perform any operation after a batch put or check in, such as creating a summary dialog box.
Page 145
JavaScript API Use any of the more than 600 core JavaScript functions available in Macromedia Dreamweaver 8, which encapsulate the kinds of tasks users perform when creating or editing a document. You can use these functions to perform any task that the user can accomplish using menus, floating panels, property inspectors, the Site panel, or the Document window.
(setting preferences, exiting Dreamweaver, and other functions). External application functions External application functions handle operations that are related to the Macromedia Flash application and to the browsers and external editors that are defined in the Preview in Browser and External Editors preferences. These functions let you get information about these external applications and open files with them.
Page 148
argument, which was added in Dreamweaver 3, specifies a browser. This browser argument can be the name of a browser, as defined in the Preview in Browser preferences or either . If the argument is omitted, the URL opens in the 'primary' 'secondary' user’s primary browser.
Page 149
Example A call to the function might return an dreamweaver.getExtensionEditorList(".gif") array that contains the following strings: "Fireworks 3" "file:///C|/Program Files/Macromedia/Fireworks 3/Fireworks 3.exe" dreamweaver.getExternalTextEditor() Availability Dreamweaver 4. Description Gets the name of the currently configured external text editor. External application functions...
Page 150
Arguments None. Returns A string that contains the name of the text editor that is suitable for presentation in the user interface (UI), not the full path. dreamweaver.getFlashPath() Availability Dreamweaver MX. Description Gets the full path to the Flash MX application in the form of a file URL. Arguments None.
Page 151
Description Gets the path to the primary browser. Arguments None. Returns A string that contains the path on the user’s computer to the primary browser, which is expressed as a file:// URL. If no primary browser is defined, it returns nothing. dreamweaver.getPrimaryExtensionEditor() Availability Dreamweaver 3.
Page 152
Returns A string that contains the path on the user’s computer to the secondary browser, which is expressed as a file:// URL. If no secondary browser is defined, it returns nothing. dreamweaver.openHelpURL() Availability Dreamweaver MX. Description Opens the specified Help file in the operating system Help viewer. Dreamweaver displays help content in the standard operating system help viewer instead of a browser.
Page 153
The help.map file The help.map file maps a help content ID to a specific help book. Dreamweaver uses the help.map file to locate specific help content when it calls help internally. The helpDoc.js file The helpDoc.js file lets you map variable names that you can use in place of the actual book ID and page string.
Page 154
Returns Nothing. dreamweaver.openWithBrowseDialog() Availability Dreamweaver 3. Description Opens the Select External Editor dialog box to let the user select the application with which to open the specified file. Arguments fileURL argument is the path to the file to open, which is expressed as a file:// URL. fileURL Returns Nothing.
Description Opens the named file with the specified image editor. This function invokes a special Macromedia Fireworks integration mechanism that returns information to the active document if Fireworks is specified as the image editor. To prevent errors if no document is active, this function should never be called from the Site panel.
Page 156
dreamweaver.beep() Availability Dreamweaver MX. Description Creates a system beep. Arguments None. Returns Nothing. Example The following example calls to call the user’s attention to a message that the dw.beep() function displays: alert() beep(){ if(confirm(“Is your order complete?”) dreamweaver.beep(); alert(“Click OK to submit your order”); dreamweaver.getShowDialogsOnInsert() Availability Dreamweaver 3.
Page 157
dreamweaver.quitApplication() Availability Dreamweaver 3. Description Quits Dreamweaver after the script that calls this function finishes executing. Arguments None. Returns Nothing. dreamweaver.showAboutBox() Availability Dreamweaver 3. Description Opens the About dialog box. Arguments None. Returns Nothing. dreamweaver.showDynamicDataDialog() Availability Dreamweaver UltraDev 1. Global application functions...
Page 158
Description Displays the Dynamic Data or the Dynamic Text dialog box, and waits for the user to dismiss the dialog box. If the user clicks OK, the function returns a showDynamicDataDialog() string to insert into the user’s document. (This string returns from the Data Sources API function, , and passes to the Data Format API function, generateDynamicDataRef()
Page 159
Returns Nothing. Example dw.showPasteSpecialDialog(); dreamweaver.showPreferencesDialog() Availability Dreamweaver 3. Added the argument in Dreamweaver 8. strCategory Description This function opens the Preferences dialog box. Arguments {strCategory} argument, which is optional, must be one of the following strings to strCategory open the correlating category of the Preferences dialog box: "general"...
Page 160
dreamweaver.showTagChooser() Availability Dreamweaver MX. Description Toggles the visibility of the Tag Chooser dialog box for users to insert tags into the Code view. The function shows the Tag Chooser dialog box on top of all other Dreamweaver windows. If the dialog box is not visible, the function opens it, brings it to the front, and sets focus to it. If the Tag Chooser is visible, the function hides the dialog box.
CHAPTER 11 Workspace Workspace API functions create or operate on an element of the Macromedia Dreamweaver 8 workspace. They perform tasks such as redoing steps that appear in the History panel, placing an object on the Insert bar, navigating with Keyboard functions, reloading menus, manipulating standalone or built-in results windows, setting options, positioning a toolbar, and getting or setting focus.
Page 162
dom.undo() Availability Dreamweaver 3. Description Undoes the previous step in the document. Arguments None. Returns Nothing. Enabler “dom.canUndo()” on page 563 dreamweaver.getRedoText() Availability Dreamweaver 3. Description Gets the text that is associated with the editing operation that will be redone if the user selects Edit >...
Page 163
dreamweaver.getUndoText() Availability Dreamweaver 3. Description Gets the text that is associated with the editing operation that will be undone if the user selects Edit > Undo or presses Control+Z (Windows) or Command+Z (Macintosh). Arguments None. Returns A string that contains the text that is associated with the editing operation that will be undone.
Page 164
dreamweaver.redo() Availability Dreamweaver 3. Description Redoes the step that was most recently undone in the active Document window, dialog box, floating panel, or Site panel. Arguments None. Returns Nothing. Enabler “dreamweaver.canRedo()” on page 570. dreamweaver.startRecording() Availability Dreamweaver 3. Description Starts recording steps in the active document; the previously recorded command is immediately discarded.
Page 165
dreamweaver.stopRecording() Availability Dreamweaver 3. Description Stops recording without prompting the user. Arguments None. Returns Nothing. Enabler “dreamweaver.isRecording()” on page 579 (must return a value of true dreamweaver.undo() Availability Dreamweaver 3. Description Undoes the previous step in the Document window, dialog box, floating panel, or Site panel that has focus.
Page 166
Description Clears all steps from the History panel and disables the Undo and Redo menu items. Arguments None. Returns Nothing. dreamweaver.historyPalette.copySteps() Availability Dreamweaver 3. Description Copies the specified history steps to the Clipboard. Dreamweaver warns the user about possible unintended consequences if the specified steps include an unrepeatable action. Arguments arrayOfIndices argument is an array of position indices in the History panel.
Page 167
Returns An array that contains the position indices of all the selected steps. The first position is position 0 (zero). Example If the second, third, and fourth steps are selected in the History panel, as shown in the following figure, a call to the dreamweaver.historyPalette.getSelectedSteps() function returns [1,2,3]...
Page 168
Arguments arrayOfIndices argument is an array of position indices in the History panel. arrayOfIndices Returns A string that contains the JavaScript that corresponds to the specified history steps. Example If the three steps shown in the following example are selected in the History panel, a call to dreamweaver.historyPalette.getStepsAsJavaScript(dw.historyPalette.getSelect function returns edSteps())
Page 169
dreamweaver.historyPalette.replaySteps() Availability Dreamweaver 3. Description Replays the specified history steps in the active document. Dreamweaver warns the user of possible unintended consequences if the specified steps include an unrepeatable action. Arguments arrayOfIndices argument is an array of position indices in the History panel. arrayOfIndices Returns A string that contains the JavaScript that corresponds to the specified history steps.
Page 170
Example The following example saves the fourth, sixth, and eighth steps in the History panel as a command: dreamweaver.historyPalette.saveAsCommand([3,5,7]); dreamweaver.historyPalette.setSelectedSteps() Availability Dreamweaver 3. Description Selects the specified steps in the History panel. Arguments arrayOfIndices function is an array of position indices in the History panel. If no arrayOfIndices argument is supplied, all the steps are unselected.
Returns Nothing. Insert object functions Insert object functions handle operations related to the objects on the Insert bar or listed on the Insert menu. dom.insertFlashElement() Availability Dreamweaver MX 2004. Description Inserts a specified Flash element (SWC file) into the current document. This function assumes that the Flash element has been added to the Insert bar, and the component file resides in the Configuration/Objects/FlashElements folder or subfolder.
Page 172
Arguments menuId argument is the string that defines the menu in the insertbar.xml file. menuId Returns A string value defining the ID of the default item. Example The following example assigns the current default object for the Media menu to the defID variable: var defId = dw.objectPalette.getMenuDefault("DW_Media");...
dreamweaver.reloadObjects() Availability Dreamweaver MX 2004. Description Reloads all the objects on the Insert bar. This function is the equivalent of Control+left- clicking the mouse on the Categories menu on the Insert bar and selecting the Reload Extensions menu option. Arguments None.
Page 174
Returns Nothing. dom.arrowLeft() Availability Dreamweaver 3. Description Moves the insertion point to the left the specified number of times. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of times that the insertion point nTimes must move left. If this argument is omitted, the default is 1. argument, which is optional, is a Boolean value that indicates whether bShiftIsDown to extend the selection.
Page 175
dom.arrowUp() Availability Dreamweaver 3. Description This function moves the insertion point up the specified number of times. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of times that the insertion point nTimes must move up. If this argument is omitted, the default is 1. argument, which is optional, is a Boolean value that indicates whether bShiftIsDown to extend the selection.
Page 176
dom.deleteKey() Availability Dreamweaver 3. Description This function is equivalent to pressing the Delete key the specified number of times. The exact behavior depends on whether there is a current selection or only an insertion point. Arguments {nTimes} argument, which is optional, is the number of times that a Delete operation nTimes must occur.
Page 177
dom.endOfLine() Availability Dreamweaver 3. Description Moves the insertion point to the end of the line. Arguments {bShiftIsDown} argument, which is optional, is a Boolean value that indicates whether bShiftIsDown to extend the selection. If the argument is omitted, the default is false Returns Nothing.
Page 178
dom.nextWord() Availability Dreamweaver 3. Description Moves the insertion point to the beginning of the next word or skips multiple words if is greater than 1. nTimes Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of words that the insertion point nTimes must move ahead.
Page 179
dom.pageUp() Availability Dreamweaver 3. Description Moves the insertion point up one page (equivalent to pressing the Page Up key). Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of pages that the insertion point nTimes must move up. If this argument is omitted, the default is 1. argument, which is optional, is a Boolean value that indicates whether bShiftIsDown to extend the selection.
Page 180
dom.previousWord() Availability Dreamweaver 3. Description Moves the insertion point to the beginning of the previous word or skips multiple words if is greater than 1. nTimes Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of words that the insertion point nTimes must move back.
Page 181
dom.startOfLine() Availability Dreamweaver 3. Description Moves the insertion point to the beginning of the line. Arguments {bShiftIsDown} argument, which is optional, is a Boolean value that indicates whether bShiftIsDown to extend the selection. If the argument is omitted, the default is false Returns Nothing.
Menu functions Menu functions handle optimizing and reloading the menus in Dreamweaver. The function and the dreamweaver.getMenuNeedsUpdating() function are designed specifically to prevent dreamweaver.notifyMenuUpdated() unnecessary update routines from running on the dynamic menus that are built into Dreamweaver. See dreamweaver.getMenuNeedsUpdating() dreamweaver.notifyMenuUpdated() for more information.
Arguments menuId, menuListFunction argument is a string that contains the value of the attribute for the menu menuId item, as specified in the menus.xml file. argument must be one of the following strings: menuListFunction "dw.cssStylePalette.getStyles()" "dw.getDocumentDOM().getFrameNames()" "dw.getDocumentDOM().getEditableRegionList" "dw.getBrowserList()" "dw.getRecentFileList()" "dw.getTranslatorList()" "dw.getFontList()"...
Page 184
dreamweaver.createResultsWindow() Availability Dreamweaver 4. Description Creates a new Results window and returns a JavaScript object reference to the window. Arguments strName, arrColumns argument is the string to use for the window’s title. strName argument is an array of column names to use in the list control. arrColumns Returns An object reference to the created window.
Page 185
Example The following example checks for errors at the offset of the current selection in the document and, if there are errors, displays them in the specified window ( ) of the Results floaterName panel. Otherwise, it opens the Target Browser Check window of the Results panel and displays the first visible item for the document.
Page 186
argument is a string you can use to store specific data about the item being itemData added such as a document line number. argument is the start of selection offset in the file. Specify the value iStartSel null if you are not specifying an offset. argument is the end of selection offset in the file.
Page 187
Arguments strFilePath, strIcon, strDisplay, strDesc, {iLineNo}, {iStartSel}, {iEndSel} argument is a fully qualified URL path of the file to process. strFilePath argument is the path to the icon to use. To display a built-in icon, use a strIcon value "1" through "10" instead of the fully qualified path for the icon (use "0" for no icon).
Page 188
Returns An array of strings. The first element in the array is the name of the command that added the item; the remaining elements are the same strings that were passed to the addItem() function. resWin.getItemCount() Availability Dreamweaver 4. Description Retrieves the number of items in the list.
Page 189
Description Sets the buttons specified by the argument. arrButtons Arguments cmdDoc arrButtons argument is a document object that represents the command that is calling cmdDoc the function. Commands should use the keyword this argument is an array of strings that correspond to the button text and arrButtons the JavaScript code to execute when the button is clicked.
Page 190
Arguments arrWidth argument is an array of integers that represents the widths to use for each arrWidth column in the control. Returns Nothing. resWin.setFileList() Availability Dreamweaver 4. Description Gives the Results window a list of files, folders, or both to call a set of commands to process. Arguments arrFilePaths, bRecursive argument is an array of file or folder paths to iterate through.
Page 191
resWin.setTitle() Availability Dreamweaver 4. Description Sets the title of the window. Arguments strTitle argument is the new name of the floating panel. strTitle Returns Nothing. resWin.startProcessing() Availability Dreamweaver 4. Description Starts processing the file. Arguments None. Returns Nothing. resWin.stopProcessing() Availability Dreamweaver 4.
Page 192
Returns Nothing. Working with the built-in Results panel group These functions produce output in the Results panel group. The Results panel group displays tabbed reports on searches, source validation, sitewide reports, browser targets, console reports, FTP logging, and link checking. Working with specific child panels The following child panels are built-in Results windows that always exist in the Dreamweaver interface and can be accessed directly.
Page 193
Enabler “dreamweaver.resultsPalette.canClear()” on page 579. dreamweaver.resultsPalette.Copy() Availability Dreamweaver MX. Description Sends a copied message to the window that is in focus (often used for the FTP logging window). Arguments None. Returns Nothing. Enabler “dreamweaver.resultsPalette.canCopy()” on page 580. dreamweaver.resultsPalette.cut() Availability Dreamweaver MX. Description Sends a cut message to the window in focus (often used for the FTP logging window).
Page 194
dreamweaver.resultsPalette.Paste() Availability Dreamweaver MX. Description Sends a pasted message to the window in focus (often used for the FTP logging window). Arguments None. Returns Nothing. Enabler “dreamweaver.resultsPalette.canPaste()” on page 580. dreamweaver.resultsPalette.openInBrowser Availability Dreamweaver MX. Description Sends a report (Site Reports, Browser Target Check, Validation, and Link Checker) to the default browser.
Page 195
dreamweaver.resultsPalette.openInEditor() Availability Dreamweaver MX. Description Jumps to the selected line for specific reports (Site Reports, Browser Target Check, Validation, and Link Checker), and opens the document in the editor. Arguments None. Returns Nothing. Enabler “dreamweaver.resultsPalette.canOpenInEditor()” on page 581. dreamweaver.resultsPalette.save() Availability Dreamweaver MX.
Page 196
dreamweaver.resultsPalette.selectAll() Availability Dreamweaver MX. Description Sends a Select All command to the window in focus. Arguments None. Returns Nothing. Enabler “dreamweaver.resultsPalette.canSelectAll()” on page 582. Server debugging Dreamweaver can request files from ColdFusion and display the response in its embedded browser. When the response returns from the server, Dreamweaver searches the response for a packet of XML that has a known signature.
Page 197
dreamweaver.resultsPalette.debugWindow.addDebug ContextData() Availability Dreamweaver MX. Description Interprets a customized XML file that returns from the server that is specified in the Site Definition dialog box. The contents of the XML file display as tree data in the Server Debug panel, so you can use the Server Debug panel to evaluate server-generated content from various server models.
For example: <serverdebuginfo> <context> <template><![CDATA[/ooo/master.cfm]]></template> <path><![CDATA[C:\server\wwwroot\ooo\master.cfm]]></path> <timestamp><![CDATA[0:0:0.0]]></timestamp> </context> <debugnode> <name><![CDATA[CGI]]></name> <icon><![CDATA[ServerDebugOutput/ColdFusion/CGIVariables.gif]]></icon> <debugnode> <name><![CDATA[Pubs.name.sourceURL]]></name> <icon><![CDATA[ServerDebugOutput/ColdFusion/Variable.gif]]></icon> <value><![CDATA[jdbc:macromedia:sqlserver:// name.macromedia.com:1111;databaseName=Pubs]]></value> </debugnode> </debugnode> <debugnode> <name><![CDATA[Element Snippet is undefined in class coldfusion.compiler.TagInfoNotFoundException]]></name> <icon><![CDATA[ServerDebugOutput/ColdFusion/Exception.gif]]></icon> <jumptoline linenumber="3" startposition="2" endposition="20"> <template><![CDATA[/ooo/master.cfm]]></template> <path><![CDATA[C:\Neo\wwwroot\ooo\master.cfm]]></path> </jumptoline> </debugnode> </serverdebuginfo> Returns Nothing. Toggle functions Toggle functions get and set various options either on or off.
Page 199
Arguments None. Returns A Boolean value: indicates the content is the active view; otherwise. true NOFRAMES false dom.getHideAllVisualAids() Availability Dreamweaver 4. Description This function determines whether visual aids are set as hidden. Arguments None. Returns A Boolean value: sets Hide All Visual Aids to hidden; otherwise.
Page 200
dom.getShowAutoIndent() Availability Dreamweaver 4. Description This function determines whether auto-indenting is on in the Code view of the document window. Arguments None. Returns A Boolean value: if auto-indenting is on; otherwise. true false dom.getShowFrameBorders() Availability Dreamweaver 3. Description This function gets the current state of the View > Frame Borders option. Arguments None.
Page 201
Returns A Boolean value: indicates the grid is visible; otherwise. true false dom.getShowHeadView() Availability Dreamweaver 3. Description This function gets the current state of the View > Head Content option. Arguments None. Returns A Boolean value: indicates the head content is visible; otherwise.
Page 202
Arguments None. Returns A Boolean value: indicates the image maps are visible; otherwise. true false dom.getShowInvisibleElements() Availability Dreamweaver 3. Description This function gets the current state of the View > Invisible Elements option. Arguments None. Returns A Boolean value: indicates the invisible element markers are visible; otherwise.
Page 203
Description This function determines whether line numbers are shown in the Code view. Arguments None. Returns A Boolean value: indicates the line numbers are shown; otherwise. true false dom.getShowRulers() Availability Dreamweaver 3. Description This function gets the current state of the View > Rulers > Show option. Arguments None.
Page 204
dom.getShowTableBorders() Availability Dreamweaver 3. Description This function gets the current state of the View > Table Borders option. Arguments None. Returns A Boolean value: indicates the table borders are visible; otherwise. true false dom.getShowToolbar() Availability Dreamweaver 4. Description This function determines whether the toolbar appears. Arguments None.
Page 205
Returns A Boolean value: indicates the option is on; otherwise. true false dom.getShowWordWrap() Availability Dreamweaver 4. Description This function determines whether word wrap is on in the Code view of the document window. Arguments None. Returns A Boolean value: if word wrap is on; otherwise.
Page 206
Arguments bEditNoFrames argument is a Boolean value: turns on the Edit NoFrames bEditNoFrames true Content option; turns it off. false Returns Nothing. Enabler “dom.canEditNoFramesContent()” on page 556. dom.setHideAllVisualAids() Availability Dreamweaver 4. Description This function turns off the display of all borders, image maps, and invisible elements, regardless of their individual settings in the View menu.
Page 207
Returns Nothing. dom.setShowFrameBorders() Availability Dreamweaver 3. Description This function toggles the View > Frame Borders option on and off. Arguments bShowFrameBorders argument is a Boolean value: turns the Frame Borders on; bShowFrameBorders true otherwise. false Returns Nothing. dom.setShowGrid() Availability Dreamweaver 3. Description This function toggles the View >...
Page 208
dom.setShowHeadView() Availability Dreamweaver 3. Description This function toggles the View > Head Content option on and off. Arguments bShowHead argument is a Boolean value: turns on the Head Content option; bShowHead true turns it off. false Returns Nothing. dom.setShowInvalidHTML() Availability Dreamweaver 4.
Page 209
dom.setShowImageMaps() Availability Dreamweaver 3. Description This function toggles the View > Image Maps option on and off. Arguments bShowImageMaps argument is a Boolean value, turns on the Image Maps bShowImageMaps true option; turns it off. false Returns Nothing. dom.setShowInvisibleElements() Availability Dreamweaver 3.
Page 210
Arguments bShowLayerBorders argument is a Boolean value, turns on the Layer Borders bShowLayerBorders true option; turns it off. false Returns Nothing. dom.setShowLineNumbers() Availability Dreamweaver 4. Description This function shows or hides the line numbers in the Code view of the document window. Arguments bShow argument is a Boolean value:...
Page 211
dom.setShowSyntaxColoring() Availability Dreamweaver 4. Description This function turns syntax coloring on or off in the Code view of the document window. Arguments bShow argument is a Boolean value: indicates that syntax coloring should be bShow true visible; otherwise. false Returns Nothing.
Page 212
Arguments bShow argument is a Boolean value: indicates the toolbar should be visible; bShow true otherwise. false Returns Nothing. dom.setShowTracingImage() Availability Dreamweaver 3. Description This function toggles the View > Tracing Image > Show option on and off. Arguments bShowTracingImage argument is a Boolean value: turns on the Show option;...
Page 213
Returns Nothing. dom.setSnapToGrid() Availability Dreamweaver 3. Description This function toggles the View > Grid > Snap To option on or off. Arguments bSnapToGrid argument is a Boolean value: turns on the Snap To option; bSnapToGrid true false turns it off. Returns Nothing.
Page 214
dreamweaver.getShowStatusBar() Availability Dreamweaver 3. Description This function gets the current state of the View > Status Bar option. Arguments None. Returns A Boolean value: indicates the status bar is visible; otherwise. true false dreamweaver.htmlInspector.getShowAutoIndent() Availability Dreamweaver 4. Description This function determines whether the Auto Indent option is on in the Code inspector. Arguments None.
Page 215
Returns A Boolean value: if invalid HTML code is highlighted; otherwise. true false dreamweaver.htmlInspector.getShowLineNumbers() Availability Dreamweaver 4. Description This function determines whether line numbers appear in the Code inspector. Arguments None. Returns A Boolean value: if line numbers appear; otherwise. true false dreamweaver.htmlInspector.getShowSyntaxColoring...
Page 216
Arguments None. Returns A Boolean value: if word wrap is on; otherwise. true false dreamweaver.htmlInspector.setShowAutoIndent() Availability Dreamweaver 4. Description This function turns the Auto Indent option on or off in the Code inspector. Arguments bShow argument is a Boolean value: true turns the auto-indenting on; turns it bShow false...
Page 217
dreamweaver.htmlInspector.setShowLineNumbers() Availability Dreamweaver 4. Description This function shows or hides the line numbers in the Code view of the Code inspector. Arguments bShow argument is a Boolean value: sets the line numbers to visible; bShow true false hides them. Returns Nothing.
Page 218
dreamweaver.htmlInspector.setShowWordWrap() Availability Dreamweaver 4. Description This function turns the Word Wrap option off or on in the Code inspector. Arguments bShow argument is a Boolean value: turns Word Wrap on; turns it off. bShow true false Returns Nothing. dreamweaver.setHideAllFloaters() Availability Dreamweaver 3.
Page 219
Arguments bShowStatusBar argument is a Boolean value: turns on the Status Bar option; bShowStatusBar true turns it off. false Returns Nothing. site.getShowDependents() Availability Dreamweaver 3. Description This function gets the current state of the Show Dependent Files option. Arguments None. Returns A Boolean value: indicates that dependent files are visible in the site map;...
Page 220
site.getShowPageTitles() Availability Dreamweaver 3. Description This function gets the current state of the Show Page Titles option. Arguments None. Returns A Boolean value: indicates that the page titles are visible in the site map; true false otherwise. site.getShowToolTips() Availability Dreamweaver 3. Description This function gets the current state of the Tool Tips option.
Page 221
Arguments bShowDependentFiles argument is a Boolean value: turns on the Show bShowDependentFiles true Dependent Files option; turns it off. false Returns Nothing. site.setShowHiddenFiles() Availability Dreamweaver 3. Description This function toggles the Show Files Marked as Hidden option in the site map on or off. Arguments bShowHiddenFiles argument is a Boolean value:...
Enabler “site.canShowPageTitles()” on page 596. site.setShowToolTips() Availability Dreamweaver 3. Description This function toggles the Tool Tips option on or off. Arguments bShowToolTips argument is a Boolean value: turns on the Tool Tips option; bShowToolTips true turns it off. false Returns Nothing.
Page 223
Returns Nothing. dom.getShowToolbarIconLabels() Availability Dreamweaver MX. Description This function determines whether labels for buttons are visible in the current document window. Dreamweaver always shows labels for non-button controls, if the labels are defined. Arguments None. Returns A Boolean value: if labels for buttons are visible in the current document window; true otherwise.
Page 224
Returns An array of all toolbar IDs. Example The following example stores the array of toolbar IDs in the variable: tb_ids var tb_ids = new Array(); tb_ids = dom.getToolbarIdArray(); dom.getToolbarItemValue() Availability Dreamweaver MX 2004. Description Gets the value of the specified toolbar item. Arguments toolbarID, itemID argument is a string that specifies the ID of the toolbar that contains the...
Page 225
dom.getToolbarLabel() Availability Dreamweaver MX. Description This function obtains the label of the specified toolbar. You can use dom.getToolbarLabel() for menus that show or hide toolbars. Arguments toolbar_id argument is the ID of the toolbar, which is the value of the ID attribute toolbar_id on the toolbar tag in the toolbars.xml file.
Page 226
Example The following example checks whether the toolbar is visible in the document myEditbar window, and then stores that value in the variable: retval var retval = dom.getToolbarVisibility("myEditbar"); return retval; dom.setToolbarItemAttribute() Availability Dreamweaver MX 2004. Description Changes an attribute value for the three image attributes or the tooltip attribute on a toolbar item.
Page 227
dom.setShowToolbarIconLabels() Availability Dreamweaver MX. Description This function tells Dreamweaver to show the labels of buttons that have labels. Dreamweaver always shows labels for non-button controls, if the labels are defined. Arguments bShow argument is a Boolean value: shows the labels for buttons; bShow true false...
Page 228
argument specifies where Dreamweaver positions the toolbar, relative to position other toolbars. The possible values for are described in the following list: position is the default position. The toolbar appears at the top of the document window. makes the toolbar appear at the beginning of the row immediately below the below toolbar that specifies.
Example The following example checks to see if the toolbar myEditbar is visible in the document window; if it is not visible, it sets myEditbar to be visible: var dom = dw.getDocumentDOM(); if(dom != null && dom.getToolbarVisibility("myEditbar") == false) dom.setToolbarVisibility("myEditbar", true); Window functions Window functions handle operations that are related to the document window and the floating panels.
Page 230
dom.getView() Availability Dreamweaver 4. Description This function determines which view is visible. Arguments None. Returns , or , depending on the visible view. "design" "code" "split" dom.getWindowTitle() Availability Dreamweaver 3. Description This function gets the title of the window that contains the document. Arguments None.
Page 231
Arguments viewString argument is the view to produce; it must be one of the following values: viewString , or "design" "code" "split". Returns Nothing. dreamweaver.bringAttentionToFloater() Availability Dreamweaver MX. Description Brings the specified panel or inspector to the front, and draws attention to the panel or inspector by making it flash, which is slightly different functionality than dw.toggleFloater() Arguments...
Page 232
Arguments None. Returns Nothing. Example The following example cascades the open documents: dw.cascade() dreamweaver.getActiveWindow() Availability Dreamweaver 3. Description This function gets the document in the active window. Arguments None. Returns The document object that corresponds to the document in the active window; or, if the document is in a frame, the document object that corresponds to the frameset.
Page 233
dreamweaver.getFloaterVisibility() Availability Dreamweaver 3. Description This function checks whether the specified panel or inspector is visible. Arguments floaterName argument is the name of a floating panel. If does not floaterName floaterName match one of the built-in panel names, Dreamweaver searches in the Configuration/ Floaters folder for a file called where is the name of a...
Page 234
Site = " " site Site Files = "site files" Site Map - “ ” site map Snippets = "snippets" Target Browser Check Results = "btc" Validation Results = "validation" Returns A Boolean value: if the floating panel is visible and in the front; otherwise or if true false...
Page 235
dreamweaver.getPrimaryView() Availability Dreamweaver 4. Description This function determines which view is visible as the primary view in the front. Arguments None. Returns strings, depending on which view is visible or on the top in a split "design" "code" view. dreamweaver.getSnapDistance() Availability Dreamweaver 4.
Page 236
Arguments bMinimize argument is a Boolean value: if windows should be minimized; bMinimize true if the minimized windows should be restored. false Returns Nothing. dreamweaver.setActiveWindow() Availability Dreamweaver 3. Description This function activates the window that contains the specified document. Arguments documentObject, {bActivateFrame} argument is the object at the root of a document’s DOM tree (the documentObject...
Page 237
Arguments floaterName, bIsVisible argument is the name of a floating panel. If does not floaterName floaterName match one of the built-in panel names, Dreamweaver searches in the Configuration/ Floaters folder for a file called where is the name of a floaterName floaterName floating panel.
Page 238
Tag inspector = "tag inspector" Target Browser Check Results = "btc" Templates = " " templates Validation Results = "validation" argument is a Boolean value that indicates whether to make the floating bIsVisible panel visible. Returns Nothing. dreamweaver.setPrimaryView() Availability Dreamweaver 4. Description This function displays the specified view at the top of the document window.
Page 239
Arguments snapDistance argument is an integer that represents the snapping distance in pixels. snapDistance The default is 10 pixels. Specify 0 to turn off the Snap feature. Returns Nothing. dreamweaver.showProperties() Availability Dreamweaver 3. Description This function makes the Property inspector visible and gives it focus. Arguments None.
Page 240
Example The following example tiles the open documents horizontally: dw.tileHorizontally() dreamweaver.tileVertically() Availability Dreamweaver MX (Windows only), Dreamweaver 8 (added Macintosh support). Description Tiles the document window vertically, positioning one document window behind the other without overlapping documents. This is similar to splitting the workspace horizontally. Arguments None.
Arguments floaterName argument is the name of the window. If the floating panel name is floaterName , the visible/invisible state of the Reference panel is updated by the user’s reference selection in Code view. All other panels track the selection all the time, but the Reference panel tracks the selection in Code view only when the user invokes tracking.
Page 242
Description This function determines whether the selection in Code view is entirely within a single pair of start and end tags or contains a single pair of start and end tags. If so, it collapses the code fragment that starts just before the start tag and ends after the end tag; if not, the function does nothing.
Page 243
Returns Nothing. Example The following example adjusts the boundaries of the code before the starting tag after the ending tag to perform a smart collapse that preserves indenting and spacing: var currentDOM = dw.getDocumentDOM(); currentDOM.collapseFullTagInverse(true); dom.collapseSelectedCodeFragment() Availability Dreamweaver 8. Description This function collapses the selected code in Code view.
Page 244
Description This function collapses all code before and after the selected code in Code view. Arguments allowAdjustmentOfCodeFragments argument is a required, Boolean value. If allowAdjustmentOfCodeFragments true Dreamweaver adjusts the boundaries of the code before and after the current selection to perform a smart collapse, which preserves the current indenting and spacing.
Page 245
dom.expandSelectedCodeFragments() Availability Dreamweaver 8. Description This function expands all collapsed code fragments in Code view that are within the current selection. If the selection is already expanded, this function does nothing. Arguments None. Returns Nothing. Example The following example expands all collapsed code in the current selection in Code view: var currentDOM = dw.getDocumentDOM();...
Page 246
Example The following example collapses the code fragment in the current selection in the Code inspector that starts just before the start tag and ends just after the end tag: dreamweaver.htmlInspector.collapseFullTag(false); dreamweaver.htmlInspector.collapseFullTagInverse() Availability Dreamweaver 8. Description This function determines whether the selection in the Code inspector is entirely within a single pair of start and end tags or contains a single pair of start and end tags.
Page 247
Description This function collapses the selected code in the Code inspector. If the selection is already collapsed, this function does nothing. Arguments allowCodeFragmentAdjustment is a required, Boolean value. If , Dreamweaver allowCodeFragmentAdjustment true modifies the current selection to perform a smart collapse, which preserves the existing indenting and spacing.
Page 248
Example The following example collapses all code before and after the selected code in the Code inspector, exactly as indicated by the selection: dreamweaver.htmlInspector.collapseSelectedCodeFragmentInverse(false); dreamweaver.htmlInspector.expandAllCodeFragments() Availability Dreamweaver 8. Description This function expands all collapsed code fragments in the Code inspector, including nested collapsed code fragments.
Example The following example expands all collapsed code in the current selection in the Code inspector: dreamweaver.htmlInspector.expandSelectedCodeFragments(); Code view toolbar functions Code view toolbar functions let you insert text, remove comments, show or hide special characters for white spaces in Code view, and get the path of the current document. There are two different Coding toolbars: one for Code view and one for the Code inspector.
Page 250
Description This function determines whether the special characters for white spaces are shown in the Code view of the Document window. Arguments None. Returns A Boolean: if the hidden characters are displayed; otherwise. true false Example The following example turns off the display of the special characters for white space, if the display of special characters is turned on initially: var currentDOM = dw.getDocumentDOM();...
Page 251
dom.source.applyComment() Availability Dreamweaver 8. Description This function inserts the text specified in the argument before the current beforeText selection and the text specified in the argument after the current selection. The afterText function then extends the current selection to include the added text. However, if there is no current selection, the function does not select anything.
Page 252
Description This function removes comments. If you specify no arguments, it removes all types of comments from the current selection, except server-side includes and Dreamweaver-specific comments. If there are nested comments, it removes only the outer comment. If there is no current selection, it removes only the first line comment of the line on which the cursor is located.
Page 253
Example The following example turns off the display of the special characters for white space in the Code inspector, if the display of special characters is turned on initially: if (dreamweaver.htmlinspector.getShowHiddenCharacters()){ dreamweaver.htmlinspector.setShowHiddenCharacters(false); dreamweaver.htmlInspector.setShowHiddenCharacters() Availability Dreamweaver 8. Description This function shows or hides the special characters for white spaces in the Code view of the Code inspector.
Report functions Report functions provide access to the Macromedia Dreamweaver 8 reporting features so you can initiate, monitor, and customize the reporting process. For more information, see “Reports” in Extending Dreamweaver Help.
dreamweaver.showReportsDialog() Availability Dreamweaver 4. Description Opens the Reports dialog box. Arguments None. Returns Nothing. Site functions Site functions handle operations that are related to files in the site files or site map. These functions let you perform the following tasks: Create links between files Get, put, check in, and check out files Select and deselect files...
Page 257
Returns A string, which specifies the site URL prefix. Example The following example gets the site URL prefix for the current document: var currentDOM = dw.getDocumentDOM(); var sitePrefix = dom.getSiteURLPrefixFromDoc(); dom.localPathToSiteRelative() Availability Dreamweaver 8. Description This function converts a local file path to a site-relative URI reference. Arguments localFilePath attribute, which is required, is a string that contains the path to a...
Page 258
Arguments siteRelativeURI attribute, which is required, is a string that contains the site- siteRelativeURI relative URI. Returns A string, which specifies the path to a local file on your local computer. Example The following var filePath = siteRelativeToLocalPath("/myWebApp/myFile.xml"); returns , based on your site mappings and the "C:\Inetpub\wwwroot\siteA\myFile.xml"...
Page 259
dreamweaver.loadSitesFromPrefs() Availability Dreamweaver 4. Description Loads the site information for all the sites from the system registry (Windows) or the Dreamweaver Preferences file (Macintosh) into Dreamweaver. If a site is connected to a remote server when this function is called, the site is automatically disconnected. Arguments None.
Page 260
Arguments None. Returns Nothing. Enabler “dreamweaver.siteSyncDialog.canCompare()” on page 582. dreamweaver.siteSyncDialog.markDelete() Availability Dreamweaver 8. Description This function changes the action for the selected items in the Site Synchronization dialog box to Delete. Arguments None. Returns Nothing. Enabler “dreamweaver.siteSyncDialog.canMarkDelete()” on page 583. dreamweaver.siteSyncDialog.markGet() Availability Dreamweaver 8.
Page 261
Returns Nothing. Enabler “dreamweaver.siteSyncDialog.canMarkGet()” on page 583. dreamweaver.siteSyncDialog.markIgnore() Availability Dreamweaver 8. Description This function changes the action for the selected items in the Site Synchronization dialog box to Ignore. Arguments None. Returns Nothing. Enabler “dreamweaver.siteSyncDialog.canMarkIgnore()” on page 584. dreamweaver.siteSyncDialog.markPut() Availability Dreamweaver 8.
Page 262
Enabler “dreamweaver.siteSyncDialog.canMarkPut()” on page 584. dreamweaver.siteSyncDialog.markSynced() Availability Dreamweaver 8. Description This function changes the action for the selected items in the Site Synchronization dialog box to Synced. Arguments None. Returns Nothing. Enabler “dreamweaver.siteSyncDialog.canMarkSynced()” on page 585. dreamweaver.siteSyncDialog.toggleShowAllFiles() Availability Dreamweaver 8. Description This function lets you see which files Dreamweaver thinks are the same on the remote and local sites in the Site Synchronize preview dialog box.
Page 263
site.addLinkToExistingFile() Availability Dreamweaver 3. Description Opens the Select HTML File dialog box to let the user select a file and creates a link from the selected document to that file. Arguments None. Returns Nothing. Enabler “site.canAddLink()” on page 586. site.addLinkToNewFile() Availability Dreamweaver 3.
Page 264
site.changeLinkSitewide() Availability Dreamweaver 3. Description Opens the Change Link Sitewide dialog box. Arguments None. Returns Nothing. site.changeLink() Availability Dreamweaver 3. Description Opens the Select HTML File dialog box to let the user select a new file for the link. Arguments None.
Page 265
Description Checks in the selected files and handles dependent files in one of the following ways: If the user selects Prompt on Put/Check In in the Site FTP preferences, the Dependent Files dialog box appears. If the user previously selected the Don’t Show Me Again option in the Dependent Files dialog box and clicked Yes, dependent files are uploaded and no dialog box appears.
Page 266
site.checkOut() Availability Dreamweaver 3. Description Checks out the selected files and handles dependent files in one of the following ways: If the user selects Prompt on Get/Check Out in the Site FTP preferences, the Dependent Files dialog box appears. If the user previously selected the Don’t Show Me Again option in the Dependent Files dialog box and clicked Yes, dependent files are downloaded and no dialog box appears.
Page 267
site.cloak() Availability Dreamweaver MX. Description Cloaks the current selection in the Site panel or the specified folder. Arguments siteOrURL argument must contain one of the following two values: siteOrURL The keyword , which indicates that should act on the selection in the Site "site"...
Page 268
Enabler “site.canCompareFiles()” on page 589. Example The following example compares the files selected in the Site panel with their remote versions: site.compareFiles("site"); site.defineSites() Availability Dreamweaver 3. Description This function opens the Edit Sites dialog box. Arguments None. Returns Nothing. site.deleteSelection() Availability Dreamweaver 3.
Page 269
site.deployFilesToTestingServerBin() Availability Dreamweaver MX. Description Puts a specified file (or files) in the testing server’s bin folder. If the current site does not have any settings defined for deploying supporting files, this function invokes the Deploy Supporting Files To Testing Server dialog box. Arguments filesToDeploy argument is an array of filenames that Dreamweaver will deploy.
Page 272
site.findLinkSource() Availability Dreamweaver 3. Description Opens the file that contains the selected link or dependent file, and highlights the text of the link or the reference to the dependent file. This function operates only on files in the Site Map view.
Page 273
Returns Nothing. Enabler “site.canGet()” on page 590. site.getAppServerAccessType() Availability Dreamweaver MX. Description Returns the access method that is used for all files on the current site’s application server. The current site is the site that is associated with the document that currently has focus. If no document has focus, the site that you opened in Dreamweaver is used.
Page 274
Description Determines the path to the remote files on the application server that is defined for the current site. The current site is the site that is associated with the document that currently has focus. If no document has focus, the site that you opened in Dreamweaver is used. ColdFusion Component Explorer uses this function;...
Page 275
site.getCheckOutUser() Availability Dreamweaver 3. Description Gets the login and check-out name that is associated with the current site. Arguments None. Returns A string that contains a login and check-out name, if defined, or an empty string if Check In/ Check Out is disabled. Example A call to might return...
Page 276
site.getCloakingEnabled() Availability Dreamweaver MX. Description Determines whether cloaking is enabled for the current site. Arguments None. Returns A Boolean value: if cloaking is enabled for the current site; otherwise. true false site.getConnectionState() Availability Dreamweaver 3. Description Gets the current connection state. Arguments None.
Page 277
Arguments None. Returns A string that contains the name of the current site. Example If you defined several sites, a call to returns the one that is currently site.getCurrentSite() showing in the Current Sites List in the Site panel. site.getFocus() Availability Dreamweaver 3.
Page 278
Returns A Boolean value: if all the selected links are visible; otherwise. true false site.getLocalPathToFiles() Availability Dreamweaver MX. Description Determines the path to the local files that are defined for the current site. The current site is the site that is associated with the document that currently has focus. If no document has focus, the site that you opened in Dreamweaver is used.
Page 279
site.getSiteForURL() Availability Dreamweaver MX. Description Gets the name of the site, if any, that is associated with a specific file. Arguments fileURL argument is the fully qualified URL (including the string " ) for a fileURL file://" named file. Returns A string that contains the name of the site, if any, in which the specified file exists.
Page 280
site.getSiteURLPrefix() Availability Dreamweaver 8. Description Gets the site URL prefix that is extracted from the HTTP Address defined in Local Info section. Arguments None. Returns A string that contains the site URL prefix. Example sitePrefix = getSiteURLPrefix(); site.importSite() Availability Dreamweaver MX. Description Creates a Dreamweaver site from an XML file.
Page 281
site.invertSelection() Availability Dreamweaver 3. Description Inverts the selection in the site map. Arguments None. Returns Nothing. site.isCloaked() Availability Dreamweaver MX. Description Determines whether the current selection in the Site panel or the specified folder is cloaked. Arguments siteOrURL argument must contain one of the following two values: siteOrURL The keyword , which indicates that the...
Page 282
site.locateInSite() Availability Dreamweaver 3. Description Locates the specified file (or files) in the specified pane of the Site panel and selects the files. Arguments localOrRemote, siteOrURL argument must be either localOrRemote "local" "remote" argument must be the keyword , which indicates that the siteOrURL "site"...
Page 283
site.makeNewDreamweaverFile() Availability Dreamweaver 3. Description Creates a new Dreamweaver file in the Site panel in the same folder as the first selected file or folder. Arguments None. Returns Nothing. Enabler “site.canMakeNewFileOrFolder()” on page 592. site.makeNewFolder() Availability Dreamweaver 3. Description Creates a new folder in the Site panel in the same folder as the first selected file or folder. Arguments None.
Page 284
site.newHomePage() Availability Dreamweaver 3. Description Opens the New Home Page dialog box to let the user create a new home page. This function operates only on files in the Site Map view. Arguments None. Returns Nothing. site.newSite() Availability Dreamweaver 3. Description Opens the Site Definition dialog box for a new, unnamed site.
Page 285
Arguments None. Returns Nothing. Enabler “site.canOpen()” on page 592. site.put() Availability Dreamweaver 3. Description Puts the selected files and handles dependent files in one of the following ways: If the user selects Prompt on Put/Check In in the Site FTP preferences, the Dependent Files dialog box appears.
Page 286
site.recreateCache() Availability Dreamweaver 3. Description Re-creates the cache for the current site. Arguments None. Returns Nothing. Enabler “site.canRecreateCache()” on page 593. site.refresh() Availability Dreamweaver 3. Description Refreshes the file listing on the specified side of the Site panel. Arguments whichSide argument must be , or .
Page 287
site.remoteIsValid() Availability Dreamweaver 3. Description Determines whether the remote site is valid. Arguments None. Returns A Boolean value that indicates whether a remote site has been defined and, if the server type is Local/Network, whether the drive is mounted. site.removeLink() Availability Dreamweaver 3.
Page 288
Arguments None. Returns Nothing. site.runValidation() Availability Dreamweaver MX. Description Runs the Validator on the entire site or only highlighted items. Arguments selection argument is the parameter that specifies that the Validator should check selection only the highlighted items; otherwise, the Validator checks the entire current site. Returns Nothing.
Page 289
site.selectAll() Availability Dreamweaver 3. Description Selects all files in the active view (either the site map or the site files). Arguments None. Returns Nothing. site.selectHomePage() Availability Dreamweaver 3. Description Opens the Open File dialog box to let the user select a new home page. This function operates only on files in the Site Map view.
Page 290
Arguments whichSide argument must be either whichSide "local" "remote" Returns Nothing. Enabler “site.canSelectNewer()” on page 595. site.serverActivity() Availability Dreamweaver 8. Description This function determines whether Dreamweaver is currently interacting with a server. Because Dreamweaver cannot do more than one server activity at a time, this function lets you determine whether to disable functionality that requires server interaction.
Page 291
site.setAsHomePage() Availability Dreamweaver 3. Description Designates the file that is selected in the Site Files view as the home page for the site. Arguments None. Returns Nothing. site.setCloakingEnabled() Availability Dreamweaver MX. Description Determines whether cloaking should be enabled for the current site. Arguments enable argument is a Boolean value that indicates whether cloaking should be...
Page 292
Arguments bConnected argument is a Boolean value that indicates if there is a connection bConnected ) or not ( ) to the current site. true false Returns Nothing. site.setCurrentSite() Availability Dreamweaver 3. Description Opens the specified site in the local pane of the Site panel. Arguments whichSite argument is the name of a defined site (as it appears in the Current Sites...
Page 293
argument must be one of the following strings: , or whichPane "local" "remote" "site map" Returns Nothing. site.setLayout() Availability Dreamweaver 3. Description Opens the Site Map Layout pane in the Site Definition dialog box. Arguments None. Returns Nothing. Enabler “site.canSetLayout()” on page 595.
Page 294
site.setSelection() Availability Dreamweaver 3. Description Selects files or folders in the active pane in the Site panel. Arguments arrayOfURLs argument is an array of strings where each string is a path to a file or arrayOfURLs folder in the current site, which is expressed as a file:// URL. Omit the trailing slash (/) when specifying folder paths.
Page 295
site.synchronize() Availability Dreamweaver 3. Description Opens the Synchronize Files dialog box. Arguments None. Returns Nothing. Enabler “site.canSynchronize()” on page 596. site.uncloak() Availability Dreamweaver MX. Description Uncloaks the current selection in the Site panel or the specified folder. Arguments siteOrURL argument must contain one of the following values: siteOrURL The keyword , which indicates that the...
Page 296
site.uncloakAll() Availability Dreamweaver MX. Description Uncloaks all folders in the current site and deselects the Cloak Files Ending With: checkbox in the Cloaking settings. Arguments Nothing. Returns Nothing. Enabler “site.canUncloak()” on page 597. site.undoCheckOut() Availability Dreamweaver 3. Description Removes the lock files that are associated with the specified files from the local and remote sites, and replaces the local copy of the specified files with the remote copy.
Page 297
site.viewAsRoot() Availability Dreamweaver 3. Description Temporarily moves the selected file to the top position in the site map. Arguments None. Returns Nothing. Enabler “site.canViewAsRoot()” on page 598. Site functions...
CHAPTER 13 Document The Document functions in Macromedia Dreamweaver 8 perform operations that affect the document on which the user is working. These functions perform tasks that convert tables to layers, run a command in the Configuration/Commands folder, browse for a file URL, check spelling or set page properties, convert a relative URL to an absolute URL, get the currently selected node, perform URL encoding on a string, or run a translator on the document.
dom.convertTablesToLayers() Availability Dreamweaver 3. Description Opens the Convert Tables to Layers dialog box. Arguments None. Returns Nothing. Enabler “dom.canConvertTablesToLayers()” on page 554. Command functions Command functions help you make the most of the files in the Configuration/Commands folder. They manage the Command menu and call commands from other types of extension files.
Page 301
dreamweaver.popupCommand() (deprecated) Availability Dreamweaver 2; deprecated in 3 in favor of dreamweaver.runCommand(). Description This function executes the specified command. To the user, the effect is the same as selecting the command from a menu; if a dialog box is associated with the command, it appears. This function provides the ability to call a command from another extension file.
The remaining arguments, , and so on, which are optional, commandArg1, commandArg2 pass to the function in the argument. receiveArguments() commandFile Returns Nothing. Example You can write a custom Property inspector for tables that lets users get to the Format Table command from a button on the inspector by calling the following function from the button’s event handler: onClick...
Page 303
Returns An array of six integers that quantify the number of the following elements: XHTML errors that Dreamweaver fixed elements that do not have an attribute and cannot be fixed elements that do not have a attribute and cannot be fixed script type elements that do not have a...
Page 304
Returns An array of six integers that quantify the following items: XHTML errors that Dreamweaver fixed elements that do not have an attribute and cannot be fixed elements that do not have a attribute and cannot be fixed script type elements that do not have a attribute and cannot be fixed style...
Page 305
dreamweaver.browseForFileURL() Availability Dreamweaver 1, enhanced in 2, 3, and 4. Description Opens the specified type of dialog box with the specified label in the title bar. Arguments openSelectOrSave, {titleBarLabel}, {bShowPreviewPane}, ¬ {bSupressSiteRootWarnings}, {arrayOfExtensions} argument is a string that indicates the type of dialog box as openSelectOrSave "...
Page 306
dreamweaver.browseForFolderURL() Availability Dreamweaver 3. Description Opens the Choose Folder dialog box with the specified label in the title bar. Arguments {titleBarLabel}, {directoryToStartIn} argument is the label that should appear in the title bar of the dialog titleBarLabel box. If it is omitted, the argument defaults to Choose Folder.
Page 307
dreamweaver.createDocument() Availability Dreamweaver 2, enhanced in Dreamweaver 4. Description Depending on the argument that you pass to this function, it opens a new document either in the same window or in a new window. The new document becomes the active document. This function can be called only from the menus.xml file, a command, or the Property inspector file.
Page 308
dreamweaver.createXHTMLDocument() Availability Dreamweaver MX. Description Depending on the argument that you pass to this function, it opens a new XHTML document either in the same window or in a new window. The new document becomes the active document. It is similar to the function.
Page 309
Returns The document object for the newly created document, which is the same value that the function returns. dreamweaver.getDocumentDOM() dreamweaver.createXMLDocument() Availability Dreamweaver MX. Description Creates and opens a new XML file, which is empty except for the XML directive. Arguments None.
Page 310
dreamweaver.exportEditableRegionsAsXML() (deprecated) Availability Dreamweaver 3; deprecated in MX. Description This function opens the Export Editable Regions as XML dialog box. Arguments None. Returns Nothing. dreamweaver.exportTemplateDataAsXML() Availability Dreamweaver MX. Description Exports the current document to the specified file as XML. This function operates on the document that has focus, which must be a template.
Page 311
Example if(dreamweaver.canExportTemplateDataAsXML()) dreamweaver.exportTemplateDataAsXML("file:///c|/dw_temps/ mytemplate.txt") dreamweaver.getDocumentDOM() Availability Dreamweaver 2. Description Provides access to the objects tree for the specified document. After the tree of objects returns to the caller, the caller can edit the tree to change the contents of the document. Arguments {sourceDoc} argument must be...
Page 312
Examples The following example uses the function to access the dreamweaver.getDocumentDOM() current document: var theDOM = dreamweaver.getDocumentDOM("document"); In the following example, the current document DOM identifies a selection and pastes it at the end of another document: var currentDOM = dreamweaver.getDocumentDOM('document'); currentDOM.setSelection(100,200);...
Page 313
dreamweaver.getRecentFileList() Availability Dreamweaver 3. Description Gets a list of all the files in the recent files list at the bottom of the File menu. Arguments None. Returns An array of strings that represent the paths of the most recently accessed files. Each path is expressed as a file:// URL.
Page 314
dreamweaver.newDocument() Availability Dreamweaver MX. Description Opens a document in the current site and invokes the New Document dialog box. Arguments {bopenWithCurSiteAndShowDialog} argument, which is optional, has a value of bopenWithCurSiteAndShowDialog true . Specify to open a document with the current site and to cause the New false true Document dialog box to appear;...
Page 315
dreamweaver.openDocument() Availability Dreamweaver 2. Description Opens a document for editing in a new Dreamweaver window and gives it the focus. For a user, the effect is the same as selecting File > Open and selecting a file. If the specified file is already open, the window that contains the document comes to the front.
Page 316
Arguments fileName argument is the file to open, which is expressed as a URL. If the URL is fileName relative, it is relative to the file that contains the script that called this function. Returns The document object for the specified file, which is the same value that the function returns.
Page 317
Documents that are referenced by the dreamweaver.getObjectTags() , or dreamweaver.getObjectRefs() dreamweaver.getDocumentPath() functions are automatically released when the script that dreamweaver.getDocumentDOM() contains the call finishes executing. If the script opens many documents, you must use this function to explicitly release documents before finishing the script to avoid running out of memory.
Page 318
dreamweaver.saveAll() Availability Dreamweaver 3. Description Saves all open documents, opening the Save As dialog box for any documents that have not been saved previously. Arguments None. Returns Nothing. Enabler “dreamweaver.canSaveAll()” on page 570. dreamweaver.saveDocument() Availability Dreamweaver 2. Description Saves the specified file on a local computer. In Dreamweaver 2, if the file is read-only, Dreamweaver tries to check it out.
Page 319
Returns A Boolean value that indicates success ( ) or failure ( true false Enabler “dreamweaver.canSaveDocument()” on page 571. dreamweaver.saveDocumentAs() Availability Dreamweaver 3. Description Opens the Save As dialog box. Arguments documentObject argument is the object at the root of a document’s DOM tree, documentObject which is the value that the function returns.
Page 320
Enabler “dreamweaver.canSaveDocumentAsTemplate()” on page 571. dreamweaver.saveFrameset() Availability Dreamweaver 3. Description Saves the specified frameset or opens the Save As dialog box if the frameset has not previously been saved. Arguments documentObject argument is the object at the root of a document’s DOM tree, documentObject which is the value that the function returns.
Enabler “dreamweaver.canSaveFramesetAs()” on page 572. Global document functions Global document functions act on an entire document. They check spelling, check target browsers, set page properties, and determine correct object references for elements in the document. dom.checkSpelling() Availability Dreamweaver 3. Description Checks the spelling in the document, opening the Check Spelling dialog box if necessary, and notifies the user when the check is complete.
Page 322
dom.getParseMode() Availability Dreamweaver MX 2004 Description Gets the current parsing mode of the document, which controls how the document is validated and whether it shows up in the main document window as HTML. Arguments None. Returns A string that specifies the current parsing mode: , or "html"...
Page 323
Description Runs the Validator on a single specified document (this function is similar to site.runValidation()). The Validator checks the document for conformance with the language specified in the document doctype (such as HTML 4.0 or HTML 3.2) and the language specified by the server model (such as ColdFusion or ASP).
Page 324
Example The following example runs a regular validation when the user selects the File > Check Page > Validate Markup menu option (or Validate Current Document in the Validation panel): dw.getDocumentDOM().runValidation(''); The following example prompts the user to save an unsaved document, runs an automatic validation, does not open the Validation results window, but does show the total number of errors over the document toolbar button for DW_ValidatorErrors:...
Page 325
Example The following example displays two tooltip messages. The first line of code displays the message in the center of the document. The second call "This message is in the center" displays the tooltip message showInfoMessagePopup() "Don’t forget the title for for the Title text edit box, which has the ID , on the toolbar with the Window"...
Page 326
Arguments inStr argument is the string to decode. inStr Returns A string that contains the decoded URL. Example The following example calls to decode the special characters in its dw.doURLDecoding() argument and store the resulting string in outstr outStr = dreamweaver.doURLDecoding(“http://maps.yahoo.com/py/ ddResults.py?Pyt=Tmap&tarname=&tardesc=&newname=&newdesc=&newHash=&newTH ash=&newSts=&newTSts=&tlt=&tln=&slt=&sln=&newFL=Use+Address+Below&newadd r=2000+Shamrock+Rd&newcsz=Metroo+Park%2C+CA&newcountry=us&newTFL=Use+Add...
Page 327
Dreamweaver returns correct references for Netscape Navigator for AREA APPLET , and tags, and for EMBED LAYER ILAYER SELECT OPTION TEXTAREA OBJECT absolutely positioned tags. For tags that are not absolutely SPAN SPAN positioned, Dreamweaver returns "cannot reference <tag>" Dreamweaver does not return references for unnamed objects. If an object does not contain either a or an attribute, Dreamweaver returns...
Page 328
Returns An array of strings where each array is a valid JavaScript reference to a named instance of the requested tag type in the specified document (for example, ) for the specified browser: "document.myLayer.document.myImage" Dreamweaver returns correct references for Internet Explorer for AREA APPLET EMBED...
Page 329
Arguments sourceDoc, {tag1}, {tag2},...{tagN} argument must be sourceDoc "document" "parent" "parent.frames[number]" , or a URL. The value specifies the "parent.frames['frameName']" document document that has the focus and contains the current selection. The value parent specifies the parent frameset (if the currently selected document is in a frame), and specify a document that parent.frames[number] parent.frames['frameName']...
Page 330
Arguments section, key, default_value argument is a string that specifies the preferences section that contains the section entry. argument is a string that specifies the entry of the value to retrieve. argument is the default value that Dreamweaver returns if it cannot default_value find the entry.
Page 331
Returns The requested preference string, or if the string cannot be found, the default value. Example The following example returns the String value of the Text Editor setting in the My Extension section of Preferences. If there is no MyExtension section or no Text Editor entry, the function returns the default value specified by the variable txtEditor var txtEditor = getExternalTextEditor();...
Page 332
dreamweaver.setPreferenceString() Availability Dreamweaver MX. To access the preferences for sites, you must have version 7.0.1. Check dw.appVersion for the correct version before accessing site information. Description Lets you write a string preference setting for an extension. This setting is stored with Dreamweaver preferences when Dreamweaver is not running.
Returns Nothing. Path functions Path functions get and manipulate the paths to various files and folders on a user’s hard disk. These functions determine the path to the root of the site in which the current document resides, convert relative paths to absolute URLs, and more. dreamweaver.getConfigurationPath() Availability Dreamweaver 2.
Page 334
dreamweaver.getDocumentPath() Availability Dreamweaver 1.2. Description Gets the path of the specified document, which is expressed as a file:// URL. This function is equivalent to calling and reading the property of the dreamweaver.getDocumentDOM() return value. Arguments sourceDoc The value of the argument must be sourceDoc "document"...
Page 335
dreamweaver.getTempFolderPath() Availability Dreamweaver MX. Description Gets the full path to a temporary folder where you can store temporary or transient files. This function looks for a Temp folder inside the Dreamweaver Configuration folder. If the system supports multiple users, it looks in the user’s Configuration folder. If a Temp folder does not exist, the function creates it.
argument is the path to the site root, which is expressed as a file:// URL or siteRoot an empty string if is a document-relative URL. relURL argument is the URL to convert. relURL Returns An absolute URL string. The return value is generated, as described in the following list: is an absolute URL, no conversion occurs, and the return value is the same relURL relURL...
Page 337
dom.getSelection() Availability Dreamweaver 3. Description Gets the selection, which is expressed as character offsets into the document’s source code. Arguments {bAllowMultiple} argument, which is optional, is a Boolean value that indicates bAllowMultiple whether the function should return multiple offsets if more than one table cell, image map hotspot, or layer is selected.
Page 338
Arguments node argument must be a tag, comment, or range of text that is a node in the tree that node function returns. dreamweaver.getDocumentDOM() Returns An array that contains two integers. The first integer is the character offset of the beginning of the tag, text, or comment.
Page 339
offsets[1]); if (theSelection.nodeType == Node.ELEMENT_NODE && ¬ theSelection.tagName == 'IMG'){ alert('The current selection is an image.'); dom.selectAll() Availability Dreamweaver 3. Description Performs a Select All operation. In most cases, this function selects all the content in the active document. In some cases (for example, when the insertion point is inside a table), it selects only part of the active document.
Page 340
argument, which is optional, is a Boolean value that indicates whether bJumpToNode to scroll the Document window, if necessary, to make the selection visible. If it is omitted, this argument defaults to false Returns Nothing. dom.setSelection() Availability Dreamweaver 3. Description Sets the selection in the document.
Page 341
Returns An array that contains two integers. The first integer is the byte offset for the beginning of the selection; the second integer is the byte offset for the end of the selection. If the two numbers are the same, the current selection is an insertion point. dreamweaver.nodeExists() Available Dreamweaver 3.
Page 342
else selArr = dom.nodeToOffsets(findTable()); dom.setSelection(selArr[0],selArr[1]); dreamweaver.nodeToOffsets() (deprecated) Availability Dreamweaver 2; deprecated in 3 in favor of “dom.nodeToOffsets()” on page 337 Description Gets the position of a specific node in the DOM tree, which is expressed as byte offsets into the document’s source code. Arguments node argument must be a tag, comment, or range of text that is a node in the tree...
Page 343
dreamweaver.selectAll() Availability Dreamweaver 3. Description Performs a Select All operation in the active document window, the Site panel or, on the Macintosh, the text field that has focus in a dialog box or floating panel. If the operation takes place in the active document, it usually selects all the content in the active document.
Returns Nothing. String manipulation functions String manipulation functions help you get information about a string as well as convert a string from Latin 1 encoding to platform-native encoding and back. dreamweaver.doURLEncoding() Availability Dreamweaver 1. Description Takes a string and returns a URL-encoded string by replacing all the spaces and special characters with specified entities.
Page 345
Arguments searchString, separatorCharacters argument is the string to separate into tokens. searchString argument is the character or characters that signifies the end separatorCharacters of a token. Separator characters in quoted strings are ignored. Any white-space characters that occur in (such as tabs) are treated as separator characters, as if separatorCharacters they are explicitly specified.
Page 346
dreamweaver.nativeToLatin1() Availability Dreamweaver 2. Description Converts a string in native encoding to Latin 1 encoding. This function has no effect in Windows because Windows encodings are already based on Latin 1. Arguments stringToConvert argument is the string to convert from native encoding to Latin 1 stringToConvert encoding.
Page 347
Dreamweaver calls the seven callback functions on the following occasions: Dreamweaver calls for each opening tag (for example, , as openTagBegin() <font> opposed to ) and each empty tag (for example, ). The </font> <img> <hr> function accepts two arguments: the name of the tag (for example, openTagBegin() ) and the document offset, which is the number of bytes in the document "font"...
Page 348
Arguments HTMLstr, parserCallbackObj argument is a string that contains code. HTMLstr argument is a JavaScript object that has one or more of the parserCallbackObj following methods: openTagBegin() openTagEnd() closeTagBegin() , and . For best performance, closeTagEnd() directive() attribute() text() should be a shared library that is defined using the C-Level parserCallbackObj Extensibility interface.
Translation functions Translation functions deal either directly with translators or with translation results. These functions get information about or run a translator, edit content in a locked region, and specify that the translated source should be used when getting and setting selection offsets. dom.runTranslator() Availability Dreamweaver 3.
Page 350
Arguments bAllowEdits argument is a Boolean value: indicates that edits are allowed; bAllowEdits true otherwise. Dreamweaver automatically restores locked regions to their default false (non-editable) state when the script that calls this function finishes executing. Returns Nothing. dreamweaver.getTranslatorList() Availability Dreamweaver 3. Description This function gets a list of the installed translators.
Arguments bUseTranslatedSource argument is a Boolean value: if the function uses bUseTranslatedSource true offsets into the translated source; if the function uses the untranslated source. false The default value of the argument is . Dreamweaver automatically uses the false untranslated source for subsequent calls to dw.getSelection() dw.setSelection() , and...
Page 352
Example The following example gets the schema tree from the XML schema cache for menus.xml: ¬ var theSchema = MMXSLT.getXMLSchema("file:///c:/Program Files/Macromedia/dreamweaver/configuration/Menus/menus.xml""); MMXSLT.getXMLSourceURI() Availability Dreamweaver 8. Description This function gets a reference to the XML source document associated with the current XSLT document.
Page 353
MMXSLT.launchXMLSourceDialog() Availability Dreamweaver 8. Description This function prompts the user to specify the XML source document that is associated with the current XSLT document. The user can choose either a local or remote reference to an XML document. Arguments {xsltfileURI, bUseTempForRemote, bAddSchemaReference} argument is optional.
Assets panel functions Assets panel functions, which are programmed into the API as an asset panel, let you manage and use the elements in the Assets panel (templates, libraries, images, Macromedia Shockwave and Macromedia Flash content, URLs, colors, and scripts).
Page 356
dreamweaver.assetPalette.addToFavoritesFromSite Assets() Availability Dreamweaver 4. Description Adds elements that are selected in the Site list to the Favorites list and gives each item a nickname in the Favorites list. This function does not remove the element from the Site list. Arguments None.
Page 357
dreamweaver.assetPalette.copyToSite() Availability Dreamweaver 4. Description Copies selected elements to another site and puts them in that site’s Favorites list. If the elements are files (other than colors or URLs), the actual file is copied into that site. Arguments targetSite argument is the name of the target site, which the targetSite site.getSites() call returns.
Page 358
dreamweaver.assetPalette.getSelectedCategory() Availability Dreamweaver 4. Description Returns the currently selected category. Arguments None. Returns The currently selected category, which can be one of the following: "templates" , or "library" "images" "movies" "shockwave" "flash" "scripts" "colors" "urls" dreamweaver.assetPalette.getSelectedItems() Availability Dreamweaver 4. Description Returns an array of the selected items in the Assets panel, either in the Site or Favorites list.
Page 359
Example If URLs is the category, and a folder MyFolderName and a URL MyFavoriteURL are both selected in the Favorites list, the function returns the following list: items[0] = "MyFolderName" items[1] = "//path/FolderName" items[2] = "folder" items[3] = "MyFavoriteURL" items[4] = "http://www.MyFavoriteURL.com" items[5] = "urls"...
Page 360
Enabler “dreamweaver.assetPalette.canInsertOrApply()” on page 564. dreamweaver.assetPalette.locateInSite() Availability Dreamweaver 4. Description Selects files that are associated with the selected elements in the local side of the Site panel. This function does not work for colors or URLs. It is available in the Site list and the Favorites list.
Page 361
dreamweaver.assetPalette.newFolder() Availability Dreamweaver 4. Description Creates a new folder in the current category with the default name (untitled) and puts a text box around the default name. It is available only in the Favorites list. Arguments None. Returns Nothing. dreamweaver.assetPalette.recreateLibraryFromDoc ument() Availability Dreamweaver 4.
Page 362
Arguments None. Returns Nothing. dreamweaver.assetPalette.removeFromFavorites() Availability Dreamweaver 4. Description Removes the selected elements from the Favorites list. This function does not delete the actual file on disk, except in the case of a library or template where the user is prompted before the file is deleted.
Page 363
dreamweaver.assetPalette.setSelectedCategory() Availability Dreamweaver 4. Description Switches to show a different category. Arguments categoryType argument can be one of the following categories: categoryType "templates" , or "library" "images" "movies" "shockwave" "flash" "scripts" "colors" "urls" Returns Nothing. dreamweaver.assetPalette.setSelectedView() Availability Dreamweaver 4. Description Switches the display to show either the Site list or the Favorites list.
Page 364
Description This function removes the selected library item from the Library panel and deletes its associated Dreamweaver LBI file from the Library folder at the root of the current site. Instances of the deleted item might still exist in pages throughout the site. Arguments None.
Page 365
Arguments bReplaceCurrent argument is a Boolean value that indicates whether to replace the bReplaceCurrent selection with an instance of the newly created library item. Returns Nothing. dreamweaver.libraryPalette.recreateFromDocument() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver 4 in favor of dreamweaver.assetPalette.recreateLibraryFromDocument() Description This function creates an LBI file for the selected instance of a library item in the current document.
Page 366
Arguments None. Returns Nothing. dreamweaver.referencePalette.getFontSize() Availability Dreamweaver 4. Description Returns the current font size of the Reference panel display region. Arguments None. Returns The relative font size as , or small medium large dreamweaver.referencePalette.setFontSize() Availability Dreamweaver 4. Description Changes the font size that appears in the Reference panel. Arguments fontSize argument is one of the following relative sizes:...
Page 367
dreamweaver.templatePalette.deleteSelected Template() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver 4 in favor of using dreamweaver.assetPalette.setSelectedCategory() with as the argument value, "templates" and then calling dreamweaver.assetPalette.removeFromFavorites() Description This function deletes the selected template from the Templates folder. Arguments None. Returns Nothing. dreamweaver.templatePalette.getSelected Template() (deprecated) Availability...
dreamweaver.templatePalette.renameSelectedTemp late() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver 4 in favor of using dreamweaver.assetPalette.setSelectedCategory() with as the argument value, "templates" and then calling dreamweaver.assetPalette.renameNickname() Description This function turns the name of the selected template into a text field, so the user can rename the selection.
Page 369
argument is the function call that returns if the action is action applyBehavior() added using the Behaviors panel (for example, "MM_popupMsg('Hello World')") argument, which is optional, is the position at which this action eventBasedIndex should be added. The argument is a zero-based index; if two actions eventBasedIndex already are associated with the specified event, and you specify as 1,...
Page 370
Description Checks to make sure that the functions that are associated with any behavior calls on the specified node are in the section of the document and inserts them if they are missing. HEAD Arguments elementNode argument is an element node within the current document. If you omit elementNode the argument, Dreamweaver checks all element nodes in the document for orphaned behavior calls.
Page 371
Description Gets the DOM object that corresponds to the tag to which the behavior is being applied. This function is applicable only in Behavior action files. Arguments None. Returns A DOM object or a value. This function returns a value under the null null following circumstances:...
Page 372
dreamweaver.getBehaviorEvent() (deprecated) Availability Dreamweaver 1.2; deprecated in Dreamweaver 2 because actions are now selected before events. Description In a Behavior action file, this function gets the event that triggers this action. Arguments None. Returns A string that represents the event. This is the same string that is passed as an argument ) to the function.
Page 373
if (CANBEAPPLIED) { // display the action UI } else{ // display a helpful message that tells the user // that this action can only be applied to a // hyperlink dreamweaver.popupAction() Availability Dreamweaver 2. Description Invokes a Parameters dialog box for the specified behavior action. To the user, the effect is the same as selecting the action from the Actions pop-up menu in the Behaviors panel.
Page 374
dreamweaver.behaviorInspector.getBehaviorAt() Availability Dreamweaver 3. Description Gets the event/action pair at the specified position in the Behaviors panel. Arguments positionIndex argument is the position of the action in the Behaviors panel. The positionIndex first action in the list is at position 0. Returns An array of two items: An event handler...
Page 375
Returns An integer that represents the number of actions that are attached to the element. This number is equivalent to the number of actions that are visible in the Behaviors panel and includes Dreamweaver behavior actions and custom JavaScript. Example A call to for the selected link dreamweaver.behaviorInspector.getBehaviorCount()
Page 376
dreamweaver.behaviorInspector.moveBehaviorDown() Availability Dreamweaver 3. Description Moves a behavior action lower in sequence by changing its execution order within the scope of an event. Arguments positionIndex argument is the position of the action in the Behaviors panel. The positionIndex first action in the list is at position 0. Returns Nothing.
Page 377
dreamweaver.behaviorInspector.moveBehaviorUp() Availability Dreamweaver 3. Description Moves a behavior higher in sequence by changing its execution order within the scope of an event. Arguments positionIndex argument is the position of the action in the Behaviors panel. The positionIndex first action in the list is at position 0. Returns Nothing.
Page 378
dreamweaver.behaviorInspector.setSelectedBehavior() Availability Dreamweaver 3. Description Selects the action at the specified position in the Behaviors panel. Arguments positionIndex argument is the position of the action in the Behaviors panel. The positionIndex first action in the list is at position 0. To deselect all actions, specify a of –...
Clipboard functions Clipboard functions are related to cutting, copying, and pasting. On the Macintosh, some Clipboard functions can also apply to text fields in dialog boxes and floating panels. Functions that can operate in text fields are implemented as methods of the object and as dreamweaver methods of the DOM object.
Page 380
Enabler “dom.canClipCopyText()” on page 552. dom.clipCut() Availability Dreamweaver 3. Description Removes the selection, including any HTML markup that defines the selection, to the Clipboard. Arguments None. Returns Nothing. dom.clipPaste() Availability Dreamweaver 3. Description Pastes the contents of the Clipboard into the current document at the current insertion point or in place of the current selection.
Page 381
Example If the Clipboard contains , a call to ABC Widgets dw.getDocumentDOM().clipPaste() results in the following figure: dom.clipPasteText() (deprecated) Availability Dreamweaver 3. Deprecated in Dreamweaver 8. Use the function dom.clipPaste("text") instead. Description Pastes the contents of the Clipboard into the current document at the insertion point or in place of the current selection.
Page 382
Example If the Clipboard contains , a call to <code>return true;</code> results in the following figure: dw.getDocumentDOM().clipPasteText() dreamweaver.clipCopy() Availability Dreamweaver 3. Description Copies the current selection from the active Document window, dialog box, floating panel, or Site panel to the Clipboard. Arguments None.
Page 383
dreamweaver.clipCut() Availability Dreamweaver 3. Description Removes the selection from the active Document window, dialog box, floating panel, or Site panel to the Clipboard. Arguments None. Returns Nothing. Enabler “dreamweaver.canClipCut()” on page 565. dreamweaver.clipPaste() Availability Dreamweaver 3. Added the argument in Dreamweaver 8. strPasteOption Description Pastes the contents of the Clipboard into the current document, dialog box, floating panel, or...
Example The following example pasts the contents of the Clipboard as text: dw.clipPaste("text"); dreamweaver.getClipboardText() Availability Dreamweaver 3. Description Gets all the text that is stored on the Clipboard. Arguments {bAsText} Boolean value, which is optional, specifies whether the Clipboard content is bAsText retrieved as text.
Page 385
dom.applyTemplate() Availability Dreamweaver 3. Description Applies a template to the current document. If no argument is supplied, the Select Template dialog box appears. This function is valid only for the document that has focus. Arguments {templateURL}, bMaintainLink argument is the path to a template in the current site, which is templateURL expressed as a file:// URL.
Page 386
dom.detachFromTemplate() Availability Dreamweaver 3. Description Detaches the current document from its associated template. Arguments None. Returns Nothing. dom.getAttachedTemplate() Availability Dreamweaver 3. Description Gets the path of the template that is associated with the document. Arguments None. Returns A string that contains the path of the template, which is expressed as a file:// URL. dom.getEditableRegionList() Availability Dreamweaver 3.
Page 387
Returns An array of element nodes. Example “dom.getSelectedEditableRegion()” on page 387. dom.getIsLibraryDocument() Availability Dreamweaver 3. Description Determines whether the document is a library item. Arguments None. Returns A Boolean value that indicates whether the document is an LBI file. dom.getIsTemplateDocument() Availability Dreamweaver 3.
Page 388
Description If the selection or insertion point is inside an editable region, this function gets the position of the editable region among all others in the body of the document. Arguments None. Returns An index into the array that the function returns.
Page 389
dom.markSelectionAsEditable() Availability Dreamweaver 3. Description Displays the New Editable Region dialog box. When the user clicks New Region, Dreamweaver marks the selection as editable and doesn’t change any text. Arguments None. Returns Nothing. Enabler “dom.canMarkSelectionAsEditable()” on page 559. dom.newEditableRegion() Availability Dreamweaver 3.
Page 390
dom.removeEditableRegion() Availability Dreamweaver 3. Description Removes an editable region from the document. If the editable region contains any content, the content is preserved; only the editable region markers are removed. Arguments None. Returns Nothing. Enabler “dom.canRemoveEditableRegion()” on page 560. dom.updateCurrentPage() Availability Dreamweaver 3.
dreamweaver.updatePages() Availability Dreamweaver 3. Description Opens the Update Pages dialog box and selects the specified options. Arguments {typeOfUpdate} The optional argument must be , or , if typeOfUpdate "library" "template" "both" you specify it. If the argument is omitted, it defaults to "both"...
Page 392
The following sample shows a snippet file: <snippet name="Detect Flash" description="VBscript to check for Flash ActiveX control" preview="code" factory="true" type="wrap" > <insertText location="beforeSelection"> <![CDATA[ ------- code --------- ]]> </insertText> <insertText location="afterSelection"> <![CDATA[ ------- code --------- ]]> </insertText> </snippet> Snippet tags in CSN files have the following attributes: Attribute Description Name of snippet...
Page 393
dreamweaver.snippetPalette.newFolder() Availability Dreamweaver MX. Description Creates a new folder with the default name and puts an text box around the default untitled name. Arguments None. Returns Nothing. dreamweaver.snippetPalette.newSnippet() Availability Dreamweaver MX. Description Opens the Add Snippet dialog box and gives it focus. Arguments None.
Page 394
Returns Nothing. Enabler “dreamweaver.snippetpalette.canEditSnippet()” on page 585. dreamweaver.snippetPalette.insert() Availability Dreamweaver MX. Description Applies the selected snippet from the Snippets panel to the current selection. Arguments None. Returns Nothing. Enabler “dreamweaver.snippetpalette.canInsert()” on page 585. dreamweaver.snippetPalette.insertSnippet() Availability Dreamweaver MX. Description Inserts the indicated snippet into the current selection. Arguments A string that specifies the path to the snippet relative to the Snippets folder.
Page 395
Example The following call to the function inserts the code dw.snippetPalette.insertSnippet() snippet at the location specified by the argument into the current document at the insertion point: dw.snippetPalette.insertSnippet('Text\\Different_Link_Color.csn'); dreamweaver.snippetPalette.rename() Availability Dreamweaver MX. Description Activates a text box around the selected folder name or file nickname and lets you edit the selected element.
CHAPTER 15 Dynamic Documents The dynamic documents functions in Macromedia Dreamweaver 8 perform operations that are related to web server pages. These operations include returning a property for the selected node in the Components panel, getting a list of all data sources in the user’s document, displaying dynamic content in Design view, applying a server behavior to a document, or getting the names of all currently defined server models.
dreamweaver.serverComponents.refresh() Availability Dreamweaver MX. Description Refreshes the view of the Components tree. Arguments None. Returns Nothing. Data source functions Data source files are stored in the Configuration/DataSources folder. Each server model has its own folder: ASP.Net/C#, ASP.Net/VisualBasic, ASP/JavaScript, ASP/VBScript, ColdFusion, JSP, and PHP/MySQL. Each server model subfolder contains HTML and EDML files that are associated with the data sources for that server model.
Returns An array that contains a concatenated list of all the data sources in the user’s document. Each element in the array is an object, and each object has the following properties: property is the label string that appears to the right of the icon for each parent title node.
Page 400
dreamweaver.getExtDataValue() Availability Dreamweaver UltraDev 4. Description This function retrieves the field values from an EDML file for the specified nodes. Arguments qualifier(s) argument is a variable-length list (depending on the level of qualifier(s) information you need) of comma-separated node qualifiers that includes group or participant name, subblock (if any), and field name.
Page 401
dreamweaver.getExtParticipants() Availability Dreamweaver UltraDev 4. Description This function retrieves the list of participants from an EDML group file or participant files. Arguments value, qualifier(s) argument is a property value, or it is blank and is ignored. For example value dreamweaver.getExtParticipants("", "participant"); argument is a variable-length list of comma-separated node qualifiers qualifier(s) of the required property.
dreamweaver.refreshExtData() Availability Dreamweaver UltraDev 4. Description Reloads all extension data files. You can make a useful command from this function, letting edits to server-behavior EDML files be reloaded without restarting Dreamweaver. Arguments None. Returns Dreamweaver expects reloaded data. Live data functions You can use the following live data functions to mimic menu functionality: function is used for the View >...
Page 403
dreamweaver.getLiveDataInitTags() Availability Dreamweaver UltraDev 1. Description Returns the initialization tags for the currently active document. The initialization tags are the HTML tags that the user supplies in the Live Data Settings dialog box. This function is typically called from a translator’s function, so that the liveDataTranslateMarkup() translator can pass the tags to the...
Page 404
Live Data mode lets you view a web page in the design stage (as if it has been translated by the application server and returned). Generating dynamic content to display in Design view lets you view your page layout with live data and adjust it, if necessary. Before you view live data, you must enter Live Data settings for any URL parameters that you reference in your document.
Page 405
dreamweaver.liveDataTranslate() Availability Dreamweaver UltraDev 1. Description Sends an entire HTML document to an application server, asks the server to execute the scripts in the document, and returns the resulting HTML document. This function can be called only from a translator’s function;...
Page 406
dreamweaver.setLiveDataError() Availability Dreamweaver UltraDev 1. Description Specifies the error message that appears if an error occurs while the function executes in a translator. If the document that liveDataTranslateMarkup() Dreamweaver passed to contains errors, the server passes back an liveDataTranslate() error message that is formatted using HTML. If the translator (the code that called ) determines that the server returned an error message, it calls liveDataTranslate() to display the error message in Dreamweaver.
Page 407
Returns Nothing. dreamweaver.setLiveDataParameters() Availability Dreamweaver MX. Description Sets the URL parameters that you reference in your document for use in Live Data mode. Live Data mode lets you view a web page in the design stage (as if it has been translated by the application server and returned).
Description Displays the Live Data Settings dialog box. Arguments None. Returns Nothing. Server behavior functions Server behavior functions let you manipulate the Server Behaviors panel, which you can display by selecting Window > Server Behaviors. Using these functions, you can find all the server behaviors on a page and programmatically apply a new behavior to the document or modify an existing behavior.
Page 409
Returns This function returns an array that contains all instances of the specified participant (or, in the case of a group file, any instance of any participant in the group) that appear in the user’s document. The array contains JavaScript objects, with one element in the array for each instance of each participant that is found in the user’s document.
Returns Nothing. Server model functions In Macromedia Dreamweaver, each document has an associated document type. For dynamic document types, Dreamweaver also associates a server model (such as ASP-JS, ColdFusion, or PHP-MySQL). Server models are used to group functionality that is specific to a server technology. Different server behaviors, data sources, and so forth, appear based on the server model that is associated with the document.
Page 411
dom.serverModel.getAppURLPrefix() Availability Dreamweaver MX. Description Returns the URL for the site’s root folder on the testing server. This URL is the same as that specified for the Testing Server on the Advanced tab in the Site Definition dialog box. When Dreamweaver communicates with your testing server, it uses HTTP (the same way as a browser).
Page 412
Returns An array of objects where each object contains the following three properties: property is a regular expression that matches the opening script startPattern delimiter. property is a regular expression that matches the closing script delimiter. endPattern pattern is a Boolean value that specifies whether the content participateInMerge that is enclosed in the listed delimiters should ( ) or should not (...
Page 413
dom.serverModel.getServerExtension() (deprecated) Availability Dreamweaver UltraDev 4; deprecated in Dreamweaver MX. Description Returns the default file extension of files that use the current server model. (The default file extension is the first in the list.) If no user document is currently selected, the serverModel object is set to the server model of the currently selected site.
Page 414
Property Description The 1-based index of the regular expression submatch that fileRef corresponds to the included file reference. The portion of the value that remains after removing the type paramName _includeUrl suffix. This type is assigned to the type attribute of the tag.
Page 415
You can modify the information in the HTML definition file or place additional variable values or functions in the file. For example, you can modify the serverName , and properties. The serverLanguage serverVersion function returns the information that the server model dom.serverModel.getServerInfo() author adds to the definition file.
Page 416
Arguments None. Returns A string that contains the supported scripting languages. dom.serverModel.getServerName() Availability Dreamweaver 1; enhanced in Dreamweaver MX. Description Retrieves the server name that is associated with the document and returns that value. The server name differentiates between server technologies (such as ASP.NET and JSP), but does not differentiate between languages on the same server technology (such as ASP.NET VB and ASP.NET C#).
Page 417
Description Determines whether the server model that is associated with the document supports the named character set. In addition to letting you call this function from the JavaScript layer, Dreamweaver calls this function when the user changes the encoding in the page Properties dialog box. If the server model does not support the new character encoding, this function returns false and Dreamweaver pops up a warning dialog box that asks if the user wants to do the conversion.
Page 418
Arguments name argument is a string that represents the name of a server model. name Returns A string that contains the version of the named server model. dom.serverModel.testAppServer() Availability Dreamweaver MX. Description Tests whether a connection to the application server can be made. Arguments None.
CHAPTER 16 Design The Design functions in Macromedia Dreamweaver 8 perform operations related to designing the appearance of a document. These operations include functions that apply a specified cascading style sheet (CSS) style, split a selected frame vertically or horizontally, align selected layers or hotspots, play a selected plug-in item, create a layout cell, or manipulate table rows or columns.
Page 420
Example The following example turns off rendering for Internet Explorer: if (cssStylePalette.getInternetExplorerRendering()){ cssStylePalette.setInternetExplorerRendering(false); cssStylePalette.setInternetExplorerRendering() Availability Dreamweaver 8. Description This function instructs Dreamweaver to render for Internet Explorer or the CSS specification. Arguments internetExplorerRendering argument, which is required, indicates whether to internetExplorerRendering render for Internet Explorer ( ) or to render for the CSS specification (...
Page 421
argument is the name of a CSS style. styleName argument, which is optional, is the attribute with which the style should classOrID be applied (either ). If the argument is a value or an "class" "id" elementNode null empty string and no tag exactly surrounds the selection, the style is applied using SPAN tags.
Page 422
, which indicates that the element is " by default, but is currently in "full" hidden" " view as set by the setElementView("full") function. full" , which indicates that the element is neither "normal" "hidden" "full" Example The following example changes the status of the selected element to if it is "full"...
Page 423
Arguments None. Returns A Boolean; if the Layout Block Box Model visual aid is on; otherwise. true false Example The following example checks whether the Layout Block Box Model visual aid is on and, if not, turns it on: var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowDivBoxModel() == false){ currentDOM.setShowDivBoxModel(true);...
Page 424
dom.removeCSSStyle() Availability Dreamweaver 3. Description Removes the attribute from the specified element, or removes the tag that CLASS SPAN completely surrounds the specified element. This function is valid only for the active document. Arguments elementNode, {classOrID} argument is an element node in the DOM. If the elementNode elementNode argument is specified as an empty string ("...
Page 425
Example The following example resets the Element view of all elements in the document without forcing a refresh of the rendering: var currentDOM = dw.getDocumentDOM(); currentDOM.resetAllElementViews(false); dom.setElementView() Availability Dreamweaver 8. Description This function sets the Element view for the currently selected element in the document. If the currently selected element is , the function looks for the first...
Page 426
dom.setShowDivBackgrounds() Availability Dreamweaver 8. Description This function turns the Layout Block Backgrounds visual aid on or off. Arguments show argument, which is required, is a Boolean value that specifies whether to turn show the Layout Block Backgrounds visual aid on. Setting turns the Layout Block show true...
Page 427
dom.setShowDivOutlines() Availability Dreamweaver 8. Description This function turns the Layout Block Outlines visual aid on or off. Arguments show argument, which is required, is a Boolean value that specifies whether to turn show the Layout Block Outlines visual aid on. Setting turns the Layout Block show true...
Page 428
dreamweaver.cssRuleTracker.newRule() Availability Dreamweaver MX 2004. Description Opens the New CSS Style dialog box, so the user can create a new rule. Arguments None. Returns Nothing. dreamweaver.cssStylePalette.applySelectedStyle() Availability Dreamweaver MX. Description Applies the selected style to the current active document or to its attached style sheet, depending on the selection in the Styles panel.
Page 429
dreamweaver.cssStylePalette.attachStyleSheet() Availability Dreamweaver 4. Description Displays a dialog box that lets users attach a style sheet to the current active document or to one of its attached style sheets, depending on the selection in the Styles panel. Arguments None. Returns Nothing.
Page 430
dreamweaver.cssStylePalette.duplicateSelectedStyle() Availability Dreamweaver 3. Description Duplicates the style that is currently selected in the Styles panel and displays the Duplicate Style dialog box to let the user assign a name or selector to the new style. Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles pane Panel to which this function applies.
Page 431
Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles pane Panel to which this function applies. Possible values are , which is the list of "stylelist" styles in “All” mode; , which is the list of applicable, relevant rules in “Current” "cascade"...
Page 432
dreamweaver.cssStylePalette.editStyleSheet() Availability Dreamweaver 3. Description Opens the Edit Style Sheet dialog box. Arguments None. Returns Nothing. Enabler “dreamweaver.cssStylePalette.canEditStyleSheet()” on page 578. dreamweaver.cssStylePalette.getDisplayStyles() Availability Dreamweaver 8. Description This function determines whether CSS styles are being rendered. The default value is true Arguments None.
Page 433
Description Gets target media type for rendering. The default media type is "screen". Arguments None. Returns A string value that specifies the target media type. Example var mediaType = dw.cssStylePalette.getMediaType(); dreamweaver.cssStylePalette.getSelectedStyle() Availability Dreamweaver 3; available in Dreamweaver MX. fullSelector Description Gets the name of the style that is currently selected in the Styles panel.
Page 434
dreamweaver.cssStylePalette.getSelectedTarget() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver MX because there is no longer an Apply To Menu in the Styles panel. Description This function gets the selected element in the Apply To pop-up menu at the top of the Styles panel.
Page 435
Arguments {bGetIDs, bGetFullSelector} argument is optional. It is a Boolean value that, if , causes the function bGetIDs true to return just ID selector names (the part after the "#"). Defaults to false argument is optional. It is a Boolean value that, if , returns bGetFullSelector true...
Page 436
dreamweaver.cssStylePalette.renameSelectedStyle() Availability Dreamweaver 3. Description Renames the class name that is used in the currently selected rule in the Styles panel and all instances of the class name in the selected rule. Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles pane Panel to which this function applies.
Page 437
Example The following example turns off rendering of CSS styles: dw.cssStylePalette.setDisplayStyles(false); dreamweaver.cssStylePalette.setMediaType() Availability Dreamweaver MX 2004. Description Sets the target media type for rendering. Refreshes the rendering of all open documents. Arguments mediaType argument specifies the new target media type. mediaType Returns Nothing.
Page 438
Example The following example checks the value of the margin and padding color; if either isn’t white, it sets them both to white: var boxColors = dreamweaver.getBlockVisBoxModelColors(); if ((boxColors[0] != "#FFFFFF") || (boxColors[1] != "#FFFFFF)){ currentDOM.setBlockVisBoxModelColors("#FFFFFF", "#FFFFFF"); dreamweaver.getBlockVisOutlineProperties() Availability Dreamweaver 8. Description This function gets the outline properties for the block visualization visual aids.
Page 439
dreamweaver.getDivBackgroundColors() Availability Dreamweaver 8. Description This function gets the colors used by the Layout Block Backgrounds visual aid. Arguments None. Returns An array of strings that contains the 16 colors, with each color represented by the hexadecimal value of the RGB color, in the form #RRGGBB. Example The following example gets the background colors used by the Layout Block Backgrounds visual aid:...
Page 440
argument, which is required, is an integer that indicates the outline width, in width pixels. argument, which is optional, is a string that indicates the style of the outline. style Possible values are , and . The value is "SOLID" "DOTTED"...
currentDOM.setDivBackgroundColors("divs", shadeOfGray[i]); Frame and frameset functions Frame and frameset functions handle two tasks: getting the names of the frames in a frameset and splitting a frame in two. dom.getFrameNames() Availability Dreamweaver 3. Description Gets a list of all the named frames in the frameset. Arguments None.
Page 442
Arguments None. Returns A Boolean value: if the document is in a frameset; otherwise. true false dom.saveAllFrames() Availability Dreamweaver 4. Description If a document is a frameset or is inside a frameset, this function saves all the frames and framesets from the Document window. If the specified document is not in a frameset, this function saves the document.
Enabler “dom.canSplitFrame()” on page 562. Layer and image map functions Layer and image map functions handle aligning, resizing, and moving layers and image map hotspots. The function description indicates if it applies to layers or to hotspots. dom.align() Availability Dreamweaver 3. Description Aligns the selected layers or hotspots left, right, top, or bottom.
Page 444
Returns Nothing. Enabler “dom.canArrange()” on page 552. dom.makeSizesEqual() Availability Dreamweaver 3. Description Makes the selected layers or hotspots equal in height, width, or both. The last layer or hotspot selected is the guide. Arguments bHoriz, bVert argument is a Boolean value that indicates whether to resize the layers or bHoriz hotspots horizontally.
Page 445
Returns Nothing. dom.resizeSelectionBy() Availability Dreamweaver 3. Description Resizes the currently selected layer or hotspot. Arguments left, top, bottom, right argument is the new position of the left boundary of the layer or hotspot. left argument is the new position of the top boundary of the layer or hotspot. argument is the new position of the bottom boundary of the layer or hotspot.
Arguments tagName argument must be , or tagName "layer" "ilayer" "div" "span" Returns Nothing. Layout environment functions Layout environment functions handle operations that are related to the settings for working on a document. They affect the source, position, and opacity of the tracing image; get and set the ruler origin and units;...
Page 447
Returns A string that contains one of the following values: "in" "cm" "px" dom.getTracingImageOpacity() Availability Dreamweaver 3. Description Gets the opacity setting for the document’s tracing image. Arguments None. Returns A value between 0 and 100, or nothing if no opacity is set. Enabler “dom.hasTracingImage()”...
Page 448
dom.playAllPlugins() Availability Dreamweaver 3. Description Plays all plug-in content in the document. Arguments None. Returns Nothing. dom.playPlugin() Availability Dreamweaver 3. Description Plays the selected plug-in item. Arguments None. Returns Nothing. Enabler “dom.canPlayPlugin()” on page 559. dom.setRulerOrigin() Availability Dreamweaver 3. Description Sets the origin of the ruler.
Page 449
Arguments xCoordinate, yCoordinate argument is a value, expressed in pixels, on the horizontal axis. xCoordinate argument is a value, expressed in pixels, on the vertical axis. yCoordinate Returns Nothing. dom.setRulerUnits() Availability Dreamweaver 3. Description Sets the current ruler units. Arguments units argument must be , or...
Page 450
Enabler “dom.hasTracingImage()” on page 563. dom.setTracingImageOpacity() Availability Dreamweaver 3. Description Sets the opacity of the tracing image. Arguments opacityPercentage argument must be a number between 0 and 100. opacityPercentage Returns Nothing. Enabler “dom.hasTracingImage()” on page 563. Example The following code sets the opacity of the tracing image to 30%: dw.getDocumentDOM().setTracingOpacity('30');...
Page 451
Enabler “dom.hasTracingImage()” on page 563. dom.stopAllPlugins() Availability Dreamweaver 3. Description Stops all plug-in content that is currently playing in the document. Arguments None. Returns Nothing. dom.stopPlugin() Availability Dreamweaver 3. Description Stops the selected plug-in item. Arguments None. Returns A Boolean value that indicates whether the selection is currently being played with a plug-in. Enabler “dom.canStopPlugin()”...
Page 452
dreamweaver.arrangeFloatingPalettes() Availability Dreamweaver 3. Description Moves the visible floating panels to their default positions. Arguments None. Returns Nothing. dreamweaver.showGridSettingsDialog() Availability Dreamweaver 3. Description Opens the Grid Settings dialog box. Arguments None. Returns Nothing. Design...
Layout view functions Layout view functions handle operations that change the layout elements within a document. They affect table, column, and cell settings, including position, properties, and appearance. dom.addSpacerToColumn() Availability Dreamweaver 4. Description Creates a 1-pixel-high transparent spacer image at the bottom of a specified column in the currently selected table.
Page 454
argument is the width of the cell in pixels. width argument is the height of the cell in pixels. height Returns Nothing. dom.createLayoutTable() Availability Dreamweaver 4. Description Creates a layout table in the current document at the specified position and dimensions, either within an existing table or in the area below the existing content on the page.
Page 455
argument is the column to check for a spacer image. colNum Returns Returns if the specified column in the currently selected table contains a spacer image true that Dreamweaver generated; otherwise. false dom.doesGroupHaveSpacers() Availability Dreamweaver 4. Description Determines whether the currently selected table contains a row of spacer images that Dreamweaver generated.
Page 456
dom.getShowLayoutTableTabs() Availability Dreamweaver 4. Description Determines whether the current document shows tabs for layout tables in Layout view. Arguments None. Returns Returns if the current document displays tabs for layout tables in Layout view; true otherwise. false dom.getShowLayoutView() Availability Dreamweaver 4. Description Determines the view for the current document;...
Page 457
Arguments colNum argument is the column to be automatically sized or fixed width. colNum Returns Returns if the column at the given index in the currently selected table is set to true autostretch; otherwise. false dom.makeCellWidthsConsistent() Availability Dreamweaver 4. Description In the currently selected table, this function sets the width of each column in the HTML to match the currently rendered width of the column.
Page 458
dom.removeSpacerFromColumn() Availability Dreamweaver 4. Description Removes the spacer image from a specified column and deletes the spacer row if there are no more spacer images that Dreamweaver generated. This function fails if the current selection is not a table or if the operation is not successful. Arguments colNum argument is the column from which to remove the spacer image.
Page 459
dom.getShowBlockBackgrounds() Availability Dreamweaver 8. Description This function gets the state of the visual aid that forces background coloring for all blocks or divs. Arguments allblocks argument, which is required, is a Boolean. Set the value to to apply allblocks true to div tags only.
Page 460
Returns A Boolean value; if , borders are displayed; if , borders are not displayed. true false Example The following example checks whether the block borders visual aid is on and, if not, turns it var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowBlockBorders(false) == false){ currentDOM.setShowBlockBorders(true);...
Page 461
dom.getShowBoxModel() Availability Dreamweaver 8. Description This function turns on and off the visual aid that colors the full box model for the selected block. Arguments None. Returns Nothing. Example The following example checks whether the full box model for the selected box is displayed in color, and, if not, colors it: var currentDOM = dw.getDocumentDOM();...
Page 462
Example “dom.getShowBlockBackgrounds()” on page 459. dom.setShowBlockBorders() Availability Dreamweaver 8. Description This function turns on or off the visual aid that draws borders for all blocks or divs. Arguments allblocks argument, which is required, is a Boolean. Set the value to to apply allblocks true...
Page 463
Example “dom.getShowBlockIDs()” on page 460. dom.setShowBoxModel() Availability Dreamweaver 8. Description This function sets the state of the visual aid that colors the full box model for the selected block. Arguments None. Returns A Boolean: if the box model is displayed; if the box model is not displayed.
dom.setShowLayoutView() Availability Dreamweaver 4. Description Places the current document in Layout view if bShow true Arguments bShow argument is a Boolean value that toggles the current document between bShow Layout view and Standard view. If , the current document is in Layout view; bShow true , the current document is in Standard view.
Page 465
The following example sets the value of the current view’s scale to 50%: dreamweaver.activeViewScale = 0.50; dreamweaver.fitAll() Availability Dreamweaver 8. Description This function zooms in or out so that the entire document fits in the currently visible portion of the Design view. Arguments None.
Page 466
Enabler “dreamweaver.canFitSelection()” on page 568. Example if (canFitSeletion()){ fitSelection(); dreamweaver.fitWidth() Availability Dreamweaver 8. Description This function zooms in or out so that the entire document width fits in the currently visible portion of the Design view. Arguments None. Returns Nothing. Enabler “dreamweaver.canZoom()”...
Page 467
Arguments None. Returns Nothing. Enabler “dreamweaver.canZoom()” on page 574. Example if (canZoom()){ zoomIn(); dreamweaver.zoomOut() Availability Dreamweaver 8. Description This function zooms out on the currently active Design view. The zoom level is the next preset value in the Magnification menu. If there is no next preset value, this function does nothing.
Guide functions and properties Guide functions and properties let you display, manipulate, and delete guides that let users measure and lay out elements on their HTML pages. dom.clearGuides() Availability Dreamweaver 8. Description This function determines whether to delete all guides in the document. Arguments None.
Page 469
argument is the location of the guide with both the value and units as one location string, with no space between the value and units. The possible units are for pixels "px" for percentage. For example, to specify 10 pixels, ;...
Page 470
dom.deleteHorizontalGuide() Availability Dreamweaver 8. Description This function deletes the horizontal guide at the specified location. Arguments location argument is a string that represents the location in the document to test, location with both the value and units as one string, with no space between the value and units. The possible units are for pixels and for percentage.
Page 471
Returns Nothing. Example The following example deletes the vertical guide at the specified location in the document: var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasVerticalGuide("10px") == true) { currentDOM.deleteVerticalGuide("10px"); dom.guidesColor Availability Dreamweaver 8. Description This mutable color property determines the color of guides in the document. You can set and get this property.
Page 472
Arguments None. Returns Nothing. Example The following example makes the distance feedback color of guides gray: var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesDistanceColor != "#CCCCCC"){ currentDOM.guidesDistanceColor = "#CCCCCC"; dom.guidesLocked Availability Dreamweaver 8. Description This mutable Boolean property determines whether guides are locked in the document. You can set and get this property.
Page 473
dom.guidesSnapToElements Availability Dreamweaver 8. Description This mutable Boolean property determines whether guides snap to elements in the document. You can set and get this property. Arguments None. Returns Nothing. Example The following example makes guides in the document snap to elements: var currentDOM = dw.getDocumentDOM();...
Page 474
Example The following example turns guides on if they are not visible: var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesVisible == false) { currentDOM.guidesVisible = true; dom.hasGuides() Availability Dreamweaver 8. Description This function determines whether the document has at least one guide. You can set and get this property.
Page 475
Arguments location argument is a string that represents the location in the document to test, location with both the value and units as one string, with no space between the value and units. The possible units are for pixels and for percentage.
Page 476
Example The following example deletes all guides in the document if the document has a vertical guide at the specified location: var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasVerticalGuide("10px") == true) { currentDOM.clearGuides(); dom.snapToGuides Availability Dreamweaver 8. Description This mutable Boolean property determines whether elements snap to guides in the document. You can set and get this property.
Table editing functions Table functions add and remove table rows and columns, change column widths and row heights, convert measurements from pixels to percents and back, and perform other standard table-editing tasks. dom.convertWidthsToPercent() Availability Dreamweaver 3. Description This function converts all attributes in the current table from pixels to percentages.
Page 478
dom.decreaseColspan() Availability Dreamweaver 3. Description This function decreases the column span by one. Arguments None. Returns Nothing. Enabler “dom.canDecreaseColspan()” on page 554. dom.decreaseRowspan() Availability Dreamweaver 3. Description This function decreases the row span by one. Arguments None. Returns Nothing. Enabler “dom.canDecreaseRowspan()”...
Page 479
dom.deleteTableColumn() Availability Dreamweaver 3. Description This function removes the selected table column or columns. Arguments None. Returns Nothing. Enabler “dom.canDeleteTableColumn()” on page 555. dom.deleteTableRow() Availability Dreamweaver 3. Description This function removes the selected table row or rows. Arguments None. Returns Nothing.
Page 480
dom.doDeferredTableUpdate() Availability Dreamweaver 3. Description If the Faster Table Editing option is selected in the General preferences, this function forces the table layout to reflect recent changes without moving the selection outside the table. This function has no effect if the Faster Table Editing option is not selected. Arguments None.
Page 481
dom.getTableExtent() Availability Dreamweaver 3. Description This function gets the number of columns and rows in the selected table. Arguments None. Returns An array that contains two whole numbers. The first array item is the number of columns, and the second array item is the number of rows. If no table is selected, nothing returns. dom.increaseColspan() Availability Dreamweaver 3.
Page 482
Arguments None. Returns Nothing. Enabler “dom.canDecreaseRowspan()” on page 555. dom.insertTableColumns() Availability Dreamweaver 3. Description This function inserts the specified number of table columns into the current table. Arguments numberOfCols, bBeforeSelection argument is the number of columns to insert. numberOfCols argument is a Boolean value: indicates that the columns bBeforeSelection true...
Page 483
Arguments numberOfRows, bBeforeSelection argument is the number of rows to insert. numberOfRows argument is a Boolean value: indicates that the rows should bBeforeSelection true be inserted above the row that contains the selection; otherwise. false Returns Nothing. Enabler “dom.canInsertTableRows()” on page 558.
Page 484
Returns Nothing. dom.removeAllTableWidths() Availability Dreamweaver 3. Description This function removes all attributes from the selected table. WIDTH Arguments None. Returns Nothing. dom.removeColumnWidth() Availability Dreamweaver MX 2004. Description This function removes all attributes from a single, selected column. WIDTH Arguments None. Returns Nothing.
Page 485
Arguments None. Returns Nothing. Enabler “dom.canSelectTable()” on page 560. dom.setShowTableWidths() Availability Dreamweaver MX 2004. Description Toggles the display of table widths on and off in standard or Expanded Tables mode (non- Layout mode). This function sets the value for the current document and any future document unless otherwise specified.
Page 486
Arguments tdOrTh argument must be either tdOrTh "td" "th" Returns Nothing. dom.setTableColumns() Availability Dreamweaver 3. Description This function sets the number of columns in the selected table. Arguments numberOfCols argument specifies the number of columns to set in the table. numberOfCols Returns Nothing.
Page 487
dom.showInsertTableRowsOrColumnsDialog() Availability Dreamweaver 3. Description This function opens the Insert Rows or Columns dialog box. Arguments None. Returns Nothing. Enabler “dom.canInsertTableColumns()” on page 557 “dom.canInsertTableRows()” on page 558. dom.splitTableCell() Availability Dreamweaver 3. Description This function splits the current table cell into the specified number of rows or columns. If one or both of the arguments is omitted, the Split Cells dialog box appears.
Code functions Code Hints are menus that Macromedia Dreamweaver 8 opens when you type certain character patterns in Code view. Code Hints provide a typing shortcut by offering a list of strings that potentially complete the string you are typing.
Page 490
Code Coloring lets you specify code color styles and to modify existing code coloring schemes or create new ones. You can specify code coloring styles and schemes by modifying the Colors.xml and code coloring scheme files. For more information on these files, see Extending Dreamweaver.
Page 491
argument, which is optional, specifies whether the pattern is case- casesensitive sensitive. The possible values for the argument are the Boolean values casesensitive . The value defaults to if you omit this argument. If the true false false argument is a value, the Code Hints menu appears only if the text casesensitive true...
Page 492
argument, which is optional, specifies whether the pattern is case- casesensitive sensitive. The possible values for the argument are the Boolean values casesensitive . The value defaults to if you omit this argument. If the true false false argument is a value, the Code Hints menu appears only if the text casesensitive true...
Page 493
Returns Nothing. Example Your JavaScript code might build a Code Hints menu that contains user-defined session variables. Each time the list of session variables changes, that code needs to update the menu. Before the code can load the new list of session variables into the menu, it needs to remove the old list.
Returns Nothing. Example dreamweaver.reloadCodeColoring() Find/replace functions Find/replace functions handle find and replace operations. They cover basic functionality, such as finding the next instance of a search pattern, and complex replacement operations that require no user interaction. dreamweaver.findNext() Availability Dreamweaver 3; modified in Dreamweaver MX 2004. Description Finds the next instance of the search string that was specified previously by dreamweaver.setUpFind(), by dreamweaver.setUpComplexFind(), or by the user in the Find...
Page 495
dreamweaver.replace() Availability Dreamweaver 3. Description Verifies that the current selection matches the search criteria that was specified by dreamweaver.setUpFindReplace(), by dreamweaver.setUpComplexFindReplace(), or by the user in the Replace dialog box; the function then replaces the selection with the replacement text that is specified by the search request. Arguments None.
Page 496
dreamweaver.setUpComplexFind() Availability Dreamweaver 3. Description Prepares for an advanced text or tag search by loading the specified XML query. Arguments xmlQueryString argument is a string of XML code that begins with xmlQueryString dwquery ends with . (To get a string of the proper format, set up the query in the Find /dwquery dialog box, click the Save Query button, open the query file in a text editor, and copy everything from the opening of the...
Page 497
Arguments xmlQueryString argument is a string of XML code that begins with the xmlQueryString dwquery and ends with the tag. (To get a string of the proper format, set up the query in /dwquery the Find dialog box, click the Save Query button, open the query file in a text editor, and copy everything from the beginning of the tag to the end of the tag.)
Page 498
property, which is optional, is a Boolean value that indicates whether {matchCase} the search is case-sensitive. If this property is not explicitly set, it defaults to false property, which is optional, is a Boolean value that indicates {ignoreWhitespace} whether white space differences should be ignored. The property ignoreWhitespace defaults to...
Page 499
property is a Boolean value that indicates whether to search the searchSource HTML source. property, which is optional, is a Boolean value that indicates whether {matchCase} the search is case-sensitive. If this property is not explicitly set, it defaults to a value.
Returns Nothing. Enabler “dreamweaver.canShowFindDialog()” on page 573. dreamweaver.showFindReplaceDialog() Availability Dreamweaver 3. Description Opens the Replace dialog box. Arguments None. Returns Nothing. Enabler “dreamweaver.canShowFindDialog()” on page 573. General editing functions You handle general editing functions in the Document window. These functions insert text, HTML, and objects;...
Page 501
Arguments tagName argument is the tag name that is associated with the character markup. It tagName must be one of the following strings: "b" "cite" "code" "dfn" "em" "i" "kbd" , or "samp" "s" "strong" "tt" "u" "var" Returns Nothing. dom.applyFontMarkup() Availability Dreamweaver 3.
Page 502
dom.editAttribute() Availability Dreamweaver 3. Description Displays the appropriate interface for editing the specified Document attribute. In most cases, this interface is a dialog box. This function is valid only for the active document. Arguments attribute is a string that specifies the tag attribute that you want to edit. attribute Returns Nothing.
Page 503
Arguments None. Returns The encoding identity of the document. For example, for a Latin1 document, the function returns iso-8859-1 dom.getFontMarkup() Availability Dreamweaver 3. Description Gets the value of the specified attribute of the tag for the current selection. FONT Arguments attribute argument must be , or...
Page 504
dom.getLinkHref() Availability Dreamweaver 3. Description Gets the link that surrounds the current selection. This function is equivalent to looping through the parents and grandparents of the current node until a link is found and then calling the on the link. getAttribute('HREF') Arguments None.
Page 505
dom.getListTag() Availability Dreamweaver 3. Description Gets the style of the selected list. Arguments None. Returns A string that contains the tag that is associated with the list ( , or ) or an empty "ul" "ol" "dl" string if no tag is associated with the list. This value always returns in lowercase letters. dom.getTextAlignment() Availability Dreamweaver 3.
Page 506
Arguments None. Returns A string that contains the block tag that is associated with the text (for example, "p" "h1" , and so on) or an empty string if no block tag is associated with the selection. This "pre" value always returns in lowercase letters. dom.hasCharacterMarkup() Availability Dreamweaver 3.
Page 507
Returns Nothing. dom.insertHTML() Availability Dreamweaver 3. Description Inserts HTML content into the document at the current insertion point. Arguments contentToInsert, {bReplaceCurrentSelection} argument is the content you want to insert. contentToInsert argument, which is optional, is a Boolean value that bReplaceCurrentSelection indicates whether the content should replace the current selection.
Page 508
dom.insertObject() Availability Dreamweaver 3. Description Inserts the specified object, prompting the user for parameters if necessary. Arguments objectName argument is the name of an object in the Configuration/Objects folder. objectName Returns Nothing. Example A call to the function inserts a form button into the active dom.insertObject('Button') document after the current selection.
Page 509
Returns Nothing. Example The following code inserts the text: into the current document: <b>130</b> var theDOM = dreamweaver.getDocumentDOM(); theDOM.insertText('<b>130</b>'); The results appear in the Document window, as shown in the following figure: dom.newBlock() Availability Dreamweaver 3. Description Creates a new block with the same tag and attributes as the block that contains the current selection or creates a new paragraph if the pointer is outside all blocks.
Page 510
dom.notifyFlashObjectChanged() Availability Dreamweaver 4. Description Tells Dreamweaver that the current Flash object file has changed. Dreamweaver updates the Preview display, resizing it as necessary, preserving the width-height ratio from the original size. For example, Flash Text uses this feature to update the text in the Layout view as the user changes its properties in the Command dialog box.
Page 511
Arguments tagName argument is the tag name that is associated with the character markup. It tagName must be one of the following strings: "b" "cite" "code" "dfn" "em" "i" "kbd" , or "samp" "s" "strong" "tt" "u" "var" Returns Nothing. dom.removeFontMarkup() Availability Dreamweaver 3.
Page 512
dom.resizeSelection() Availability Dreamweaver 3. Description Resizes the selected object to the specified dimensions. Arguments newWidth, newHeight argument specifies the new width to which the function will set the newWidth selected object. argument specifies the new height to which the function will set the newHeight selected object.
Page 513
dom.setLinkHref() Availability Dreamweaver 3. Description Makes the selection a hypertext link or changes the URL value of the HREF tag that encloses the current selection. Arguments linkHREF argument is the URL (document-relative path, root-relative path, or linkHREF absolute URL) comprising the link. If this argument is omitted, the Select HTML File dialog box appears.
Page 514
dom.setListBoxKind() Availability Dreamweaver 3. Description Changes the kind of the selected menu. SELECT Arguments kind argument must be either kind "menu" "list box" Returns Nothing. dom.showListPropertiesDialog() Availability Dreamweaver 3. Description Opens the List Properties dialog box. Arguments None. Returns Nothing. Enabler “dom.canShowListPropertiesDialog()”...
Page 515
Arguments listTag argument is the tag that is associated with the list. It must be listTag "ol" "ul" , or an empty string. "dl" Returns Nothing. dom.setTextAlignment() Availability Dreamweaver 3. Description Sets the attribute of the block that contains the selection to the specified value. ALIGN Arguments alignValue...
Page 516
dom.setTextFormat() Availability Dreamweaver 4. Description Sets the block format of the selected text. Arguments blockFormat argument is a string that specifies one of the following formats: (for blockFormat "" no format), , or "p" "h1" "h2" "h3" "h4" "h5" "h6" "pre"...
Page 517
Arguments None. Returns Nothing. Enabler “dreamweaver.canDeleteSelection()” on page 566. dreamweaver.editFontList() Availability Dreamweaver 3. Description Opens the Edit Font List dialog box. Arguments None. Returns Nothing. dreamweaver.getFontList() Availability Dreamweaver 3. Description Gets a list of all the font groups that appear in the text Property inspector and in the Style Definition dialog box.
Page 518
Example For the default installation of Dreamweaver, a call to the dreamweaver.getFontList() function returns an array that contains the following items: "Arial, Helvetica, sans-serif" "Times New Roman, Times, serif" "Courier New, Courier, mono" "Georgia, Times New Roman, Times, serif" "Verdana, Arial, Helvetica, sans-serif" dreamweaver.getFontStyles() Availability Dreamweaver 4.
Page 519
Arguments argument must be one of the following values: , or "Cmd" "Ctrl" "Alt" . In Windows, refer to the Control key; on the Macintosh, "Shift" "Cmd" "Ctrl" refers to the Option key. "Alt" Returns A Boolean value that indicates whether the key is pressed. Example The following code checks that both the Shift and Control keys (Windows) or Shift and Command keys (Macintosh) are pressed before performing an operation:...
dreamweaver.getSystemFontList() Availability Dreamweaver 4. Description Returns a list of fonts for the system. This function can get either all fonts or only TrueType fonts. These fonts are needed for the Flash Text object. Arguments fontTypes argument is a string that contains either fontTypes "all"...
argument is the DOM of the document to print. For information on how document to obtain the DOM for a document, see “dreamweaver.getDocumentDOM()” on page 311. Returns A Boolean value: if the code can print; otherwise. true false Example The following example calls to invoke the Print dialog box for the user’s dw.PrintCode() document.
Page 522
dom.selectParent() Availability Dreamweaver 3. Description Selects the parent of the current selection. Calling this function is equivalent to selecting the next tag to the left in the tag selector at the bottom of the Document window. Arguments None. Returns Nothing. dom.stripTag() Availability Dreamweaver 3.
Page 523
Arguments startTag argument is the source that is associated with the opening tag. startTag Returns Nothing. Example The following code wraps a link around the current selection: var theDOM = dw.getDocumentDOM(); var theSel = theDOM.getSelectedNode(); if (theSel.nodeType == Node.TEXT_NODE){ theDOM.wrapTag('<a href="foo.html">'); dreamweaver.showQuickTagEditor() Availability Dreamweaver 3.
Code view functions Code view functions include operations that are related to editing document source code (and that have subsequent impact on the Design view). The functions in this section let you add navigational controls to Code views within a split document view or the Code inspector window.
Page 525
Returns Nothing. dom.getShowNoscript() Availability Dreamweaver MX. Description Gets the current state of the content option (from the View > Noscript Content noscript menu option). On by default, the tag identifies page script content that can be noscript rendered, or not (by choice), in the browser. Arguments None.
Page 526
property, which is the number of warnings numWarning property, which is the number of information messages numInfo Example theDom = dw.getDocumentDOM(); theDom.runValidation(); theDom.getAutoValidationCount(); dom.isDesignViewUpdated() Availability Dreamweaver 4. Description Determines whether the Design view and Text view content is synchronized for those Dreamweaver operations that require a valid document state.
Page 527
dom.setShowNoscript() Availability Dreamweaver MX. Description Sets the content option on or off (the same as selecting the View > Noscript noscript Content option). On by default, the tag identifies page script content that can be noscript rendered, or not (by choice), in the browser. Arguments {bShowNoscript} argument, which is optional, is a Boolean value that indicates...
Page 528
dom.source.arrowLeft() Availability Dreamweaver 4. Description Moves the insertion point to the left in the current line of the Code view. If content is already selected, this function extends the selection to the left. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of characters that the insertion nTimes point must move.
Page 529
dom.source.arrowUp() Availability Dreamweaver 4. Description Moves the insertion point up the Code view document, line by line. If content is already selected, this function extends the selection line by line. Arguments {nTimes}, {bShiftIsDown} argument is the number of lines that the insertion point must move. If nTimes is omitted, the default is 1.
Page 530
dom.source.endOfDocument() Availability Dreamweaver 4. Description Places the insertion point at the end of the current Code view document. If content is already selected, this function extends the selection to the end of the document. Arguments bShiftIsDown argument is a Boolean value that indicates whether content is being bShiftIsDown selected.
Page 531
dom.source.endPage() Availability Dreamweaver 4. Description Moves the insertion point to the end of the current page or to the end of the next page if the insertion point is already at the end of a page. If content is already selected, this function extends the selection page by page.
Page 532
dom.source.getSelection() Description Gets the selection in the current document, which is expressed as character offsets into the document’s Code view. Arguments None. Returns A pair of integers that represent offsets from the beginning of the source document. The first integer is the opening of the selection; the second is the closing of the selection. If the two numbers are equal, the selection is an insertion point.
Page 533
argument is an integer that represents the offset from the beginning of startOffset the document. argument is an integer that represents the end of the document. endOffset Returns A string that represents the text in the source code between the offsets start dom.source.getValidationErrorsForOffset() Availability...
Page 534
Example The following example calls to check for any errors at getValidationErrorsForOffset() the offset of the current selection. If the function returns an error, the code calls the alert() function to display the error message to the user. var offset = dw.getDocumentDOM().source.getSelection()[0]; var errors = dw.getDocumentDOM().source.getValidationErrorsForOffset(offset);...
Page 535
Returns A Boolean value: if successful; otherwise. true false dom.source.nextWord() Availability Dreamweaver 4. Description Moves the insertion point to the beginning of the next word (or words, if specified) in the Code view. If content is already selected, this function extends the selection to the right. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of words that the insertion point...
Page 536
dom.source.pageDown() Availability Dreamweaver 4. Description Moves the insertion point down the Code view document, page by page. If content is already selected, this function extends the selection page by page. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of pages that the insertion point nTimes must move.
Page 537
dom.source.previousWord() Availability Dreamweaver 4. Description Moves the insertion point to the beginning of the previous word (or words, if specified) in Code view. If content is already selected, this function extends the selection to the left. Arguments {nTimes}, {bShiftIsDown} argument, which is optional, is the number of words that the insertion point nTimes must move.
Page 538
Returns A Boolean value: if successful; otherwise. true false dom.source.scrollEndFile() Availability Dreamweaver 4. Description Scrolls the Code view to the bottom of the document file without moving the insertion point. Arguments None. Returns Nothing. dom.source.scrollLineDown() Availability Dreamweaver 4. Description Scrolls the Code view down line by line without moving the insertion point. Arguments nTimes argument is the number of lines to scroll.
Page 539
dom.source.scrollLineUp() Availability Dreamweaver 4. Description Scrolls the Code view up line by line without moving the insertion point. Arguments nTimes argument is the number of lines to scroll. If is omitted, the default nTimes nTimes is 1. Returns Nothing. dom.source.scrollPageDown() Availability Dreamweaver 4.
Page 540
Arguments nTimes argument is the number of pages to scroll. If is omitted, the default nTimes nTimes is 1. Returns Nothing. dom.source.scrollTopFile() Availability Dreamweaver 4. Description Scrolls the Code view to the top of the document file without moving the insertion point. Arguments None.
Page 541
dom.source.setCurrentLine() Availability Dreamweaver 4. Description Puts the insertion point at the beginning of the specified line. If the argument is lineNumber not a positive integer, the function does nothing and returns . It puts the insertion point false at the beginning of the last line if is larger than the number of lines in the source.
Page 542
dom.source.startOfLine() Availability Dreamweaver 4. Description Places the insertion point at the beginning of the current line. If content is already selected, this function extends the selection to the beginning of the current line. Arguments bShiftIsDown argument is a Boolean value that indicates whether content is being bShiftIsDown selected.
Page 543
dom.source.wrapSelection() Availability Dreamweaver 4. Description Inserts the text of before the current selection and the text of after the startTag endTag current selection. The function then selects the entire range between, and including, the inserted tags. If the current selection was an insertion point, then the function places the insertion point between the don’t have to be startTag...
Tag editor and tag library functions You can use tag editors to insert new tags, edit existing tags, and access reference information about tags. The Tag Chooser lets users organize their tags so that they can easily select frequently used tags. The tag libraries that come with Dreamweaver store information about tags that are used in standards-based markup languages and most widely used tag-based scripting languages.
Page 545
A directive, such as <%= %> Returns A Boolean value: if anything is inserted into the document; otherwise. true false dreamweaver.popupEditTagDialog() Availability Dreamweaver MX. Description If a tag is selected, this function opens the tag editor for that tag, so you can edit the tag. Arguments None.
Page 546
dreamweaver.showTagLibraryEditor() Availability Dreamweaver MX. Description This function opens the Tag Library editor. Arguments None. Returns None. dreamweaver.tagLibrary.getTagLibraryDOM() Availability Dreamweaver MX. Description Given the URL of a file, this function returns the DOM for that file, so that filename.vtm its contents can be edited. This function should be called only when the Tag Library editor is active.
Page 547
dreamweaver.tagLibrary.getSelectedLibrary() Availability Dreamweaver MX. Description If a library node is selected in the Tag Library editor, this function gets the library name. Arguments None. Returns A string, the name of the library that is currently selected in the Tag Library editor; returns an empty string if no library is selected.
Page 548
dreamweaver.tagLibrary.importDTDOrSchema() Availability Dreamweaver MX. Description This function imports a DTD or schema file from a remote server into the tag library. Arguments fileURL, Prefix argument is the path to DTD or schema file, in local URL format. fileURL argument is the prefix string that should be added to all tags in this tag Prefix library.
Page 549
Example: The following example shows that using the dw.tagLibrary.getImportedTagList() function can get an array of tags from the library: libName // "fileURL" and "prefix" have been entered by the user. // tell the Tag Library to Import the DTD/Schema var libName = dw.tagLibrary.importDTDOrSchema(fileURL, prefix); // get the array of tags for this library // this is the TagInfo object var tagArray = dw.tagLibrary.getImportedTagList(libName);...
CHAPTER 18 Enablers Macromedia Dreamweaver 8 Enabler functions determine whether another function can perform a specific operation in the current context. The function specifications describe the general circumstances under which each function returns a value. However, the true descriptions are not intended to be comprehensive and might exclude some cases in which the function would return a value.
Page 552
dom.canApplyTemplate() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Apply To Page operation. This function is valid only for the active document. Arguments None. Returns A Boolean value that indicates whether the document is not a library item or a template, and that the selection is not within the tag.
Page 553
Returns A Boolean value: if the opening and closing offsets of the selection are different; true false otherwise, to indicate that nothing has been selected. dom.canClipPaste() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Paste operation. Arguments None. Returns A Boolean value: if the Clipboard contains any content that can be pasted into...
Page 554
dom.canConvertLayersToTable() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Convert Layers to Table operation. Arguments None. Returns A Boolean value: if all the content in the section of the document is contained true BODY within layers; otherwise. false dom.canConvertTablesToLayers() Availability Dreamweaver 3.
Page 555
Returns A Boolean value: if the current cell has a attribute and that attribute’s value is true COLSPAN greater than or equal to 2; otherwise. false dom.canDecreaseRowspan() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Decrease Rowspan operation. Arguments None.
Page 556
dom.canDeleteTableRow() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Delete Row operation. Arguments None. Returns A Boolean value: if the insertion point is inside a cell or if a cell or row is selected; true otherwise. false site.canEditColumns() Description Checks whether a site exists.
Page 557
dom.canIncreaseColspan() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Increase Colspan operation. Arguments None. Returns A Boolean value: if there are any cells to the right of the current cell; otherwise. true false dom.canIncreaseRowspan() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Increase Rowspan operation.
Page 558
Returns A Boolean value: if the selection is inside a table; if the selection is an entire table true false or is not inside a table. dom.canInsertTableRows() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Insert Row(s) operation. Arguments None.
Page 559
dom.canMarkSelectionAsEditable() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Mark Selection as Editable operation. Arguments None. Returns A Boolean value: if there is a selection and the current document is a DWT file; true otherwise false dom.canMergeTableCells() Availability Dreamweaver 3.
Page 560
Returns A Boolean value: if the selection can be played with a plug-in. true dom.canRedo() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Redo operation. Arguments None. Returns A Boolean value: if any steps remain to redo; otherwise. true false dom.canRemoveEditableRegion()
Page 561
Arguments None. Returns A Boolean value: if the insertion point or selection is within a table; otherwise. true false dom.canSetLinkHref() Availability Dreamweaver 3. Description Checks whether Dreamweaver can change the link around the current selection or create one if necessary. Arguments None.
Page 562
dom.canSplitFrame() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Split Frame [Left | Right | Up | Down] operation. Arguments None. Returns A Boolean value: if the selection is within a frame; otherwise. true false dom.canSplitTableCell() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Split Cell operation.
Page 563
Returns A Boolean value: if the selection is currently being played with a plug-in; true false otherwise. dom.canUndo() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Undo operation. Arguments None. Returns A Boolean value: if any steps remain to undo; otherwise.
Page 564
Arguments None. Returns Returns a Boolean value: if the asset can be edited; otherwise. Returns a true false false value for colors and URLs in the Site list, and returns a value for a multiple selection of false colors and URLs in the Favorites list. dreamweaver.assetPalette.canInsertOrApply() Availability Dreamweaver 4.
Page 565
Returns A Boolean value: if there is any content selected that can be copied to the Clipboard; true otherwise. false dreamweaver.canClipCut() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Cut operation. Arguments None. Returns A Boolean value: if there is any selected content that can be cut to the Clipboard; true otherwise.
Page 566
dreamweaver.canDeleteSelection() Availability Dreamweaver 3. Description Checks whether Dreamweaver can delete the current selection. Depending on the window that has focus, the deletion might occur in the Document window or the Site panel (on the Macintosh, in an text field in a dialog box or floating panel). Arguments None.
Page 567
dreamweaver.canExportTemplateDataAsXML() Availability Dreamweaver MX. Description Checks whether Dreamweaver can export the current document as XML. Arguments None. Returns A Boolean value: if you can perform an export on the current document; true false otherwise. Example The following example calls to determine whether dw.canExportTemplateDataAsXML() Dreamweaver can export the current document as XML and if it returns , calls...
Page 568
dreamweaver.canFitSelection() Availability Dreamweaver 8. Description Checks whether there is a selection in an active Design view, which means that can be called. fitSelection() Arguments None. Returns A Boolean value: if there is a selection in an active Design view; otherwise. true false dreamweaver.canOpenInFrame()
Page 569
Returns A Boolean value: if there is text, HTML, or Dreamweaver HTML on the Clipboard and true focus is in Code View, Design View, or Code Inspector; otherwise. false dreamweaver.canPlayRecordedCommand() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Play Recorded Command operation. Arguments None.
Page 570
dreamweaver.canRedo() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Redo operation in the current context. Arguments None. Returns A Boolean value that indicates whether any operations can be undone. dreamweaver.canRevertDocument() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Revert (to the last-saved version) operation. Arguments documentObject argument is the object at the root of a document’s DOM tree (the...
Page 571
Arguments None. Returns A Boolean value that indicates whether one or more unsaved documents are open. dreamweaver.canSaveDocument() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Save operation on the specified document. Arguments documentObject argument is the root of a document’s DOM (the same value that documentObject function returns).
Page 572
dreamweaver.canSaveFrameset() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Save Frameset operation on the specified document. Arguments documentObject argument is the root of a document’s DOM (the same value that documentObject function returns). dreamweaver.getDocumentDOM() Returns A Boolean value that indicates whether the document is a frameset with unsaved changes. dreamweaver.canSaveFramesetAs() Availability Dreamweaver 3.
Page 573
dreamweaver.canSelectAll() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Select All operation. Arguments None. Returns A Boolean value that indicates whether a Select All operation can be performed. dreamweaver.canShowFindDialog() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Find operation. Arguments None.
Page 574
Returns A Boolean value that indicates whether any operations can be undone. dreamweaver.canZoom() Availability Dreamweaver 8. Description Checks to see if there is an active Design view, which means that basic zoom commands can be applied. Arguments None. Returns A Boolean value: if there is an active Design view;...
Page 575
Example The following code checks whether the enabler function has been set to the value before true allowing edits to the selected rule: if(dw.cssRuleTracker.canEditSelectedRule()){ dw.cssRuleTracker.editSelectedRule(); dreamweaver.cssStylePalette.canApplySelectedStyle() Availability Dreamweaver MX. Description Checks the current active document to see whether the selected style can be applied. Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles...
Page 576
Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles pane Panel to which this function applies. Possible values are , which is the list of "stylelist" styles in “All” mode; , which is the list of applicable, relevant rules in “Current” "cascade"...
Page 577
dreamweaver.cssStylePalette.canEditSelectedStyle() Availability Dreamweaver MX. Description Checks the current active document to see whether the selected style can be edited. Arguments { pane } argument, which is optional, is a string that specifies the pane of the Styles pane Panel to which this function applies. Possible values are , which is the list of "stylelist"...
Page 578
Returns A Boolean value: if the selected style is editable; otherwise. true false dreamweaver.cssStylePalette.canEditStyleSheet() Availability Dreamweaver MX. Description Checks the current selection to see whether it contains style sheet elements that can be edited. Arguments None. Returns A Boolean value: if the selection is a style sheet node or a style definition within a style true sheet node and the style sheet is neither hidden nor this document;...
Page 579
dreamweaver.isRecording() Availability Dreamweaver 3. Description Reports whether Dreamweaver is currently recording a command. Arguments None. Returns A Boolean value that indicates whether Dreamweaver is recording a command. dreamweaver.htmlStylePalette.canEditSelection() Availability Dreamweaver 3. Description Checks whether Dreamweaver can edit, delete, or duplicate the selection in the HTML Styles panel.
Page 580
Returns A Boolean value: if the contents can clear; otherwise. true false dreamweaver.resultsPalette.canCopy() Availability Dreamweaver MX. Description Checks whether the current Results window can display a copied message in its contents. Arguments None. Returns A Boolean value: if the contents can display; otherwise.
Page 581
Arguments None. Returns A Boolean value: if the contents can display; otherwise. true false dreamweaver.resultsPalette.canOpenInBrowser() Availability Dreamweaver MX. Description Checks whether the current report can display in a browser. Arguments None. Returns A Boolean value: if the contents can display; otherwise.
Page 582
Description Checks whether the Save dialog box can open for the current panel. Currently, the Site Reports, Target Browser Check, Validation, and Link Checker panels support the Save dialog box. Arguments None. Returns A Boolean value: if the Save dialog box can appear; otherwise.
Page 583
dreamweaver.siteSyncDialog.canMarkDelete() Availability Dreamweaver 8. Description This function checks whether the Change Action to Delete context menu in the Site Synchronize dialog box can be displayed. Arguments None. Returns A Boolean value: if the Change Action to Delete context menu can be displayed; true false otherwise.
Page 584
dreamweaver.siteSyncDialog.canMarkIgnore() Availability Dreamweaver 8. Description This function checks whether the Change Action to Ignore context menu in the Site Synchronize dialog box can be displayed. Arguments None. Returns A Boolean value: if the Change Action to Ignore context menu can be displayed; true false otherwise.
Page 585
dreamweaver.siteSyncDialog.canMarkSynced() Availability Dreamweaver 8. Description This function checks whether the Change Action to Synced context menu in the Site Synchronize dialog box can be displayed. Arguments None. Returns A Boolean value: if the Change Action to Synced context menu can be displayed; true false otherwise.
Page 586
Arguments None. Returns A Boolean value: if you can insert or apply the selected element; otherwise. true false site.browseDocument() Availability Dreamweaver 4. Description Opens all selected documents in a browser window. It is the same as using the Preview in Browser command.
Page 587
site.canChangeLink() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Change Link operation. Arguments None. Returns A Boolean value: if an HTML or Flash file links to the selected file in the site map; true otherwise. false site.canCheckIn() Availability Dreamweaver 3.
Page 588
site.canCheckOut() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Check Out operation on the specified file or files. Arguments siteOrURL argument must be the keyword, which indicates that the function siteOrURL site should act on the selection in the Site panel or the URL for a single file. Returns A Boolean value: if all the following conditions are true;...
Page 589
Returns A Boolean value: if Dreamweaver can perform the Cloaking operation on the current true site or the specified folder; otherwise. false site.canCompareFiles() Availability Dreamweaver 8. Description This function checks whether Dreamweaver can perform the Compare function on selected files. Arguments None.
Page 590
site.canFindLinkSource() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Find Link Source operation. Arguments None. Returns A Boolean value that indicates that the selected link in the site map is not the home page. site.canGet() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Get operation.
Page 591
site.canLocateInSite() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Locate in Local Site or Locate in Remote Site operation (depending on the argument). Arguments localOrRemote, siteOrURL argument must be either localOrRemote local remote argument must be the keyword, which indicates that the function siteOrURL site should act on the selection in the Site panel or the URL for a single file.
Page 592
Returns A Boolean value: if Dreamweaver can perform a Turn Off Read Only operation; true false if one or more of the selected files is locked. site.canMakeNewFileOrFolder() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a New File or New Folder operation in the Site panel.
Page 593
site.canPut() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Put operation. Arguments siteOrURL argument must be the keyword, which indicates that the function siteOrURL site should act on the selection in the Site panel, or the URL for a single file. Returns One of the following values: If the argument is the keyword...
Page 594
site.canRefresh() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Refresh [Local | Remote] operation. Arguments localOrRemote argument must be either the keyword localOrRemote local remote Returns A value of if the argument is the keyword; otherwise, a Boolean true localOrRemote local...
Page 595
site.canSetLayout() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Layout operation. Arguments None. Returns A Boolean value: if the site map is visible; otherwise. true false site.canSelectAllCheckedOutFiles() Availability Dreamweaver 4. Description Determines whether the current working site has the Check In/Check Out feature enabled. Arguments None.
Page 596
Arguments localOrRemote argument must be either the keyword localOrRemote local remote Returns A Boolean value that indicates whether the document belongs to a site for which a remote site has been defined. site.canShowPageTitles() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Show Page Titles operation. Arguments None.
Page 597
site.canUncloak() Availability Dreamweaver MX. Description Determines whether Dreamweaver can perform an uncloaking operation. Arguments siteOrURL argument must be the keyword, which indicates that the siteOrURL site function should act on the selection in the Site panel or the URL of a canUncloak() particular folder, which indicates that the function should act on the...
Page 598
site.canViewAsRoot() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a View as Root operation. Arguments None. Returns A Boolean value: if the specified file is an HTML or Flash file; otherwise. true false Enablers...
Page 613
Results window 190 folders saving 31, 33 _mmServerScripts 30 size of 23 checking in 129 snippets 391 checking in/out source control systems 130 source control systems 122, 123 configuration 17 tesing existence 126 Configuration/Temp 31, 33 testing existence 19 contents of 23 time created 21 creating 18, 124 time modified 20...
Page 622
retrieve index of selected item 188 retrieving an array of items 187 Save As Command dialog box 169 retrieving number of items 188 save() 195 set buttons 189 saveAll() 318 setting selected item 190 saveAllFrames() 442 title 191 saveAsCommand() 169 Results window functions 183 saveAsImage() 288 resultsPalette.canClear() 579...
Need help?
Do you have a question about the DREAMWEAVER 8-DREAMWEAVER API and is the answer not in the manual?
Questions and answers