Summary of Contents for Adobe 38040334 - Dreamweaver CS3
Page 1
CS 3 ADOBE DREAMWEAVER ® ® API REFERENCE...
Page 2
Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or trans- mitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.
Page 4
Chapter 10: The source control integration API How source control integration with Dreamweaver works Adding source control system functionality The source control integration API required functions The source control integration API optional functions Enablers ................. 99 Chapter 11: Application External application functions .
Chapter 1: Introduction The Adobe Dreamweaver CS3 API Reference describes the application programming interfaces (APIs) that let you perform various supporting tasks when developing Adobe® Dreamweaver® CS3 extensions and adding program code to your Dreamweaver web pages. These APIs include...
Application The following functions are added to the Application chapter. External application functions • “dom.insertFiles()” on page 111 • “dreamweaver.activateApp()” on page 111 • “dreamweaver.printDocument()” on page 111 www.adobe.com/support/dream- DREAMWEAVER CS3 API Reference...
Page 8
• “dreamweaver.revealDocument()” on page 112 General application functions • “dw.registerIdleHandler()” on page 115 • “dw.revokeIdleHandler()” on page 116 Bridge Communication • “BridgeTalk.bringToFront()” on page 117 • “Bridgetalk.send()” on page 117 • “BridgeTalk.suppressStartupScreen()” on page 118 • “dw.browseInBridge()” on page 118 Workspace The following new Active Content and Code View functions are added to “Workspace”...
Errata A current list of known issues can be found in the Extensibility section of the Dreamweaver Support Center (www.adobe.com/support/dreamweaver/extend/extending_dwmx_errata). Conventions used in this guide Typographical conventions The following typographical conventions are used in this guide: • font indicates code fragments and API literals, including class names, method names, function names, type Code names, scripts, SQL statements, and both HTML and XML tag and attribute names.
Chapter 2: The file I/O API Adobe® Dreamweaver® CS3 includes a C shared library called DWfile, which lets authors of objects, commands, behaviors, data translators, floating panels, and Property inspectors read and write files on the local file system. This chapter describes the File I/O API and how to use it.
Page 12
Description This function copies the specified file to a new location. Arguments originalURL, copyURL • The argument, which is expressed as a file:// URL, is the file you want to copy. originalURL • The argument, which is expressed as a file:// URL, is the location where you want to save the copied file. copyURL Returns A Boolean value:...
Page 13
Description This function tests for the existence of the specified file. Arguments fileURL • The argument, which is expressed as a file:// URL, is the requested file. fileURL Returns A Boolean value: if the file exists; true Example The following code checks for the mydata.txt file and displays an alert message that tells the user whether the file exists: var fileURL = "file:///c|/temp/mydata.txt";...
Page 14
var fileURL = "file:///c|/temp/mydata.txt"; var str = DWfile.getAttributes(fileURL); if (str && (str.indexOf("R") != -1)){ alert(fileURL + " is read only!"); DWfile.getModificationDate() Availability Dreamweaver 2. Description This function gets the time when the file was last modified. Arguments fileURL • The argument, which is expressed as a file:// URL, is the file for which you are checking the last modified fileURL time.
Page 15
• The argument, which is expressed as a file:// URL, is the file for which you are checking the creation fileURL time. Returns A string that contains a hexadecimal number that represents the number of time units that have elapsed since some base time.
Page 16
Returns A JavaScript object that represents the date and time when the specified file was last modified. Date DWfile.getSize() Availability Dreamweaver MX. Description This function gets the size of a specified file. Arguments fileURL • The argument, which is expressed as a file:// URL, is the file for which you are checking the size. fileURL Returns An integer that represents the actual size, in bytes, of the specified file.
Page 17
DWfile.read() Availability Dreamweaver 2. Description This function reads the contents of the specified file into a string. Arguments fileURL • The argument, which is expressed as a file:// URL, is the file you want to read. fileURL Returns A string that contains the contents of the file or a Example The following code reads the mydata.txt file and, if it is successful, displays an alert message with the contents of the file:...
Page 18
var selFile = document.theForm.menu.options[selIndex].value; if (DWfile.getAttributes(selFile).indexOf('R') != -1){ delAnyway = confirm('This file is read-only. Delete anyway?'); if (delAnyway){ DWfile.remove(selFile); DWfile.setAttributes() Availability Dreamweaver MX. Description This function sets the system-level attributes of a particular file. Arguments fileURL, strAttrs • The argument, which is expressed as a file:// URL, identifies the file for which you are setting the fileURL attributes.
Page 19
Description This function writes the specified string to the specified file. If the specified file does not yet exist, it is created. Arguments fileURL, text, {mode} • The argument, which is expressed as a file:// URL, is the file to which you are writing. fileURL •...
Chapter 3: The HTTP API Extensions are not limited to working in the local file system. Adobe® Dreamweaver® CS3 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.
DREAMWEAVER CS3 API Reference 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.
Page 22
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 23
Returns An object that represents the reply from the server. The location where the file is saved, which is expressed as a file:// URL. Normally, the contains the status code that is received from the server. However, if a disk error occurs while Dreamweaver is saving the file on the local drive, the statusCode codes if the operation is not successful:...
Page 24
• The argument is the name of the JavaScript function to call when the HTTP request is callbackFunction complete. • The argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes HTTP protocol. •...
Page 25
Arguments callbackFunc, URL, {serverScriptsFolder} • The argument is the JavaScript function to call when the HTTP request is complete. callbackFunc • The argument is an absolute URL on a web server; if http:// is omitted from the URL, Dreamweaver assumes HTTP protocol.
Page 26
The myScripts.cfm file in the Configuration/DeployScripts folder on the local computer is copied to another folder named DeployScripts, which is a subfolder of the root folder on the ultraqa8 website. To deploy the files, Dreamweaver uses the protocol specified in the site configuration properties. Dreamweaver uses HTTP protocol to post the As a result of the post request, the web server on ultraqa8 executes the myScripts.cfm script using the MMHttp.postTextCallback()
Chapter 4: The Design Notes API Adobe® Dreamweaver® CS3, Fireworks, and 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.
<?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 MMNotes.close() Description This function closes the specified Design Notes file and saves any changes.
Page 29
MMNotes.get() Description This function gets the value of the specified key in the specified Design Notes file. Arguments fileHandle, keyName • The argument is the file handle that fileHandle • The argument is a string that contains the name of the key. keyName Returns A string that contains the value of the key.
Page 30
var noteHandle = MMNotes.open(dw.getDocumentDOM().URL); var theKeys = MMNotes.getKeys(noteHandle); var noteString = ""; var theValue = ""; for (var i=0; i < theKeys.length; i++){ theValue = MMNotes.get(noteHandle,theKeys[i]); noteString +=0theKeys[i] + " = " theValue + "\n"; document.theForm.bigTextField.value = noteString; // always close noteHandle MMNotes.close(noteHandle);...
Page 31
Arguments None. Returns A string that contains the version number. MMNotes.localURLToFilePath() Description This function converts the specified file:// URL to a local drive path. Arguments fileURL • The argument, which is expressed as a file:// URL, is the path to a local file. fileURL Returns A string that contains the local drive path for the specified file.
• The argument is the file handle that the fileHandle • The argument is a string that contains the name of the key to remove. keyName Returns A Boolean value: indicates the operation is successful; true MMNotes.set() Description This function creates or updates one key/value pair in a Design Notes file. Arguments fileHandle, keyName, valueString •...
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.
Example The following code gets the value of the welcome.html file: FileHandle noteHandle = OpenNotesFile("file:///c|/sites/avocado8/iwjs/welcome.html"); if(noteHandle > 0){ int valueLength = GetNoteLength( noteHandle, "comments"); char* valueBuffer = new char[valueLength + 1]; GetNote(noteHandle, "comments", valueBuffer, valueLength + 1); printf("Comments: %s",valueBuffer); CloseNotesFile(noteHandle); int GetNoteLength() Description This function gets the length of the value that is associated with the specified key.
• The argument is the file handle that noteHandle • The argument is the buffer array where the keys are stored. keyBufArray[64] • The argument is the integer that keyArrayMaxLen maximum number of items in the key buffer array. Returns A Boolean value: indicates the operation is successful;...
BOOL GetVersionName() Description This function gets the version name of the MMNotes shared library, which indicates the application that imple- mented it. Arguments char* versionNameBuf int versionNameBufMaxLen • The argument is the buffer where the version name is stored. versionNameBuf •...
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} • The argument, which is expressed as a file:// URL, is a string that contains the path to the main localFileURL file with which the Design Notes file is associated.
BOOL SetNote() Description This function creates or updates one key/value pair in a Design Notes file. Arguments const char FileHandle noteHandle, • The argument is the file handle that the noteHandle • The argument is a string that contains the name of the key. keyName[64] •...
Fireworks user interface (UI) and provide commands to Fireworks through its own JavaScript API documented in Extending Fireworks. For general information on how C libraries interact with the JavaScript interpreter in Adobe® Dreamweaver® CS3, see Extending Dreamweaver for details on C-level extensibility.
Page 40
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. Arguments javascriptOrFileURL •...
Page 41
Arguments progressTrackerCookie • The argument is the cookie object that the progressTrackerCookie function returns. Returns A string that contains the result of the script passed to the operation completes successfully, a null that indicates one of the following errors occurred: •...
Page 42
Description This function determines whether it is possible to open a Fireworks optimization session. Arguments None. Returns A Boolean value that indicates whether the platform is Windows or the Macintosh; if it is the Macintosh, the value indicates if another Fireworks optimization session is already running. FWLaunch.optimizeInFireworks() Availability Dreamweaver 2, Fireworks 2.
Page 43
Arguments {versionNumber} • The argument is an optional floating-point number that is greater than or equal to 2; it represents versionNumber the required version of Fireworks. If this argument is omitted, the default is 2. Returns A Boolean value that indicates whether the specified version of Fireworks was found. Example The following code checks whether Fireworks is installed: if (FWLaunch.validateFireworks(6.0)){...
Page 44
typeof(gProgressTrackerCookie) == "number") { window.close(); alert("an error occurred"); gProgressTrackerCookie = null; } else { // bring Fireworks to the front FWLaunch.bringFWToFront(); // start the checking to see if Fireworks is done yet checkOneMoreTime(); function checkOneMoreTime() { // Call checkJsResponse() every 1/2 second to see if Fireworks // is done yet window.setTimeout("checkJsResponse();", 500);...
Page 45
DREAMWEAVER CS3 API Reference </script> </head> <body> <form> <table width="313" nowrap> <tr> <td>This command asks Fireworks to execute the prompt() ¬ function. When you click Prompt, Fireworks comes forward and ¬ asks you to enter a value into a dialog box. That value is then ¬ returned to Dreamweaver and displayed in an alert.</td>...
Chapter 6: Flash integration Adobe® Dreamweaver® CS3 provides support for Flash elements as well as continuing support for the Flash Object API, which leverages the Flash Generator Template file to create new Flash objects. This chapter describes ways of working with Flash elements (SWC files), and also provides details for the creation of Flash objects (SWF files) from Flash Generator templates (SWT files).
DREAMWEAVER CS3 API Reference file that is already installed in the Configuration/Objects/FlashElements folder or one of its subfolders to the Insert bar or Insert menu). Extension developers can use the JavaScript function “dom.insertFlashElement()” on page 127 in the object definition file to add available Flash elements to a document. When the user selects the Flash element object, Dreamweaver unpacks the SWC file, which contains Flash content (SWF file) and a file that details the parameters the user can edit.
Page 48
SWFFile.createFile() Description This function generates a new Flash Object file with the specified template and array of parameters. It also creates a GIF, PNG, JPEG, and MOV version of the title if filenames for those formats are specified. If you want to specify an optional parameter that follows optional parameters that you do not want to include, you need to specify empty strings for the unused parameters.
Page 49
• 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 inside the Template file with the string, "text"...
Page 50
if ( SWFFile.getObjectType("file:///MyMac/test.swf") == "myType" ){ alert ("This is a myType object."); }else{ alert ("This is not a myType object."); SWFFile.readFile() Description This function reads a Flash Object file. Arguments fileName • The argument, which is expressed as a file:// URL, is a path to a Flash Object file. fileName Returns An array of strings where the first array element is the full path to the template SWT file.
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 Adobe® Dreamweaver® CS3 server behavior, data format, and data sources APIs all use these database functions.
function getDynamicBindings(ss) var serverModel = dw.getDocumentDOM().serverModel.getServerName(); var bindingsAndTypeArray = new Array(); var connName=ss.connectionName; var statement = ss.source; var rsName= ss.rsName; // remove SQL comments statement = statement.replace(/\/\*[\S\s]*?\*\//g, " "); var bIsSimple = ParseSimpleSQL(statement); statement = stripCFIFSimple(statement); if (bIsSimple) { statement = RemoveWhereClause(statement,false); } else { var pa = new Array();...
Page 53
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 54
Property Description Connection name name Indicates, if type database at runtime Runtime ADO connection string or JDBC URL string ColdFusion DSN Runtime JDBC driver driver Runtime user name username Runtime password password String that contains either a useHTTP remote driver (HTTP connection) at design time; otherwise, use a local driver (DLL) Regular expression used to find the file include statement on the page during includePattern...
Page 55
MMDB.getConnectionName() Availability Dreamweaver UltraDev 1. Description This function gets the connection name that corresponds to the specified connection string. This function is useful when you need to reselect a connection name in the user interface (UI) from data on the page. If you have a connection string that references two drivers, you can specify the connection string and the driver that corresponds to the connection name that you want to return.
Page 56
• The argument is a connection name that is specified in the Connection Manager. It identifies the connName connection string that Dreamweaver should use to make a database connection to a live data source. Returns A connection string that corresponds to the named connection. Example The code var connectionString = MMDB.getConnectionString ("EmpDB")
Page 57
var DEFAULT DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver"; var DEFAULT TEMPLATE = "jdbc:db2:[database name]"; Dreamweaver has a dialog box for each driver/URL template pair. In summary, Dreamweaver UltraDev 4 developers need to add a new entry to the XML, and Dreamweaver MX (or later), developers need to implement a new dialog box.
Page 58
DREAMWEAVER CS3 API Reference Example The statement might return MMDB.getPassword ("EmpDB"); "joessecret" MMDB.getRDSPassword() Availability Dreamweaver UltraDev 4. Description This function gets the Remote Development Services (RDS) password (for use with ColdFusion connections). Arguments None. Returns A string that contains the RDS password. MMDB.getRDSUserName() Availability Dreamweaver UltraDev 4.
Page 59
• The argument, which is optional, is a string that contains a list of urlParams separated by ampersand (&) characters. You must not enclose values with quotes. Some characters, such as the space in the value , need to be encoded. The following example shows a valid sample argument that Hello World you can pass to MMDB.getRemoteDsnList()
Page 60
MMDB.hasConnectionWithName() Availability Dreamweaver UltraDev 4. Description This function determines whether a connection of a given name exists. Arguments name • The argument is the connection name. name Returns Returns a Boolean value: indicates that a connection with the specified name exists; true MMDB.needToPromptForRdsInfo() Availability...
Page 61
MMDB.popupConnection() Availability Dreamweaver MX. Description This function starts a connection dialog box. This function has the following three signatures: • If the argument list consists only of weaver open the Connection dialog box so you can define a new connection. •...
Page 62
DREAMWEAVER CS3 API Reference Returns Nothing. MMDB.setRDSUserName() Availability Dreamweaver UltraDev 4. Description This function sets the RDS user name. Arguments username • The username argument is a valid RDS user name. Returns Nothing. MMDB.showColdFusionAdmin() Availability Dreamweaver MX. Description This function displays the ColdFusion Administrator dialog box. Arguments None.
Page 63
MMDB.showOdbcDialog() Availability Dreamweaver UltraDev 4 (Windows only). 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.
Returns An object that contains the new values in the indicates that the user cancelled the dialog box. MMDB.testConnection() Availability Dreamweaver UltraDev 4. Description This function tests connection settings. It displays a modal dialog box that describes the results. Arguments serverPropertiesArray This function expects a single argument, an array object that contains values from the following list, which are appro- priate for the current server model.
Page 65
• Stored procedures often require parameters. There are two ways of specifying parameter values for database access functions. First, you can provide an array of parameter values ( parameter values, the values need to be in the sequence in which the stored procedure requires the parameters. Second, you specify parameter values to provide an array of parameter names ( MMDB.getSPParamsAsString() parameter names, the values that you specify in...
Page 66
• The argument is the SQL statement Returns An array of strings that represents a list of columns that match the is invalid or the connection cannot be made. Example The code var columnArray = MMDB.getColumnList("EmpDB","Select * from Employees") following array of strings: columnArray[0] = "EmpName"...
Page 67
for (i = 0; i < columnNameObjs.length; i++) var columnObj = columnNameObjs[i]; var columnName = columnObj.name; var typename = columnObj.datatype; if (dwscripts.isNumber(typename)) // it already is a num typename = dwscripts.getDBColumnTypeAsString(typename, databaseType); var tooltiptext = typename; MMDB.getColumnsOfTable() Availability Dreamweaver UltraDev 1. Description This function gets a list of all the columns in the specified table.
Page 68
• The argument is the name of the table for which you want to retrieve the set of columns that comprises tableName the primary key of that table. Returns An array of strings. The array contains one string for each column that comprises the primary key. Example The following example returns the primary key for the specified table.
Page 69
Example The following code gets a list of procedures: var procObjects = MMDB.getProcedures(connectionName); for (i = 0; i < procObjects.length; i++) var thisProcedure = procObjects[i] thisSchema =Trim(thisProcedure.schema) if (thisSchema.length == 0) thisSchema = Trim(thisProcedure.catalog) if (thisSchema.length > 0) thisSchema += "." var procName = String(thisSchema + thisProcedure.procedure);...
Page 70
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 • The argument is a connection name that is specified in the Connection Manager. It identifies connName the connection string that Dreamweaver should use to make a database connection to a live data source.
Page 71
• The argument is a connection name that is specified in the Connection Manager. It identifies the connName connection string that Dreamweaver should use to make a database connection to a live data source. • The argument is the name of the procedure. procName Returns An array of parameter objects, each specifying the following set of properties:...
Page 72
Returns A comma-delimited string that contains the list of parameters that the stored procedure requires. The parameters’ names, direction, and data type are included, separated by semicolons (;). Example The code MMDB.getSPParamsAsString ("EmpDB","getNewEmployeesMakingAtLeast") form name startDate;direction:in;datatype:date, salary;direction:in;datatype:integer In this example, the stored procedure, .
Page 73
• The argument is a connection name that is specified in the Connection Manager. It identifies connName the connection string that Dreamweaver should use to make a database connection to a live data source. Returns An array of view objects where each object has three properties: to restrict or filter the number of views that pertain to an individual schema name or catalog name that is schema defined as part of the connection information.
Page 74
MMDB.showSPResultset() Availability Dreamweaver UltraDev 1. Description This function displays a dialog box that contains the results of executing 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.
Page 75
DREAMWEAVER CS3 API Reference • The argument is an array that contains a list of design-time parameter test values. paramValuesArray Returns This function returns an error if the SQL statement or the connection string is invalid; otherwise, it returns nothing. Example The following code displays the results of the executed stored procedure: var paramNameArray = new Array("startDate", "salary")
As a developer, you can create new connection types and corresponding dialog boxes for new or existing server models for Adobe® Dreamweaver® CS3. 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 77
For example, the default ADO connection dialog box for an ASP JavaScript document on a Windows platform is stored in the ASP_Js/Win folder and is named Connection_ado_conn_string.htm. Note: At runtime, 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.
The Connection API To create a new type of connection, including the dialog box with which users interact, you must implement the following three functions: findConnection() three functions and include them in the JavaScript implementation file that is associated with your new connection type (see Step 2 “Create a JavaScript file that implements at least the following elements:”...
Page 79
Property Description Name of the connection name useHTTP type at runtime Runtime connection string. For ADO, it is a string of connection parameters; for string JDBC, it is a connection URL Data source name used for ODBC or Cold Fusion runtime connections Name of a JDBC driver used at runtime driver Name of the user for the runtime connection...
DREAMWEAVER CS3 API Reference 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 infor- mation. Argument parameters argument is the same object that the...
Page 81
ASP JavaScript The ASP and JavaScript include file should be named MyConnection1.asp, where MyConnection1 is the name of the connection. The following sample is an include file for an ADO connection string: <% // Filename="Connection // Type="ADO" // HTTP="true" // Catalog="" // Schema=""...
<% // Filename="Connection_jdbc_conn1.htm" // Type="JDBC" // HTTP="false" // Catalog="" // Schema="" String MM_MyConnection1_DRIVER String MM_MyConnection1_USERNAME String MM_MyConnection1_PASSWORD String MM_MyConnection1_URL %> The server behavior file includes this connection by using the relative file include statement, as shown in the following example: <%@ include file="Connections/MyConnection1.jsp"...
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 Adobe® Dreamweaver® CS3 access your JavaBeans, the JavaBeans must reside in the Configuration/Classes folder.
Page 85
MMJB.getClassesFromPackage() Availability Dreamweaver UltraDev 4. Description This function reads all the JavaBeans classes from the package. Arguments packageName.pathName • The argument is the path to the package. It must be a Java JAR or ZIP Java archive (for packageName.pathName example, C:/jdbcdrivers/Una2000_Enterprise.zip) Returns A string array of class names inside the particular JAR or ZIP Java archive;...
Page 86
MMJB.getIndexedProperties() Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Introspects the JavaBeans class and returns its indexed properties, which are design patterns that behave the same way as collections. Arguments packageName.className, {packagePath} • The argument is the name of the class. The class must reside in a JAR or ZIP Java packageName.className archive.
Page 87
Arguments packageName.className, {packagePath} • The argument is the name of the class. The class must reside in a JAR or ZIP Java packageName.className archive. If is omitted, the archive must reside in your system packagePath installed in the Configuration/Classes folder. •...
Page 88
DREAMWEAVER CS3 API Reference Returns A string array of write-only properties associated with ; an error returns an empty array. className...
Chapter 10: The source control integration API The source control integration API lets you write shared libraries to extend the Adobe® Dream- weaver® CS3 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 ( , and Checkout() Undocheckout() boxes that gather information or letting the user interact with the DLL. The DLL also displays information or error messages.
Page 91
• The argument is the name of the source control system. The name appears in the combo box for selecting name a source control system on the Source Control tab in the Edit Sites dialog box. The name can be a maximum of 32 characters.
Page 92
bool SCS_IsConnected() Description This function determines the state of the connection. Arguments void *connectionData • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() Returns A Boolean value: if successful; true int SCS_GetRootFolderLength() Description This function returns the length of the name of the root folder.
Page 93
int SCS_GetFolderListLength() Description This function returns the number of items in the passed-in folder. Arguments void *connectionData, const char *remotePath • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() • The argument is the full path and name of the remote folder that the DLL checks for the number of remotePath items.
Page 94
Returns A Boolean value: if successful; true bool SCS_Get() Description This function gets a list of files or folders and stores them locally. Arguments void *connectionData, const char *remotePathList[], const char *localPathList[], const int numItems • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call.
Page 95
• The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() • The argument is the full path of the remote folder that the DLL creates. remotePath Returns A Boolean value: if successful; true bool SCS_Delete() Description...
bool SCS_ItemExists() Description This function determines whether a file or folder exists on the server. Arguments void *connectionData, const char *remotePath • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() •...
Page 97
Returns A Boolean value: if successful; true bool SCS_SiteRenamed() Description This function notifies the DLL when the user has renamed the site so that it can update its persistent information about the site. Arguments const char oldSiteName[64], const char newSiteName[64] •...
Page 98
• The argument is populated by the DLL; it specifies the routines in the DLL to call when Dream- enablerList weaver needs to determine whether the corresponding menu item is enabled. • The argument is the number of items being added by the DLL; this value is retrieved from the numNewFeatures call.
Page 99
• The argument is a list of Boolean values that are populated by the DLL to let Dreamweaver know successList which of the corresponding files are checked in successfully. • The argument is the number of items in each list. numItems Returns A Boolean value:...
Page 100
• The argument is a list of Boolean values that are populated by the DLL to let Dreamweaver know successList which corresponding files’ check outs are undone successfully. • The argument is the number of items in each list. numItems Returns A Boolean value: if successful;...
Page 101
int SCS_GetErrorMessageLength() Description This function returns the length of the DLL’s current internal error message. This allocates the buffer that passes into function. This function should be called only if an API function returns GetErrorMessage() which indicates a failure of that API function. Arguments void *connectionData •...
Page 102
Returns An integer that indicates the number of Design Notes that are associated with this file. If the function returns Dreamweaver considers it an error and tries to retrieve the error message from the DLL, if supported. int SCS_GetMaxNoteLength() Description This function returns the length of the largest Design Note for the specified file or folder.
Page 103
bool SCS_SetDesignNotes() Description This function stores the key-value pairs in the meta information for the specified file or folder. This replaces the set of meta information for the file. If it is unsupported by the source control system, Dreamweaver stores Design Notes in MNO files.
Returns A Boolean value: if successful; true 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.
Page 105
• The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() • The argument is a list of remote filenames or folder paths to check out. remotePathList • The argument is a mirrored list of local filenames or folder paths. localPathList •...
Page 106
bool SCS_CanUndoCheckout() Description This function returns whether the Undo Checkout menu item should be enabled. Arguments void *connectionData, const char *remotePathList[], const char *localPathList[], const int numItems • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call.
Page 107
Returns A Boolean value: if successful; true bool SCS_canRename() Description This function returns whether the Rename menu item should be enabled. Arguments void *connectionData, const char *remotePath • The argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call.
Page 108
• The * argument is a pointer to the agent’s data that passed into Dreamweaver during the connectionData call. Connect() Returns A Boolean value: if successful; true Example To get a group of files, Dreamweaver makes calls to the DLL in the following order: SCS_BeforePut(connectionData);...
• “Bridge communication functions” on page 117 External application functions External application functions handle operations that are related to applications, such as Adobe® Flash®, and to the browsers and external editors that are defined in the Preview in Browser and External Editors preferences.
Page 110
Note: Some browsers cannot locate the file if the URL contains an anchor, such as "Configuration/Exten- sionHelp/browseHelp.htm#helpyou". • The argument, which was added in Dreamweaver 3, specifies a browser. This argument can be the name browser of a browser, as defined in the Preview in Browser preferences or either argument is omitted, the URL opens in the user’s primary browser.
Page 111
Preferences, the function returns an array that contains one empty string. Example A call to the dreamweaver.getExtensionEditorList(".gif") following strings: • "Fireworks 3" • "file:///C|/Program Files/Adobe/Fireworks 3/Fireworks 3.exe" dreamweaver.getExternalTextEditor() Availability Dreamweaver 4. Description Gets the name of the currently configured external text editor. Arguments None.
Page 112
Returns An array that contains two elements. Element [0] is a string that contains the name of the Flash MX editor. Element [1] is a string that contains the path to the Flash application on the local computer, which is expressed as a file:// URL. If Flash is not installed, it returns nothing.
Page 113
dreamweaver.getSecondaryBrowser() Availability Dreamweaver 3. Description Gets the path to the secondary browser. Arguments None. 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.
Page 114
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. The helpDoc.js file maps a help content ID to an HTML page in a specific help book.
Page 115
Opens the named file with the specified image editor. Note: This function starts a special Adobe 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, never call this function from the Site panel.
Page 116
DREAMWEAVER CS3 API Reference Arguments None. Returns A Boolean value: if Flash MX (or a later version) is installed on the local computer; otherwise. true false dom.insertFiles() Availability Dreamweaver CS3. Description Inserts one or more files into the current document at the current insertion point or in place of the current selection, prompting the user for parameters, if necessary.
is a string that specifies the name of the file to print, expressed as a URL. fileName Returns Nothing dreamweaver.revealDocument() Availability Dreamweaver CS3. Description Gives Dreamweaver the operating-system focus and, if the specified file is open in Dreamweaver, brings it to the foreground.
Page 118
beep(){ if(confirm(“Is your order complete?”) dreamweaver.beep(); alert(“Click OK to submit your order”); dreamweaver.getShowDialogsOnInsert() Availability Dreamweaver 3. Description Checks whether the Show Dialog When Inserting Objects option is turned on in the General category of Preferences. Arguments None. Returns A Boolean value that indicates whether the option is on. dreamweaver.quitApplication() Availability Dreamweaver 3.
Page 119
dreamweaver.showDynamicDataDialog() Availability Dreamweaver UltraDev 1. 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 showDynamicDataDialog() string returns from the Data Sources API function, API function, formatDynamicDataRef() function returns.)
Page 120
dreamweaver.showPreferencesDialog() Availability Dreamweaver 3. Added the strCategory Description This function opens the Preferences dialog box. Arguments {strCategory} • The argument, which is optional, must be one of the following strings to open the correlating strCategory category of the Preferences dialog box: category), (for the Code Format category), "html format"...
Page 121
Description This function registers a JavaScript function to be called on a periodic basis during idle processing time. Arguments idleFunction interval • - a unique string used to identify the idle task to register. To ensure uniqueness, prefix the ID with a unique identifier.
DREAMWEAVER CS3 API Reference Bridge communication functions The bridge communication functions allow communication between Dreamweaver and the Bridge application. One feature of this communication is to allow the user to browse files in Bridge easily from Dreamweaver. BridgeTalk.bringToFront() Availability Dreamweaver CS3. Description Makes the specified application the frontmost process, by calling the function.
Page 123
DREAMWEAVER CS3 API Reference Arguments: timeout This optional attribute sets the time out interval in seconds. Returns A Boolean value indicating whether communication with the Bridge application was a success ( = success, True = fail). False Example result = bridgeTalk.send(10); BridgeTalk.suppressStartupScreen() Availability Dreamweaver CS3.
Chapter 12: Workspace Workspace API functions create or operate on an element of the Adobe® Dreamweaver® CS3 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 125
DREAMWEAVER CS3 API Reference dom.redo() Availability Dreamweaver 3. Description Redoes the step that was most recently undone in the document. Arguments None. Returns Nothing. Enabler See “dom.canRedo()” on page 442. dom.undo() Availability Dreamweaver 3. Description Undoes the previous step in the document. Arguments None.
Page 126
DREAMWEAVER CS3 API Reference Example If the user’s last action applied bold to selected text, a call to the function returns dreamweaver.getRedoText() "Repeat Apply Bold" 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).
Page 127
Arguments None. Returns Nothing. Enabler See “dreamweaver.canRedo()” on page 449. dreamweaver.startRecording() Availability Dreamweaver 3. Description Starts recording steps in the active document; the previously recorded command is immediately discarded. Arguments None. Returns Nothing. Enabler See “dreamweaver.isRecording()” on page 456 (must return a value of dreamweaver.stopRecording() Availability Dreamweaver 3.
Page 128
DREAMWEAVER CS3 API Reference Description Undoes the previous step in the Document window, dialog box, floating panel, or Site panel that has focus. Arguments None. Returns Nothing. Enabler See “dom.canUndo()” on page 444 dreamweaver.historyPalette.clearSteps() Availability Dreamweaver 3. Description Clears all steps from the History panel and disables the Undo and Redo menu items. Arguments None.
Page 129
DREAMWEAVER CS3 API Reference dreamweaver.historyPalette.getSelectedSteps() Availability Dreamweaver 3. Description Determines which portion of the History panel is selected. Arguments None. 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 function returns...
Page 130
DREAMWEAVER CS3 API Reference Arguments arrayOfIndices • The 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 the dream- function weaver.historyPalette.getStepsAsJavaScript(dw.historyPalette.getSelectedSteps())
Page 131
• The 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 A call to dreamweaver.historyPalette.replaySteps([0,2,3]) in the History panel. dreamweaver.historyPalette.saveAsCommand() Availability Dreamweaver 3. Description Opens the Save As Command dialog box, which lets the user save the specified steps as a command.
dreamweaver.historyPalette.setSelectedSteps([0,1,2]); dreamweaver.historyPalette.setUndoState() Availability Dreamweaver 3. Description Performs the correct number of undo or redo operations to arrive at the specified undo state. Arguments undoState • The argument is the object that the undoState returns. 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.
Page 133
dreamweaver.objectPalette.getMenuDefault() Availability Dreamweaver MX 2004. Description Retrieves the ID string of the default item for the associated menu. Arguments menuId • The 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 var defId = dw.objectPalette.getMenuDefault("DW_Media");...
Page 134
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. Returns A Boolean value: if the objects were successfully loaded; true dom.convertActiveContent() Availability...
Example dom.convertNextActiveContent(); dom.insertHTML("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\ "http://download.Macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100\" height=\"22\"><param name=\"movie\" value=\"button1.swf\" /><param name=\ "quality\" value=\"high\" /><embed src=\"button1.swf\" quality=\"high\" pluginspage=\ "http://www.Macromedia.com/go/getflashplayer\" type=\"application/ x-shockwave-flash\"width=\"100\" height=\"22\"></embed></object>\"); Keyboard functions Keyboard functions mimic document navigation tasks that are accomplished by pressing the arrow, Backspace, Delete, Page Up, and Page Down keys. In addition to such general arrow and key functions as , Dreamweaver also provides methods for moving to the next or previous word or paragraph as backspaceKey() well as moving to the start of the line or document or the end of the line or document.
Page 136
• The argument, which is optional, is a Boolean value that indicates whether to extend the selection. bShiftIsDown If this argument is omitted, the default is Returns Nothing. dom.arrowRight() Availability Dreamweaver 3. Description Moves the insertion point to the right the specified number of times. Arguments {nTimes}, {bShiftIsDown} •...
Page 137
Description This function is equivalent to pressing the Backspace key a specified number of times. The exact behavior depends on whether there is a current selection or only an insertion point. Arguments {nTimes} • The argument, which is optional, is the number of times that a Backspace operation must occur. If the nTimes argument is omitted, the default is 1.
Page 138
dom.endOfLine() Availability Dreamweaver 3. Description Moves the insertion point to the end of the line. Arguments {bShiftIsDown} • The argument, which is optional, is a Boolean value that indicates whether to extend the selection. bShiftIsDown If the argument is omitted, the default is Returns Nothing.
Page 139
• The argument, which is optional, is a Boolean value that indicates whether to extend the selection. bShiftIsDown If this argument is omitted, the default is Returns Nothing. dom.pageDown() Availability Dreamweaver 3. Description Moves the insertion point down one page (equivalent to pressing the Page Down key). Arguments {nTimes}, {bShiftIsDown} •...
Page 140
Description Moves the insertion point to the beginning of the previous paragraph or skips multiple paragraphs if greater than 1. Arguments {nTimes}, {bShiftIsDown} • The argument, which is optional, is the number of paragraphs that the insertion point must move back. nTimes If this argument is omitted, the default is 1.
Returns Nothing. dom.startOfLine() Availability Dreamweaver 3. Description Moves the insertion point to the beginning of the line. Arguments {bShiftIsDown} • The argument, which is optional, is a Boolean value that indicates whether to extend the selection. bShiftIsDown If the argument is omitted, the default is Returns Nothing.
Page 142
dreamweaver.getMenuNeedsUpdating() Availability Dreamweaver 3. Description Checks whether the specified menu needs to be updated. Arguments menuId • The argument is a string that contains the value of the menuId menus.xml file. Returns A Boolean value that indicates whether the menu needs to be updated. This function returns has been called with this weaver.notifyMenuUpdated() not changed.
Arguments None. Returns Nothing. Results window functions Results window functions let you interact with the built-in panels in the Results panel group or create a stand-alone window that displays columns of formatted data. Working with the built-in Results panel group These functions produce output in the Results panel group.
Page 144
Arguments floaterName, floaterIndex • The argument is a string that specifies the results floating panel to open. Valid values are floaterName , or validation' 'reports' • The argument is a number or string. Use a number to specify the index of an item to select in the floaterIndex Results panel.
Page 145
• The argument is the description that goes with the entry. strDesc • The argument is the number of lines in the file (optional). iLineNo • The argument is the start of offset into the file (optional, but if it is used, the iStartSel also be used.).
Page 146
DREAMWEAVER CS3 API Reference Description Sends a cut message to the window in focus (often used for the FTP logging window). Arguments None. Returns Nothing. Enabler See “dreamweaver.resultsPalette.canCut()” on page 457. 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.
Page 147
DREAMWEAVER CS3 API Reference 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 See “dreamweaver.resultsPalette.canOpenInEditor()” on page 458. dreamweaver.resultsPalette.save() Availability Dreamweaver MX.
Enabler See “dreamweaver.resultsPalette.canSelectAll()” on page 459. Creating a stand-alone results window dreamweaver.createResultsWindow() dreamweaver.createResultsWindow() Availability Dreamweaver 4. Description Creates a new Results window and returns a JavaScript object reference to the window. Arguments strName, arrColumns • The argument is the string to use for the window’s title. strName •...
Page 149
• The argument is a string you can use to store specific data about the item being added such as a itemData document line number. • The argument is the start of selection offset in the file. Specify the value iStartSel an offset.
Page 150
Returns The number of items in the list. resWin.getSelectedItem() Availability Dreamweaver 4. Description Retrieves the index of the selected item. Arguments None. Returns The index of the currently selected item. resWin.setButtons() Availability Dreamweaver 4. Description Sets the buttons specified by the arrButtons Arguments cmdDoc, arrButtons...
Page 151
• The argument is an array of command names on which to call the arrCmdNames Returns Nothing. resWin.setColumnWidths() Availability Dreamweaver 4. Description Sets the width of each column. Arguments arrWidth • The argument is an array of integers that represents the widths to use for each column in the control. arrWidth Returns Nothing.
Page 152
• The index of the item in the list to select. Returns The index of the previously selected item resWin.setTitle() Availability Dreamweaver 4. Description Sets the title of the window. Arguments strTitle • The argument is the new name of the floating panel. strTitle Returns Nothing.
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. If Dreamweaver finds XML with that signature, it processes the XML and displays the contained infor- mation in a tree control.
path line number start position end position 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>...
Page 155
Arguments None. Returns A Boolean value: indicates the true NOFRAMES 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; true dom.getPreventLayerOverlaps() Availability Dreamweaver 3.
Page 156
dom.getShowFrameBorders() Availability Dreamweaver 3. Description This function gets the current state of the View > Frame Borders option. Arguments None. Returns A Boolean value: indicates frame borders are visible; true dom.getShowGrid() Availability Dreamweaver 3. Description This function gets the current state of the View > Grid > Show option. Arguments None.
Page 157
Description This function determines whether invalid HTML code is currently highlighted in the Code view of the document window. Arguments None. Returns A Boolean value: if invalid HTML code is highlighted; true dom.getShowImageMaps() Availability Dreamweaver 3. Description This function gets the current state of the View > Image Maps option. Arguments None.
Page 158
Returns A Boolean value: indicates the layer borders are visible; true dom.getShowLineNumbers() Availability Dreamweaver 4. 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; true dom.getShowRulers() Availability...
Page 159
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; true dom.getShowToolbar() Availability Dreamweaver 4. Description This function determines whether the toolbar appears. Arguments None.
Page 160
Arguments None. Returns A Boolean value: if word wrap is on; true dom.getSnapToGrid() Availability Dreamweaver 3. Description This function gets the current state of the View > Grid > Snap To option. Arguments None. Returns A Boolean value: indicates that the snap-to-grid option is on; true dom.setEditNoFramesContent() Availability...
Page 161
Arguments bSet • The argument is a Boolean value: bSet Returns Nothing. dom.setPreventLayerOverlaps() Availability Dreamweaver 3. Description This function toggles the Prevent Layer Overlaps option on and off. Arguments bPreventLayerOverlaps • The argument is a Boolean value: bPreventLayerOverlaps turns it off. false Returns Nothing.
Page 162
Arguments bShowGrid • The argument is a Boolean value: bShowGrid Returns Nothing. dom.setShowHeadView() Availability Dreamweaver 3. Description This function toggles the View > Head Content option on and off. Arguments bShowHead • The argument is a Boolean value: bShowHead Returns Nothing.
Page 163
Arguments bShowImageMaps • The argument is a Boolean value, bShowImageMaps Returns Nothing. dom.setShowInvisibleElements() Availability Dreamweaver 3. Description This function toggles the View > Invisible Elements option on and off. Arguments bViewInvisibleElements • The argument is a Boolean value: bViewInvisibleElements turns it off. Returns Nothing.
Page 164
Arguments bShow • The argument is a Boolean value: bShow Returns Nothing. dom.setShowRulers() Availability Dreamweaver 3. Description This function toggles the View >Rulers > Show option on and off. Arguments bShowRulers • The argument is a Boolean value: bShowRulers Returns Nothing.
Page 165
• The argument is a Boolean value: bShowTableBorders off. Returns Nothing. dom.setShowToolbar() Availability Dreamweaver 4. Description This function shows or hides the Toolbar. Arguments bShow • The argument is a Boolean value: bShow Returns Nothing. dom.setShowTracingImage() Availability Dreamweaver 3. Description This function toggles the View >...
Page 166
DREAMWEAVER CS3 API Reference Returns Nothing. dom.setSnapToGrid() Availability Dreamweaver 3. Description This function toggles the View > Grid > Snap To option on or off. Arguments bSnapToGrid • The argument is a Boolean value: turns on the Snap To option; turns it off.
Page 167
dreamweaver.htmlInspector.getShowAutoIndent() Availability Dreamweaver 4. Description This function determines whether the Auto Indent option is on in the Code inspector. Arguments None. Returns A Boolean value: if auto-indenting is on; true dreamweaver.htmlInspector.getShowInvalidHTML() Availability Dreamweaver 4. Description This function determines whether invalid HTML code is currently highlighted in the Code inspector. Arguments None.
Page 168
Arguments None. Returns A Boolean value: if syntax coloring is on; true dreamweaver.htmlInspector.getShowWordWrap() Availability Dreamweaver 4. Description This function determines whether the Word Wrap is on in the Code inspector. Arguments None. Returns A Boolean value: if word wrap is on; true dreamweaver.htmlInspector.setShowAutoIndent() Availability...
Page 169
Returns Nothing. 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 • The argument is a Boolean value: bShow Returns Nothing. dreamweaver.htmlInspector.setShowSyntaxColoring() Availability Dreamweaver 4. Description This function turns syntax coloring on or off in the Code view of the Code inspector.
Page 170
Returns Nothing. dreamweaver.setHideAllFloaters() Availability Dreamweaver 3. Description This function sets either the Hide Panels option or the Show Panels option. Arguments bShowFloatingPalettes • The argument is a Boolean value: bShowFloatingPalettes on the Show Panels option. Returns Nothing. dreamweaver.setShowStatusBar() Availability Dreamweaver 3. Description This function toggles the View >...
Page 171
site.getShowHiddenFiles() Availability Dreamweaver 3. Description This function gets the current state of the Show Files Marked as Hidden option. Arguments None. Returns A Boolean value: indicates that hidden files are visible in the site map; true site.getShowPageTitles() Availability Dreamweaver 3. Description This function gets the current state of the Show Page Titles option.
Page 172
Arguments bShowDependentFiles • The argument is a Boolean value: bShowDependentFiles turns it off. 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 • The argument is a Boolean value: bShowHiddenFiles turns it off.
Description This function toggles the Tool Tips option on or off. Arguments bShowToolTips • The argument is a Boolean value: bShowToolTips Returns Nothing. Toolbar functions The following JavaScript functions let you get and set the visibility of toolbars and toolbar labels, obtain the labels of toolbar items in the current window, position toolbars, and obtain toolbar IDs.
Page 174
Example The following example makes labels for buttons visible: var dom = dw.getDocumentDom(); if (dom.getShowToolbarIconLabels() == false) dom.setShowToolbarIconLabels(true); dom.getToolbarIdArray() Availability Dreamweaver MX. Description This function returns an array of the IDs of all the toolbars in the application. You can use to turn off all toolbars so you can reposition them and make only a specific set visible.
Page 175
Example The following example of receiveArguments() field; it gets the value of the Size field as an argument and then reads the value of the Units field in order to produce a valid value for the CSS property font-size receiveArguments(newSize){ var dom = dw.getDocumentDOM();...
Page 176
Returns A Boolean value: if the toolbar is visible, true Example The following example checks whether the toolbar 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. Arguments toolbarID, toolbarItemId, attrName, attrValue •...
Page 177
Arguments bShow • The argument is a Boolean value: bShow Returns Nothing. Example The following example tells Dreamweaver to show the labels for the buttons on the toolbars: dom.setShowToolbarIconLabels(true); dom.setToolbarPosition() Availability Dreamweaver MX. Description This function moves the specified toolbar to the specified position. Note: There is no way to determine the current position of a toolbar.
Description This function shows or hides the specified toolbar. Arguments toolbar_id, bShow • The argument is the ID of the toolbar, the value of the ID attribute on the toolbar tag in the toolbar_id toolbars.xml file. • The argument is a Boolean value that indicates whether to show or hide the toolbar. If bShow dom.setToolbarVisibility() makes the toolbar invisible.
Page 179
• The string if the "body" BODY NOFRAMES • The string if a frameset or any of its frames is selected "frameset" • The string if the focus is not in the document (for example, if it’s in the Property inspector or another "none"...
Page 180
DREAMWEAVER CS3 API Reference 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 floaterName •...
Page 181
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. dreamweaver.getDocumentList() Availability Dreamweaver 3.
Page 183
• The string if the Site panel is in focus "site" • The string if the Text view is in focus "textView" • The string if the Code inspector is in focus "html" • The string, if floaterName bAllowFloaters "objects" "properties"...
Page 184
• The argument is a Boolean value: bMinimize windows should be restored. Returns Nothing. dreamweaver.setActiveWindow() Availability Dreamweaver 3. Description This function activates the window that contains the specified document. Arguments documentObject, {bActivateFrame} • The argument is the object at the root of a document’s DOM tree (the value that the documentObject function returns).
Page 186
• The argument is the view to display at the top of the document window; it can be one of the following viewString values: "design" "code" Returns Nothing. dreamweaver.setSnapDistance() Availability Dreamweaver 4. Description This function sets the snapping distance in pixels. Arguments snapDistance •...
Page 187
Returns Nothing. 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.
dreamweaver.updateReference() Availability Dreamweaver 4. Description This function updates the Reference floating panel. If the Reference floating panel is not visible, makes it visible and then updates it. erence() Arguments None. Returns Nothing. Code collapse functions Code collapse functions let you visually collapse and expand code. You can collapse or expand arbitrary selections of code, or fragments between opening and closing tags.
Page 189
dom.collapseFullTagInverse() Availability Dreamweaver 8. 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 that precedes the start tag and the code that follows the end tag;...
Page 190
dom.collapseSelectedCodeFragmentInverse() Availability Dreamweaver 8. Description This function collapses all code before and after the selected code in Code view. Arguments allowAdjustmentOfCodeFragments • The allowAdjustmentOfCodeFragments the boundaries of the code before and after the current selection to perform a smart collapse, which preserves the current indenting and spacing.
Page 191
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 192
Arguments allowAdjustmentOfCodeFragments • The allowAdjustmentOfCodeFragments the boundaries of the code before the start tag and of the code after the end tag to perform a smart collapse, which preserves the existing indenting and spacing. If the code after the end tag, without any modifications. Returns Nothing.
Page 193
Arguments allowAdjustmentOfCodeFragments • The allowAdjustmentOfCodeFragments the boundaries of the code sections before and after the current selection to perform a smart collapse, which preserves the current indenting and spacing. If indicated by the selection. Returns Nothing. 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 CS3 API Reference 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.
Page 195
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(); if (currentDOM.getShowHiddenCharacters()){ currentDOM.setShowHiddenCharacters(false); dom.setShowHiddenCharacters() Availability Dreamweaver 8. Description This function shows or hides the special characters for white spaces in the Code view of the Code inspector. See “dom.getShowHiddenCharacters()”...
Page 196
Example The following example makes the current selection an HTML comment: dw.getDocumentDOM().source.applyComment('<!--', '-->') dom.source.refreshVariableCodeHints() Availability Dreamweaver CS3. Description Rescans the page looking for variables and corresponding class associations. This function rebuilds the color state engine and the variable list. Arguments bSyncDoc •...
Page 197
Example The following example removes an HTML comment: dw.getDocumentDOM().source.removeComment('<!--', '-->') dreamweaver.htmlInspector.getShowHiddenCharacters() Availability Dreamweaver 8. Description This function determines whether the special characters for white spaces are displayed in the Code view of the Code inspector. Arguments None. Returns A Boolean: if the hidden characters are displayed;...
Chapter 13: Site The Adobe® Dreamweaver® CS3 site functions perform operations related to managing a website. These operations include customizing a report, defining a new site, checking in and checking out files, running validation on a site and so on.
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: •...
Page 200
dom.localPathToSiteRelative() Availability Dreamweaver 8. Description This function converts a local file path to a site-relative URI reference. Arguments localFilePath • The attribute, which is required, is a string that contains the path to a local file on your local localFilePath computer.
Page 201
Description This function launches the file comparison tool that the user installed in the Diff section of the Preferences dialog box. Arguments file1, file2 • The attribute, which is required, is a string that contains the full path to the first file to compare. file1 •...
Page 202
DREAMWEAVER CS3 API Reference dreamweaver.siteSyncDialog.compare() Availability Dreamweaver 8. Description This function runs the file compare application specified in the File Compare Category of the Preferences dialog box to compare the selected files on the local and remote sites. Arguments None. Returns Nothing.
Page 203
DREAMWEAVER CS3 API Reference Enabler See “dreamweaver.siteSyncDialog.canMarkGet()” on page 459. 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 See “dreamweaver.siteSyncDialog.canMarkIgnore()” on page 460. dreamweaver.siteSyncDialog.markPut() Availability Dreamweaver 8.
Page 204
DREAMWEAVER CS3 API Reference Returns Nothing. Enabler See “dreamweaver.siteSyncDialog.canMarkSynced()” on page 460. 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. If the function is called when the Show All Files checkbox is selected, it deselects it; conversely, if the Show all Files checkbox is not selected, this function selects it.
Page 205
DREAMWEAVER CS3 API Reference Arguments None. Returns Nothing. Enabler See “site.canAddLink()” on page 462. 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 206
• 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. • If the user previously selected the Don’t Show Me Again option in the Dependent Files dialog box and clicked No, dependent files are not uploaded and no dialog box appears.
Page 207
Arguments siteOrURL • The argument must be the keyword siteOrURL selection in the Site panel or the URL for a single file. Returns Nothing. Enabler See “site.canCheckOut()” on page 463. site.checkTargetBrowsers() Availability Dreamweaver 3. Description Runs a target browser check on the selected files. Arguments None.
Page 208
site.compareFiles() Availability Dreamweaver 8. Description This function launches the Diff tool integration application to compare two files. Arguments argument, which is required, must contain one of the following two values: • The keyword , which indicates that "site" • The URL of a local file to compare with its remote version. Returns A Boolean value: if the compare succeeded;...
Page 209
Arguments None. Returns Nothing. 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 starts the Deploy Supporting Files To Testing Server dialog box. Arguments filesToDeploy •...
Page 210
If the file does not contain any information for the file, a message appears indicating that no infor- dwsync.xml mation is available. If the time is set in the xml file, it is displayed in the date/time format for the locale (such as: 6/24/05 2:43pm).
Page 212
urlprefix="http://dreamweaver/kojak/" serverscripting="CFML" serverpageext="" connectionsmigrated="TRUE" useUD4andUD5pages="TRUE" defaultdoctype="" accesstype="ftp" host="dreamweaver" remoteroot="kojak/" user="dream" usefirewall="FALSE" usepasv="TRUE" /> <cloaking enabled="TRUE" patterns="TRUE"> <cloakedfolder folder="databases/" /> <cloakedpattern pattern=".png" /> <cloakedpattern pattern=".jpg" /> <cloakedpattern pattern=".jpeg" /> </cloaking> </site> 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.
Page 213
Arguments siteOrURL • The argument must be the keyword siteOrURL selection in the Site panel or the URL for a single file. Returns Nothing. Enabler See “site.canGet()” on page 465. 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.
Page 214
DREAMWEAVER CS3 API Reference Arguments None. Returns If the access type to the application server file is , this function returns a path; otherwise, this local/network function returns an empty string. site.getAppURLPrefixForSite() Availability Dreamweaver MX. Description Gets the value of the URL prefix that is extracted from the HTTP address defined in the Local Info section of the site definition dialog.
Page 215
DREAMWEAVER CS3 API Reference site.getCheckOutUserForFile() Availability Dreamweaver 3. Description Gets the login and check-out name of the user who has the specified file checked out. Arguments fileName • The argument is the path to the file being queried, which is expressed as a file://URL. fileName Returns A string that contains the login and check-out name of the user who has the file checked out or an empty string if...
Page 216
Enabler See “site.canConnect()” on page 464. site.getCurrentSite() Availability Dreamweaver 3. Description Gets the current site. Arguments None. Returns A string that contains the name of the current site. Example If you defined several sites, a call to Current Sites List in the Site panel. site.getFocus() Availability Dreamweaver 3.
Page 217
DREAMWEAVER CS3 API Reference Arguments None. 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.
Page 218
DREAMWEAVER CS3 API Reference Arguments fileURL • The argument is the fully qualified URL (including the string " ) for a named file. fileURL file://" Returns A string that contains the name of the site, if any, in which the specified file exists. The string is empty when the specified file does not exist in any defined site.
Page 219
Description Creates a Dreamweaver site from an XML file. During import, if the folder that is specified by the attribute of the element does not exist on the local computer, Dreamweaver prompts for a different <localinfo> local root folder. Dreamweaver behaves the same way when it tries to locate the default images folder that is specified by the attribute of the imagefolder...
Page 220
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 • The argument must be either localOrRemote • The argument must be the keyword siteOrURL selection in the Site panel or the URL for a single file.
Page 221
DREAMWEAVER CS3 API Reference Returns Nothing. Enabler See “site.canMakeNewFileOrFolder()” on page 466. 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. Returns Nothing. Enabler See “site.canMakeNewFileOrFolder()”...
Page 222
Returns Nothing. site.open() Availability Dreamweaver 3. Description Opens the files that are currently selected in the Site panel. If any folders are selected, they are expanded in the Site Files view. Arguments None. Returns Nothing. Enabler See “site.canOpen()” on page 466. site.put() Availability Dreamweaver 3.
Page 223
DREAMWEAVER CS3 API Reference site.recreateCache() Availability Dreamweaver 3. Description Re-creates the cache for the current site. Arguments None. Returns Nothing. Enabler See “site.canRecreateCache()” on page 467. site.refresh() Availability Dreamweaver 3. Description Refreshes the file listing on the specified side of the Site panel. Arguments whichSide •...
Page 224
DREAMWEAVER CS3 API Reference 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. Description Removes the selected link from the document above it in the site map. Arguments None.
Page 225
Returns Nothing. site.saveAsImage() Availability Dreamweaver 3. Description Opens the Save As dialog box to let the user save the site map as an image. Arguments fileType • The argument is the type of image that should be saved. Valid values for Windows are fileType valid values for the Macintosh are the current platform, the default is...
Page 226
DREAMWEAVER CS3 API Reference site.selectNewer() Availability Dreamweaver 3. Description Selects all files that are newer on the specified side of the Site panel. Arguments whichSide • The argument must be either whichSide "local" "remote" Returns Nothing. Enabler See “site.canSelectNewer()” on page 469. site.serverActivity() Availability Dreamweaver 8.
Page 227
Arguments None. Returns Nothing. site.setCloakingEnabled() Availability Dreamweaver MX. Description Determines whether cloaking should be enabled for the current site. Arguments enable • The argument is a Boolean value that indicates whether cloaking should be enabled. A value of enable enables cloaking for the current site; a value of Returns None.
Page 228
• The argument is the name of a defined site (as it appears in the Current Sites list in the Site panel or whichSite the Edit Sites dialog box). Returns Nothing. Example If three sites are defined (for example, avocado8, dreamcentral, and testsite), a call to makes dreamcentral the current site.
Page 229
Description Shows or hides the current link. Arguments bShow • The argument is a Boolean value that indicates whether to remove the Hidden designation from the current bShow link. Returns Nothing. site.setSelection() Availability Dreamweaver 3. Description Selects files or folders in the active pane in the Site panel. Arguments arrayOfURLs •...
Page 230
returns "C:\Inetpub\wwwroot\siteA\myFile.xml" based on your site mappings and HTTP address specified in the Local info of the Site Definition dialog box. site.synchronize() Availability Dreamweaver 3. Description Opens the Synchronize Files dialog box. Arguments None. Returns Nothing. Enabler See “site.canSynchronize()” on page 469. site.uncloak() Availability Dreamweaver MX.
Page 231
DREAMWEAVER CS3 API Reference Description Uncloaks all folders in the current site and deselects the Cloak Files Ending With: checkbox in the Cloaking settings. Arguments None. Returns Nothing. Enabler See “site.canUncloak()” on page 469. 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.
Chapter 14: Document The Document functions in Adobe® Dreamweaver® CS3 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.
DREAMWEAVER CS3 API Reference dom.convertLayersToTable() Availability Dreamweaver 3. Description Opens the Convert Layers to Table dialog box. Arguments None. Returns Nothing. Enabler See “dom.canConvertLayersToTable()” on page 437. dom.convertTablesToLayers() Availability Dreamweaver 3. Description Opens the Convert Tables to Layers dialog box. Arguments None.
Page 234
Arguments None. Returns Nothing. dreamweaver.popupCommand() (deprecated) Availability Dreamweaver 2; deprecated in 3 in favor of 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.
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 function callFormatTable(){ dreamweaver.runCommand('Format Table.htm'); File manipulation functions File manipulation functions handle creating, opening, and saving documents (including XML and XHTML), converting existing HTML documents into XHTML, and exporting CSS to external files.
Page 236
Description Parses the HTML into a DOM tree, inserts missing items that are required for XHTML, cleans up the tree, and then writes the tree as clean XHTML. The missing directives, declarations, elements, and attributes that the function adds to the DOM tree, as necessary, include the following items: ToXHTML() •...
Page 237
Arguments None. Returns value if the document is XHTML; true 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}, {array- OfExtensions} •...
Page 238
• The argument is the label that should appear in the title bar of the dialog box. If it is omitted, the titleBarLabel argument defaults to Choose Folder. titleBarLabel • The argument is the path where the folder should open, which is expressed as a file:// URL. directoryToStartIn Returns A string that contains the name of the folder, which is expressed as a file:// URL.
Page 239
• The argument specifies the type of document to create, as declared in the Dreamweaver Configu- type ration/DocumentTypes/MMDocumentTypes.xml file as the argument could be type "HTML", "ASP-JS", "ASP-VB", "ColdFusion", "CFC", "JSP", , and so on. For a complete list of possible types, see the MMDocumentTypes.xml file. If you do "ASP.NET_VB"...
Page 240
• The argument is a Boolean value that indicates whether to open the new document in the bOpenInSameWindow current window. If this value is false opens in a separate window. Returns The document object for the newly created document, which is the same value that the function returns.
Page 241
DREAMWEAVER CS3 API Reference 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 242
• The argument must be sourceDoc "parent.frames['frameName']" a value. These argument values have the following meanings: • The value specifies the document that has focus and contains the current selection. document • The value specifies the parent frameset (if the currently selected document is in a frame). parent •...
Page 243
DREAMWEAVER CS3 API Reference Example The following code returns the DOM for a new, empty document: var theDOM = dreamweaver.getNewDocumentDOM(); 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.
Page 244
• The bopenWithCurSiteAndShowDialog to open a document with the current site and to cause the New Document dialog box to appear; Returns Nothing. dreamweaver.newFromTemplate() Availability Dreamweaver 3. Description Creates a new document from the specified template. If no argument is supplied, the Select Template dialog box appears.
Page 245
DREAMWEAVER CS3 API Reference dreamweaver.openDocumentFromSite() Availability Dreamweaver 3. 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 double-clicking a file in the Site panel. If the specified file is already open, the window that contains the document comes to the front.
Page 246
Documents that are referenced by the dreamweaver.getDocumentPath() when the script that 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. Note: This function is relevant only for documents that were referenced by a URL, are not currently open in a frame or document window, and are not extension files.
Page 247
Enabler See “dreamweaver.canSaveAll()” on page 450. dreamweaver.saveDocument() Availability Dreamweaver 2. Description Saves the specified file on a local computer. Note: In Dreamweaver 2, if the file is read-only, Dreamweaver tries to check it out. If the document is still read-only after this attempt, or if it cannot be created, an error message appears.
Page 248
dreamweaver.saveDocumentAsTemplate() Availability Dreamweaver 3. Description Opens the Save As Template dialog box. Arguments documentObject, {fileName} • The argument is the object at the root of a document’s DOM tree, which is the value that documentObject returns. weaver.getDocumentDOM() • The argument, which is optional, is the name of the file to open, expressed as an absolute URL. fileName Returns Nothing.
DREAMWEAVER CS3 API Reference Arguments documentObject • The argument is the object at the root of a document’s DOM tree, which is the value that the documentObject function returns. dreamweaver.getDocumentDOM() Returns Nothing. Enabler See “dreamweaver.canSaveFramesetAs()” on page 451. Global document functions Global document functions act on an entire document.
Page 250
DREAMWEAVER CS3 API Reference 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 251
• If the argument is an empty string, the Validator performs a default validation. If the argument is Validator validates the document as XML. • If the argument is "auto-explicit" (also known as an inline validation), which underlines errors in the Code view instead of opening the Validation results window (see “dom.source.getValidationErrorsForOffset()”...
Page 252
Arguments location, message, timeout • The argument is a string that specifies a toolbar item, or is an empty string, or is one of the following location keywords: " , " , " top" topright" right" tooltip is placed against the specified edge or corner and is centered. An empty string causes it to be centered in the document.
Page 253
Description Uses the internal Dreamweaver URL decoding mechanism to decode special characters and symbols in URL strings. For example, this function decodes Arguments inStr • The argument is the string to decode. inStr Returns A string that contains the decoded URL. Example The following example calls dw.doURLDecoding()
Page 254
• Dreamweaver returns references for named objects that are contained in unnamed forms and layers (for example, document.forms[2].myCheckbox dreamweaver.getObjectRefs() (deprecated) Availability Dreamweaver 1; deprecated in 3. Description This function scans the specified document for instances of the specified tags or, if no tags are specified, for all tags in the document and formulates browser-specific references to those tags.
Page 255
dreamweaver.getObjectTags() (deprecated) Availability Dreamweaver1; deprecated in 3. Description This function scans the specified document for instances of the specified tags or, if no tags are specified, for all tags in the document. This function is equivalent to calling each element in the nodelist Arguments sourceDoc, {tag1}, {tag2},...{tagN}...
Page 256
Arguments section, key, default_value • The argument is a string that specifies the preferences section that contains the entry. section • The argument is a string that specifies the entry of the value to retrieve. • The argument is the default value that Dreamweaver returns if it cannot find the entry. This value default_value must be an unsigned integer in the range 0 through 65,535 or a signed integer in the range -32,768 through 32,767.
Page 257
dreamweaver.setPreferenceInt() Availability Dreamweaver MX. Description Lets you set an integer preference setting for an extension. This setting is stored with Dreamweaver preferences when Dreamweaver is not running. Arguments section, key, new_value • The argument is a string that specifies the preferences category in which the option is set. If the category section does not exist, Dreamweaver creates it.
DREAMWEAVER CS3 API Reference • The argument is a string that specifies the value of the category option. new_value Returns value if successful; otherwise. true false Example var txtEditor = getExternalTextEditor(); dreamweaver.setPreferenceString("My Extension", "Text Editor", txtEditor); dreamweaver.showTargetBrowsersDialog() Availability Dreamweaver MX 2004. Description Opens the Target Browsers dialog box.
Page 259
Example The following function is useful when referencing other extension files, which are stored in the Configuration folder in the Dreamweaver application folder: var sortCmd = dreamweaver.getConfigurationPath() + ¬ "/Commands/Sort Table.htm" var sortDOM = dreamweaver.getDocumentDOM(sortCmd); dreamweaver.getDocumentPath() Availability Dreamweaver 1.2. Description Gets the path of the specified document, which is expressed as a file:// URL.
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.
Page 261
dom.getSelectedNode() Availability Dreamweaver 3. Description Gets the selected node. Using this function is equivalent to calling the the return value to the dom.offsetsToNode() Arguments None. Returns The tag, text, or comment object that completely contains the specified range of characters. dom.getSelection() Availability Dreamweaver 3.
Page 262
Description Gets the position of a specific node in the DOM tree, which is expressed as character offsets into the document’s source code. It is valid for any document on a local drive. Arguments node • The argument must be a tag, comment, or range of text that is a node in the tree that the node function returns.
Page 263
var offsets = dom.getSelection(); var theSelection = dreamweaver.offsetsToNode(offsets[0], ¬ 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. Note: 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 264
dom.setSelection() Availability Dreamweaver 3. Description Sets the selection in the document. Arguments offsetBegin, offsetEnd • These arguments are the opening and closing points, respectively, for the new selection, which is expressed as character offsets into the document’s source code. If the two numbers are the same, the new selection is an insertion point.
Page 265
• The argument is the node that you want to check. node Returns A Boolean value: if the node exists; true Example The following example gets the current node, locates a table within it, and later calls original node still exists: function applyFormatToSelectedTable(){ // get current selection var selObj = dw.getDocumentDOM().getSelectedNode();...
Page 266
DREAMWEAVER CS3 API Reference Description Gets the object in the DOM tree that completely contains the range of characters between the specified opening and closing points. Arguments offsetBegin, offsetEnd • These arguments are the opening and closing points, respectively, of a range of characters, which is expressed as byte offsets into the document’s source code.
• These arguments are the opening and closing points, respectively, for the new selection, which is expressed as byte offsets into the document’s source code. If the two numbers are the same, the new selection is an insertion point. If the new selection is not a valid HTML selection, it is expanded to include the characters in the first valid HTML selection.
Page 268
• The argument is the character or characters that signifies the end of a token. Separator separatorCharacters characters in quoted strings are ignored. Any white-space characters that occur in as tabs) are treated as separator characters, as if they are explicitly specified. Two or more consecutive white space characters are treated as a single separator.
Page 269
Returns The converted string. dreamweaver.scanSourceString() Availability Dreamweaver UltraDev 1. Description Scans a string of HTML and finds the tags, attributes, directives, and text. For each tag, attribute, directive, and text span that it finds, the scanSourceString() supports the following callback functions: •...
Dreamweaver calls the function for each span of text in the document (that is, everything that is not a tag text() or a directive). Text spans include text that is not visible to the user, such as the text inside a tag.
Page 271
Description This function runs the specified translator on the document. This function is valid only for the active document. Arguments translatorName • The argument is the name of a translator as it appears in the Translation preferences. translatorName Returns Nothing. dreamweaver.editLockedRegions() Availability Dreamweaver 2.
dreamweaver.useTranslatedSource() Availability Dreamweaver 2. Description This function specifies that the values that used by dom.offsetsToNode() HTML that is contained in the DOM after a translator runs), not the untranslated source. Note: This function is relevant only in Property inspector files. Arguments bUseTranslatedSource •...
Page 273
XML schema cache. The default value is Returns A string that contains the XML schema tree. Example The following example gets the schema tree from the XML schema cache for menus.xml: var theSchema = MMXSLT.getXMLSchema("file:///c:/Program Files/Adobe/¬ Adobe Dreamweaver CS3/Configuration/Menus/menus.xml""); MMXSLT.getXMLSourceURI() Availability Dreamweaver 8.
Page 274
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} •...
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, Adobe Shockwave and Adobe Flash content, URLs, colors, and scripts).
Page 276
DREAMWEAVER CS3 API Reference dreamweaver.assetPalette.addToFavoritesFrom Document() Availability Dreamweaver 4. Description Adds the element that is selected in the Document window to the Favorites list. This function handles only images, Shockwave files, Flash files, text font colors, and URLs. Arguments None. Returns Nothing.
Page 277
DREAMWEAVER CS3 API Reference 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 •...
Page 278
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. Arguments None. Returns An array of the following three strings for each selected item: • The string, which is the name/filename or nickname that appears in the Assets panel. name •...
Page 279
DREAMWEAVER CS3 API Reference Description Inserts selected elements or applies the element to the current selection. It applies templates, colors, and URLs to the selection; it also inserts URLs and other elements at the insertion point. If a document isn’t open, the function is not available.
Page 280
DREAMWEAVER CS3 API Reference 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.
Page 281
DREAMWEAVER CS3 API Reference 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. It works only in the Favorites list or if the category is Library or Templates.
Page 282
Description Switches the display to show either the Site list or the Favorites list. Arguments viewType • The argument is a string that can be viewType Returns Nothing. dreamweaver.libraryPalette.deleteSelectedItem() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver 4 in favor of using on page 276, and then calling “dreamweaver.assetPalette.removeFromFavorites()”...
Page 283
DREAMWEAVER CS3 API Reference Description This function creates a new library item based on the selection in the current document. Arguments bReplaceCurrent • The argument is a Boolean value that indicates whether to replace the selection with an bReplaceCurrent instance of the newly created library item. Returns Nothing.
Page 284
Description Returns the current font size of the Reference panel display region. Arguments None. Returns The relative font size as small medium dreamweaver.referencePalette.setFontSize() Availability Dreamweaver 4. Description Changes the font size that appears in the Reference panel. Arguments fontSize • The argument is one of the following relative sizes: fontSize Returns...
Arguments None. Returns A string that contains the path of the template, which is expressed as a file:// URL. dreamweaver.templatePalette.renameSelectedTemplate() (deprecated) Availability Dreamweaver 3; deprecated in Dreamweaver 4 in favor of using on page 276 with as the argument value, and then calling "templates"...
Page 286
• The argument, which is optional, is the position at which this action should be added. The eventBasedIndex argument is a zero-based index; if two actions already are associated with the specified event, eventBasedIndex and you specify eventBasedIndex the action is added after all existing actions for the specified event. Returns Nothing.
Page 287
dom.removeBehavior() Availability Dreamweaver 3. Description Removes the action at the specified position within the specified event. This function acts on the current selection and is valid only for the active document. Arguments event, {eventBasedIndex} • The argument is the event handler through which the action is attached to the element (for example, event , or onClick...
Page 288
Example dreamweaver.getBehaviorElement() iorTag()” on page 283 to determine whether the selected action is appropriate for the selected HTML tag, except that it gives you access to more information about the tag and its attributes. As shown in the following example, if you write an action that can be applied only to a hypertext link ( you can use the getBehaviorElement()
Page 289
Returns A string that represents the source of the tag. This is the same string that passes as an argument ( function. If this function appears outside an action file, the return value is an empty canAcceptBehavior() string. Example If you write an action that can be applied only to a hypertext link ( function, as the following example shows, in the function that initializes the user interface for the Parameters dialog box: function initializeUI(){...
Page 290
dreamweaver.behaviorInspector.getBehaviorAt() Availability Dreamweaver 3. Description Gets the event/action pair at the specified position in the Behaviors panel. Arguments positionIndex • The argument is the position of the action in the Behaviors panel. The first action in the list is at positionIndex position 0.
Page 291
DREAMWEAVER CS3 API Reference Description Gets the position of the selected action in the Behaviors panel. Arguments None. Returns An integer that represents the position of the selected action in the Behaviors panel, or –1 if no action is selected. Example If the first action in the Behaviors panel is selected, as shown in the following figure, a call to the dream-...
Page 292
DREAMWEAVER CS3 API Reference 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 • The argument is the position of the action in the Behaviors panel. The first action in the list is at positionIndex position 0.
dreamweaver.behaviorInspector.setSelectedBehavior() Availability Dreamweaver 3. Description Selects the action at the specified position in the Behaviors panel. Arguments positionIndex • The argument is the position of the action in the Behaviors panel. The first action in the list is at positionIndex position 0.
Page 294
DREAMWEAVER CS3 API Reference Description Copies the selection, including any HTML markup that defines the selection, to the Clipboard. Arguments None. Returns Nothing. dom.clipCopyText() Availability Dreamweaver 3. Description Copies the selected text to the Clipboard, ignoring any HTML markup. Arguments None.
Page 295
DREAMWEAVER CS3 API Reference Arguments None. Returns Nothing. Enabler See “dom.canClipPaste()” on page 436. Example If the Clipboard contains , a call to results in the following ABC Widgets dw.getDocumentDOM().clipPaste() figure: dom.clipPasteText() (deprecated) Availability Dreamweaver 3. Deprecated in Dreamweaver 8. Use the function instead.
Page 296
DREAMWEAVER CS3 API Reference Example If the Clipboard contains , a call to <code>return true;</code> dw.getDocumentDOM().clipPasteText() results in the following figure: 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.
Page 297
Returns Nothing. Enabler See “dreamweaver.canClipCut()” on page 446. dreamweaver.clipPaste() Availability Dreamweaver 3. Added the strPasteOption Description Pastes the contents of the Clipboard into the current document, dialog box, floating panel, or Site panel. Arguments {strPasteOption} • The argument, which is optional, specifies the type of paste to perform. Values include: strPasteOption , and "structured"...
Example dreamweaver.getClipboardText() returns boardText(true) "text bold text" Library and template functions Library and template functions handle operations that are related to library items and templates, such as creating, updating, and breaking links between a document and a template or library item. Methods of the object either control or act on the selection in the Assets panel library items, not in the weaver.libraryPalette current document.
Page 299
DREAMWEAVER CS3 API Reference Returns Nothing. 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.
Page 300
DREAMWEAVER CS3 API Reference 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. Description Determines whether the document is a template. Arguments None.
Page 301
DREAMWEAVER CS3 API Reference var theDOM = dw.getDocumentDOM(); var edRegs = theDOM.getEditableRegionList(); var selReg = theDOM.getSelectedEditableRegion(); alert(edRegs[selReg].innerHTML); dom.insertLibraryItem() Availability Dreamweaver 3. Description Inserts an instance of a library item into the document. Arguments libraryItemURL • The argument is the path to an LBI file, which is expressed as a file:// URL. libraryItemURL Returns Nothing.
Page 302
Returns Nothing. Enabler See “dom.canMakeNewEditableRegion()” on page 441. 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.
Arguments {typeOfUpdate} • The optional argument must be typeOfUpdate argument is omitted, it defaults to Returns Nothing. Snippets panel functions Using Dreamweaver, web developers can edit and save reusable blocks of code in the Snippets panel and retrieve them as needed. The Snippets panel stores each code snippet in a CSN file within the Configuration/Snippets folder.
Page 304
Attribute Description Name of snippet name Snippet description description Type of preview: preview to display the snippet rendered in HTML in the Preview area. If the snippet is used to wrap a user selection, type inserted before the selection, You can use the following methods to add Snippets panel functions to your extensions. dreamweaver.snippetPalette.getCurrentSnippetPath() Availability Dreamweaver MX 2004.
Page 305
DREAMWEAVER CS3 API Reference Arguments None. Returns Nothing. dreamweaver.snippetPalette.editSnippet() Availability Dreamweaver MX. Description Opens the Edit Snippet dialog box and gives it focus, enabling editing for the selected element. Arguments None. Returns Nothing. Enabler See “dreamweaver.snippetpalette.canEditSnippet()” on page 461. dreamweaver.snippetPalette.insert() Availability Dreamweaver MX.
DREAMWEAVER CS3 API Reference Arguments path • A string that specifies the path to the snippet relative to the Snippets folder. Returns A Boolean value. Enabler See “dreamweaver.snippetpalette.canInsert()” on page 461. Example The following call to the function inserts the code snippet at the location dw.snippetPalette.insertSnippet() specified by the argument into the current document at the insertion point: dw.snippetPalette.insertSnippet('Text\\Different_Link_Color.csn');...
Page 307
element.getTranslatedAttribute() Availability Dreamweaver CS3. Description This function is the same as the W3C element.getTranslatedAttribute() Arguments name • The argument is a DOMString that is the name of the attribute to retrieve. name Returns Returns the name of the attribute as a DOMString. If the attribute does not have a specified or default value, this function returns an empty string.
To assign an attribute value that contains syntax intended to be recognized as an entity reference, you must create an node plus any Attr Text EntityReference to assign it as the value of an attribute. Arguments name, value • The argument is a DOMString that is the name of the attribute to create or change.
Page 309
Arguments code, insideHead • is a string containing the JavaScript code to be inserted into the page code • is a Boolean value that indicates whether to insert the JavaScript block in the head or in the body. insideHead The default is , which inserts the code in the head.
Page 310
• to insert a "javascript" SCRIPT • to insert a "vbscript" SCRIPT • not to insert a reference in the head "" • " " is a Boolean value that determines how the value set in " useDefault . If true, Dreamweaver treats " true "...
var defaultAssetFolder = dom.getDefaultAssetFolder(); return retVal; Browser compatibility check functions The following functions facilitate locating combinations of HTML and CSS that can trigger browser rendering bugs (for more information, refer to "The Browser Compatibility Check Issues API" chapter in Extending Dreamweaver), but they can also be used in other types of extensions (such as Commands).
Page 312
window.getDeclaredStyle() Availability Dreamweaver CS3. Description Gets the CSS styles that are declared for the specified element. Differs from the that styles that are not specifically declared are undefined, and it gives actual length values as declared in the style sheet (e.g., 20%, .8em) rather than computed pixel values. If also gets only the styles that directly apply to the element;...
Page 313
• is the containing element for which a minimum width is required. container Returns An integer representing the minimum display width of the specified container, in pixels, or -1 if the element is not a container or its minimum width cannot be determined Example var dom = dw.getDocumentDOM();...
Page 314
for (var j=0; j < children.length; j++){ dProps = window.getDeclaredStyle(children[j]); if (typeof(dProps.width) != "undefined" || typeof(dProps.height) != "undefined"){ hasLayout = true; break; [...] [...] dom.getInlineElements() elem.getInlineElements() Availability Dreamweaver CS3. Description Scans the document (or element) for descendents with an inherent or specified display value of Arguments None.
Page 315
dom.getHeaderElements() elem.getHeaderElements() Availability Dreamweaver CS3. Description Scans the document (or element) for header tags (H1 to H6). Arguments None. Returns An array of element nodes. Example var DOM = dw.getDocumentDOM(); var headers = DOM.getHeaderElements(); for (var i=0; i < headers.length; i++){ alert(headers[i].tagName);...
Page 316
elem.isBlockElement() Availability Dreamweaver CS3. Description Checks whether the element has an inherent or specified display value of Arguments None. Returns A Boolean value indicating whether the object is a block-level element. Example [...] var DOM = dw.getDocumentDOM(); var blocks = DOM.body.getBlockElements(); var next = null;...
Page 317
Example [...] var DOM = dw.getDocumentDOM(); var floats = issueUtils.getFloats(DOM.body); var next = null; for (var i=0; i < floats.length; i++){ next = floats[i].nextSibling; // if nextSibling of float is a text node or an inline element if (next && (next.nodeType == Node.TEXT_NODE || (next.nodeType == Node.ELEMENT_NODE &&...
Page 318
Arguments None. Returns A Boolean value indicating whether the object is a list element. Example [...] var DOM = dw.getDocumentDOM(); var floats = issueUtils.getFloats(DOM.body); var prev = null, children = null; for (var i=0; i < floats.length; i++){ children = floats[i].childNodes; for (var k=0;...
Chapter 16: Dynamic documents The dynamic documents functions in Adobe® Dreamweaver® CS3 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 CS3 API Reference Arguments None. Returns property. ComponentRec 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.
• The property is the path of a file that contains the icon (a GIF image) that represents the parent node imageFile in Dynamic Data or the Dynamic Text dialog box or in the Bindings panel. The defined. • The property is optional.
Page 322
dreamweaver.getExtDataValue() Availability Dreamweaver UltraDev 4. Description This function retrieves the field values from an EDML file for the specified nodes. Arguments qualifier(s) • The argument is a variable-length list (depending on the level of information you need) of qualifier(s) comma-separated node qualifiers that includes group or participant name, subblock (if any), and field name. Returns Dreamweaver expects a field value.
Page 323
• The argument is a property value, or it is blank and is ignored. For example value ticipants("", "participant"); • The argument is a variable-length list of comma-separated node qualifiers of the required qualifier(s) property. Returns Dreamweaver expects an array of participant names that have the specified property, if it is given, and the property matches the specified value, if it is given.
Live data functions You can use the following live data functions to mimic menu functionality: • The function is used for the View > Live Data Settings menu item. showLiveDataDialog() • The function is used for the View > Live Data and View > Refresh Live Data menu items. setLiveDataMode() •...
Page 325
Description Obtains the URL parameters that are specified as Live Data settings. 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.
Page 326
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; if you try to call it at another time, an error occurs. The lateMarkup() function performs the following operations: weaver.liveDataTranslate()
Page 327
Returns Nothing. dreamweaver.setLiveDataMode() Availability Dreamweaver UltraDev 1. Description Toggles the visibility of the Live Data window. Arguments bIsVisible • The argument is a Boolean value that indicates whether the Live Data window should be visible. If bIsVisible you pass to this function and Dreamweaver currently displays the Live Data window, the effect is the same true as if you clicked the Refresh button.
DREAMWEAVER CS3 API Reference Example dreamweaver.setLiveDataParameters(“ID=22&Name=Samuel”) dreamweaver.showLiveDataDialog() Availability Dreamweaver UltraDev 1. 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 >...
Page 329
• The property is a pointer to the participant node in the user’s document. participantNode • The property is the name of the participant’s EDML file (without the .edml extension). participantName • The property is a JavaScript object that stores all the parameter/value pairs. parameters •...
DREAMWEAVER CS3 API Reference Returns Nothing. Server model functions In 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 331
Description Lets JavaScript code get the script delimiter for each server model, so managing the server model code can be separated from managing the user-scripted code. Arguments None. Returns An array of objects where each object contains the following three properties: •...
Page 332
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 selected site. Arguments None. Returns A string that represents the supported file extensions. dom.serverModel.getServerIncludeUrlPatterns() Availability Dreamweaver MX.
Page 333
The search pattern contains a JavaScript regular expression that specifies two submatches (both of which are contained within parentheses). The first submatch is for the text string file reference. To access the translator URL pattern, your code should look like the following example: var serverModel = dw.getDocumentDOM().serverModel;...
Page 334
DREAMWEAVER CS3 API Reference Description Determines the server model that is associated with the document and returns that value. The server language for a site is the value that comes from the Default Scripting Language setting on the App Server Info tab in the Site Definition dialog box.
Page 335
Note: 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 the conversion.
Page 336
DREAMWEAVER CS3 API Reference Returns A Boolean value that indicates whether the request to connect to the application server was successful. dreamweaver.getServerModels() Availability Dreamweaver MX. Description Gets the names for all the currently defined server models. The set of names is the same as the ones that appear in the Server Model text field in the Site Definition dialog box.
Chapter 17: Design The Design functions in Adobe® Dreamweaver® CS3 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 338
Description Applies a CSS-based layout to the document. The document body must be empty, and the document must be a page where you can apply a layout. That is: • A page that is HTML based, such as HTML, XHTML, ColdFusion, PHP, and so on, (but not CSS, XML, JavaScript, and so on).
Page 339
• A page that is basically HTML based, such as HTML, XHTML, ColdFusion, PHP, and so on (but not CSS, XML, JavaScript, and so on). • A page that is not a frameset or a template instance (although a template itself is fine). evelyn Arguments None.
Page 340
Description Gets the descriptions of the available CSS-based layouts Arguments None. Returns String array of layout descriptions. dom.applyCSSStyle() Availability Dreamweaver 4. Description Applies the specified style to the specified element. This function is valid only for the active document. Arguments elementNode, styleName, {classOrID}, {bForceNesting} •...
Page 341
Description This function gets the Element view for the currently selected element in the document. If the currently selected element is normal, the getElementView() or hidden. Arguments None. Returns A string that indicates the status of the selected element. Values include: •...
Page 342
dom.getShowDivBoxModel() Availability Dreamweaver 8. Description This function gets the state of the Layout Block Box Model visual aid. Arguments None. Returns A Boolean; if the Layout Block Box Model visual aid is on; true 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();...
Page 343
Description Removes the attribute from the specified element, or removes the CLASS the specified element. This function is valid only for the active document. Arguments elementNode, {classOrID} • The argument is an element node in the DOM. If the elementNode empty string ("...
Page 344
Description This function sets the Element view for the currently selected element in the document. If the currently selected element is , the "normal" setElementView() that is "full" "hidden" Arguments view • The argument, which is required, is a string that sets the currently selected element to view If the currently selected element, is element’s first ancestor that is either...
Page 345
Description This function turns the Layout Block Box Model visual aid on or off. Arguments show • The argument, which is required, is a Boolean value that specifies whether to turn the Layout Block Box show Model visual aid on. Setting show Returns Nothing.
Page 346
Enabler See “dreamweaver.cssRuleTracker.canEditSelectedRule()” on page 453. 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 347
Arguments None. Returns Nothing. dreamweaver.cssStylePalette.deleteSelectedStyle() Availability Dreamweaver 3. Description Deletes the style that is currently selected in the Styles panel from the document. Arguments { pane } • The argument, which is optional, is a string that specifies the pane of the Styles Panel to which this function pane applies.
Page 348
Enabler See “dreamweaver.cssStylePalette.canDuplicateSelectedStyle()” on page 454. dreamweaver.cssStylePalette.editSelectedStyle() Availability Dreamweaver 3. Description Opens the Style Definition dialog box for the style that is currently selected in the Styles panel. Arguments { pane } • The argument, which is optional, is a string that specifies the pane of the Styles Panel to which this function pane applies.
Page 349
DREAMWEAVER CS3 API Reference dreamweaver.cssStylePalette.editStyleSheet() Availability Dreamweaver 3. Description Opens the Edit Style Sheet dialog box. Arguments None. Returns Nothing. Enabler See “dreamweaver.cssStylePalette.canEditStyleSheet()” on page 455. dreamweaver.cssStylePalette.getDisplayStyles() Availability Dreamweaver 8. Description This function determines whether CSS styles are being rendered. The default value is true Arguments None.
Page 350
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. Arguments fullSelector • The argument is a Boolean value that indicates whether the full selector or only the class should fullSelector return.
Page 351
Description Gets a list of all the class styles in the active document. Without arguments it just returns class selector names. If the argument is , it returns just ID selector names. In either case, if the bGetIDs true , it returns the full selector name. true For example, given an HTML file with the following code: <style>...
Page 352
dreamweaver.cssStylePalette.newStyle() Availability Dreamweaver 3. Description Opens the New Style dialog box. Arguments None. Returns Nothing. 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.
Page 353
Returns Nothing. 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 • The argument specifies the new target media type. mediaType Returns Nothing.
Page 354
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. Arguments forWhat • The argument, which is required, is a string. Possible values are forWhat If the argument is...
Page 355
Example The following example gets the background colors used by the Layout Block Backgrounds visual aid: var backgroundColors = dreamweaver.getDivBackgroundColors(); dreamweaver.setBlockVisOutlineProperties() Availability Dreamweaver 8. Description This function sets the outline properties for the block visualization visual aids. Arguments forWhat, color, width, {style} •...
Returns Nothing. Example The following example makes sure there are no more than 16 colors specified as div background colors and, if so, sets the colors used as background colors to shades of gray: var currentDOM = dw.getDocumentDOM(); var divColors = currentDOM.getDivBackgroundColors("divs"); var shadesOfGray = new Array["#000000", "#111111", "#222222", "#333333",¬...
Page 357
DREAMWEAVER CS3 API Reference dom.isDocumentInFrame() Availability Dreamweaver 4. Description Identifies whether the current document is being viewed inside a frameset. 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.
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. Arguments alignDirection •...
Page 359
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 • The argument is a Boolean value that indicates whether to resize the layers or hotspots horizontally. bHoriz •...
DREAMWEAVER CS3 API Reference Example If the selected layer has the Left, Top, Width, and Height properties shown, calling dw.getDocumentDOM().resiz- is equivalent to resetting Left to 40, Top to 20, Width to 240, and Height to 240. eSelectionBy(–10,–30,30,10) dom.setLayerTag() Availability Dreamweaver 3.
Page 361
dom.getRulerUnits() Availability Dreamweaver 3. Description Gets the current ruler units. Arguments None. 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.
Page 362
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 See “dom.canPlayPlugin()” on page 441. dom.setRulerOrigin() Availability Dreamweaver 3. Description Sets the origin of the ruler.
Page 363
dom.setRulerUnits() Availability Dreamweaver 3. Description Sets the current ruler units. Arguments units • The argument must be units "px" Returns Nothing. dom.setTracingImagePosition() Availability Dreamweaver 3. Description Moves the upper left corner of the tracing image to the specified coordinates. If the arguments are omitted, the Adjust Tracing Image Position dialog box appears.
Page 364
DREAMWEAVER CS3 API Reference Returns Nothing. Enabler See “dom.hasTracingImage()” on page 444. Example The following code sets the opacity of the tracing image to 30%: dw.getDocumentDOM().setTracingOpacity('30'); dom.snapTracingImageToSelection() Availability Dreamweaver 3. Description Aligns the upper left corner of the tracing image with the upper left corner of the current selection. Arguments None.
DREAMWEAVER CS3 API Reference Arguments None. Returns A Boolean value that indicates whether the selection is currently being played with a plug-in. Enabler See “dom.canStopPlugin()” on page 444. dreamweaver.arrangeFloatingPalettes() Availability Dreamweaver 3. Description Moves the visible floating panels to their default positions. Arguments None.
Page 366
Description Creates a 1-pixel-high transparent spacer image at the bottom of a specified column in the currently selected table. This function fails if the current selection is not a table or if the operation is not successful. Arguments colNum • The argument is the column at the bottom of which the spacer image is created.
Page 367
• The argument is the x position of the left border of the table. left • The argument is the y position of the top border of the table. • The argument is the width of the table in pixels. width •...
Page 368
Description If the user clicks a menu button in the header of a table in Layout view and causes the table header menu to appear, this function returns the index of the column that the user clicked. The result is undefined if the table header menu is not visible.
Page 369
DREAMWEAVER CS3 API Reference Arguments colNum • The 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 autostretch; otherwise. true false dom.makeCellWidthsConsistent() Availability...
Page 370
Arguments colNum • The argument is the column from which to remove the spacer image. colNum Returns Nothing. dom.setColumnAutostretch() Availability Dreamweaver 4. Description Switches a column between automatically sized or fixed width. If index in the currently selected table is set to autostretch; otherwise it’s set to a fixed width at its current rendered width.
Page 371
var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowBlockBackgrounds(false) == false){ currentDOM.setShowBlockBackgrounds(false); dom.getShowBlockBorders() Availability Dreamweaver 8. Description This function gets the state of the visual aid that draws borders for all blocks or all divs. Arguments allblocks • The argument, which is required, is a Boolean. Set the value to allblocks Set the value to to get the state for all block elements.
Page 372
var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowBlockIDs(false) == false){ currentDOM.setShowBlockIDs(true); 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 var currentDOM = dw.getDocumentDOM();...
Page 373
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 • The argument, which is required, is a Boolean. Set the value to allblocks Set the value to to apply borders to all block elements.
Returns A Boolean: if the box model is displayed; true Example See “dom.getShowBoxModel()” on page 367. dom.setShowLayoutTableTabs() Availability Dreamweaver 4. Description Sets the current document to display tabs for layout tables whenever it’s in Layout view. This function does not force the document into Layout view.
Page 375
dreamweaver.activeViewScale() Availability Dreamweaver 8. Description This function gets or sets a mutable floating point property. When you get the value, Dreamweaver returns the active view’s scale as it appears in the Zoom combo box, divided by 100. For example, 100% is 1.0; 50% is 0.5, and so on. When you set the value, Dreamweaver sets the value in the Zoom combo box.
Page 376
Description This function zooms in or out so that the current selection fits in the currently visible portion of the Design view. Arguments None. Returns Nothing. Enabler See “dreamweaver.canFitSelection()” on page 448. 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 See “dreamweaver.canZoom()” on page 452. 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 Magni- fication menu.
Page 378
Description This function determines whether to delete all guides in the document. Arguments None. Returns Nothing. Example The following example deletes all guides in the document if the document has at least one guide: var currentDOM = dw.getDocumentDOM(); if (currentDOM.hasGuides() == true) { currentDOM.clearGuides();...
Page 379
• The argument is the location of the guide with both the value and units as one string, with no space location between the value and units. The possible units are 10 pixels, ; to specify 50 percent, location = "10px" Returns Nothing.
Page 380
• The argument is a string that represents the location in the document to test, with both the value and location units as one string, with no space between the value and units. The possible units are percentage. For example, to specify 10 pixels, Returns Nothing.
Page 381
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 382
var currentDOM = dw.getDocumentDOM(); if (currentDOM.guidesSnapToElements == false) { currentDOM.guidesSnapToElements = true; dom.guidesVisible Availability Dreamweaver 8. Description This mutable Boolean property determines whether guides are visible in the document. You can set and get this property. Arguments None. Returns Nothing. Example The following example turns guides on if they are not visible: var currentDOM = dw.getDocumentDOM();...
Page 383
dom.hasHorizontalGuide() Availability Dreamweaver 8. Description This function determines whether the document has a horizontal guide at the specified location. Arguments location • The argument is a string that represents the location in the document to test, with both the value and location units as one string, with no space between the value and units.
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. Arguments None. Returns Nothing. Example The following example makes elements in the document snap to guides: var currentDOM = dw.getDocumentDOM();...
Page 385
DREAMWEAVER CS3 API Reference dom.convertWidthsToPixels() Availability Dreamweaver 4. Description This function converts all attributes in the current table from percentages to pixels. WIDTH Arguments None. Returns Nothing. dom.decreaseColspan() Availability Dreamweaver 3. Description This function decreases the column span by one. Arguments None.
Page 386
DREAMWEAVER CS3 API Reference dom.deleteTableColumn() Availability Dreamweaver 3. Description This function removes the selected table column or columns. Arguments None. Returns Nothing. Enabler See “dom.canDeleteTableColumn()” on page 438. dom.deleteTableRow() Availability Dreamweaver 3. Description This function removes the selected table row or rows. Arguments None.
Page 387
DREAMWEAVER CS3 API Reference dom.getShowTableWidths() Availability Dreamweaver MX 2004. Description Returns whether table widths appear in standard or expanded tables mode (non-Layout mode). For information on whether Dreamweaver displays table tabs in Layout mode, see “dom.getShowLayoutTableTabs()” on page 363. Arguments None.
Page 388
dom.increaseRowspan() Availability Dreamweaver 3. Description This function increases the row span by one. Arguments None. Returns Nothing. Enabler See “dom.canIncreaseRowspan()” on page 440. dom.insertTableColumns() Availability Dreamweaver 3. Description This function inserts the specified number of table columns into the current table. Arguments numberOfCols, bBeforeSelection •...
Page 389
• The argument is a Boolean value: bBeforeSelection row that contains the selection; false Returns Nothing. Enabler See “dom.canInsertTableRows()” on page 440. dom.mergeTableCells() Availability Dreamweaver 3. Description This function merges the selected table cells. Arguments None. Returns Nothing. Enabler See “dom.canMergeTableCells()” on page 441. dom.removeAllTableHeights() Availability Dreamweaver 3.
Page 390
DREAMWEAVER CS3 API Reference 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. dom.selectTable() Availability Dreamweaver 3. Description Selects an entire table. Arguments None. Returns Nothing.
Page 391
• The is a Boolean argument that indicates whether to display table widths for tables when the current bShow document is in standard or Expanded Tables mode (non-Layout mode). If the widths. If Dreamweaver does not display the widths. bShow false, Returns Nothing.
Page 392
• The argument specifies the number of rows to set in the selected table. numberOfRows Returns Nothing. dom.showInsertTableRowsOrColumnsDialog() Availability Dreamweaver 3. Description This function opens the Insert Rows or Columns dialog box. Arguments None. Returns Nothing. Enabler See “dom.canInsertTableColumns()” on page 440 or “dom.canInsertTableRows()” on page 440. dom.splitTableCell() Availability Dreamweaver 3.
• “Tag editor and tag library functions” on page 431 Code functions Code Hints are menus that Adobe® Dreamweaver® CS3 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 394
You can also add new Code Hints menus dynamically through JavaScript after Dreamweaver loads the contents of the CodeHints.xml file. For example, JavaScript code populates the list of session variables in the Bindings panel. You can use the same code to add a Code Hints menu, so when a user types Session in Code view, Dreamweaver displays a menu of session variables.
Page 395
Returns Nothing. Example If the user creates a record set called " dw.codeHints.addMenu( "CodeHints object methods", "myRS.", new Array("firstName", "lastName"), new Array("firstName", "lastName"), null, "ASP VB, ASP JS"); dreamweaver.codeHints.addFunction() Availability Dreamweaver MX. Description Dynamically defines a new function type, this function replaces the existing Arguments menuGroupId, pattern, {doctypes}, {casesensitive} •...
Page 396
dreamweaver.codeHints.resetMenu() Availability Dreamweaver MX. Description Resets the specified menu tag or function tag to its state immediately after Dreamweaver reads the CodeHints.xml file. In other words, a call to this function erases the effect of previous calls to the functions. Arguments menuGroupId, pattern, {doctypes} •...
dreamweaver.reloadCodeColoring() Description Reloads code coloring files from the Dreamweaver Configuration/Code Coloring folder. Arguments None. Returns Nothing. Example dreamweaver.reloadCodeColoring() Find and replace functions Find and 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;...
Page 398
dreamweaver.replace() Availability Dreamweaver 3. Description Verifies that the current selection matches the search criteria that was specified by Replace()” on page 395, by “dreamweaver.setUpComplexFindReplace()” on page dialog box; the function then replaces the selection with the replacement text that is specified by the search request. Arguments None.
Page 399
Returns Nothing. Example The first line of the following example sets up a tag search and specifies that the scope of the search should be the current document. The second line performs the search operation. dreamweaver.setUpComplexFind('<dwquery><queryparams matchcase="false" ¬ ignorewhitespace="true" useregexp="false"/><find>¬ <qtag qname="a"><qattribute qname="href"...
Page 400
dreamweaver.setUpFind() Availability Dreamweaver 3. Description Prepares for a text or HTML source search by defining the search parameters for a subsequent operation. weaver.findNext() Arguments searchObject argument is an object for which the following properties can be defined: searchObject • The is the text for which to search.
Page 401
argument is an object for which the following properties can be defined: searchObject • The property is the text for which to search. searchString • The property is the text with which to replace the selection. replaceString • The property is a Boolean value that indicates whether to search the HTML source. searchSource •...
DREAMWEAVER CS3 API Reference dreamweaver.showFindReplaceDialog() Availability Dreamweaver 3. Description Opens the Replace dialog box. Arguments None. Returns Nothing. Enabler See“dreamweaver.canShowFindDialog()” on page 452. General editing functions You handle general editing functions in the Document window. These functions insert text, HTML, and objects; apply, change, and remove font and character markup;...
Page 403
Arguments attribute, value • The argument must be attribute • The argument is the value to be assigned to the attribute; for example, value , or "5" "#FF0000" Returns Nothing. dom.deleteSelection() Availability Dreamweaver 3. Description Deletes the selection in the document. Arguments None.
Page 404
Arguments None. Returns Nothing. dom.getCharSet() Availability Dreamweaver 4. Description Returns the attribute in the meta tag of the document. charset Arguments None. Returns The encoding identity of the document. For example, for a Latin1 document, the function returns dom.getFontMarkup() Availability Dreamweaver 3.
Page 405
DREAMWEAVER CS3 API Reference Returns An integer that represents the line number in the document. 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.
Page 406
DREAMWEAVER CS3 API Reference dom.getTextAlignment() Availability Dreamweaver 3. Description Gets the alignment of the block that contains the selection. Arguments None. Returns A string that contains the value of the attribute for the tag that is associated with the block or an empty string ALIGN if the attribute is not set for the tag.
Page 407
dom.indent() Availability Dreamweaver 3. Description Indents the selection using BLOCKQUOTE converting the selected item into a nested list. This nested list is of the same type as the outer list and contains one item, the original selection. Arguments None. Returns Nothing.
Page 408
dom.insertObject() Availability Dreamweaver 3. Description Inserts the specified object, prompting the user for parameters if necessary. Arguments objectName • The argument is the name of an object in the Configuration/Objects folder. objectName Returns Nothing. Example A call to the dom.insertObject('Button') current selection.
Page 409
DREAMWEAVER CS3 API Reference 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. Arguments None.
Page 410
Arguments None. Returns Nothing. dom.removeCharacterMarkup() Availability Dreamweaver 3. Description Removes the specified type of character markup from the selection. Arguments tagName • The argument is the tag name that is associated with the character markup. It must be one of the tagName following strings: "b"...
Page 411
Returns Nothing. dom.resizeSelection() Availability Dreamweaver 3. Description Resizes the selected object to the specified dimensions. Arguments newWidth, newHeight • The argument specifies the new width to which the function will set the selected object. newWidth • The argument specifies the new height to which the function will set the selected object. newHeight Returns Nothing.
Page 412
• The argument is the URL (document-relative path, root-relative path, or absolute URL) comprising the linkHREF link. If this argument is omitted, the Select HTML File dialog box appears. Returns Nothing. Enabler See “dom.canSetLinkHref()” on page 443. dom.setLinkTarget() Availability Dreamweaver 3. Description Sets the target of the link that surrounds the current selection.
Page 413
Description Opens the List Properties dialog box. Arguments None. Returns Nothing. Enabler See “dom.canShowListPropertiesDialog()” on page 443. dom.setListTag() Availability Dreamweaver 3. Description Sets the style of the selected list. Arguments listTag • The argument is the tag that is associated with the list. It must be listTag Returns Nothing.
Page 414
Description Sets the format of the selected text field. Arguments fieldType • The argument must be fieldType Returns Nothing. dom.setTextFormat() Availability Dreamweaver 4. Description Sets the block format of the selected text. Arguments blockFormat • The argument is a string that specifies one of the following formats: blockFormat , or "h2"...
Page 415
Arguments None. Returns Nothing. Enabler See “dreamweaver.canDeleteSelection()” on page 446. 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. Arguments None.
Page 416
dreamweaver.getFontStyles() Availability Dreamweaver 4. Description Returns the styles that a specified TrueType font supports. Arguments fontName • The argument is a string that contains the name of the font. fontName Returns An array of three Boolean values that indicates what the font supports. The first value indicates whether the font supports Bold, the second indicates whether the font supports Italic, and the third indicates whether the font supports both Bold and Italic.
Arguments • The argument points to a graphical object for which the dimensions are wanted. Dreamweaver must support this object (GIF, JPEG, PNG, Flash, and Shockwave). The URL that is provided as the argument to the function must be an absolute URL that points to a local file; it cannot be a relative URL. ralSize() Returns An array of two integers where the first integer defines the width of the object, and the second defines the height.
If the argument is set to false dreamweaver.PrintCode() true • The argument is the DOM of the document to print. For information on how to obtain the DOM for a document document, see “dreamweaver.getDocumentDOM()” on page 236. Returns A Boolean value: if the code can print;...
Page 419
DREAMWEAVER CS3 API Reference Arguments None. Returns Nothing. dom.stripTag() Availability Dreamweaver 3. Description Removes the tag from around the current selection, leaving any contents. If the selection has no tags or contains more than one tag, Dreamweaver reports an error. Arguments None.
Description Displays the Quick Tag Editor for the current selection. Arguments {nearWhat}, {mode} • The optional argument, if specified, must be either nearWhat is omitted, the default value is "selection" • The optional argument, if specified, must be mode or omitted, Dreamweaver uses heuristics to determine the mode to use for the current selection. The "default"...
Page 421
Description Applies Dreamweaver automatic syntax formatting to the selected content (the same as selecting the Commands > Apply Source Formatting to Selection option) according to the settings in the Preferences > Code Format dialog box. Arguments None. Returns Nothing. dom.getShowNoscript() Availability Dreamweaver MX.
Page 422
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. Arguments None. Returns A Boolean value: if the Design view (WYSIWYG) is synchronized with the text in the Text view; true otherwise.
Page 423
• The argument, which is optional, is a Boolean value that indicates whether the bShowNoscript content should be rendered; true Returns Nothing. dom.source.arrowDown() Availability Dreamweaver 4. Description Moves the insertion point down the Code view document, line by line. If content is already selected, this function extends the selection line by line.
Page 424
dom.source.arrowRight() Availability Dreamweaver 4. Description Moves the insertion point to the right in the current line of the Code view. If content is already selected, this function extends the selection to the right. Arguments {nTimes}, {bShiftIsDown} • The argument, which is optional, is the number of characters that the insertion point must move. If nTimes is omitted, the default is 1.
Page 425
Description This function is a Code view extension that enables parentheses balancing. You can call to extend a currently highlighted selection or insertion point from the opening of the BracesTextview() surrounding parenthetical statement to the end of the statement to balance the following characters: Subsequent calls expand the selection through further levels of punctuation nesting.
Page 426
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. Arguments {nTimes}, {bShiftIsDown} •...
Page 427
dom.source.getLineFromOffset() Availability Dreamweaver MX. Description Takes an offset into the source document. Arguments None. Returns The associated line number, or -1 if the offset is negative or past the end of the file. dom.source.getText() Availability Dreamweaver 4. Description Returns the text string in the source between the designated offsets. Arguments startOffset, endOffset •...
Page 428
Returns An array of objects or the value null • The object is a string that contains the error message. message • The object is a string that contains the name of the results window. You can pass this value to the floaterName showResults() setFloaterVisibility()
Page 429
• The argument is the string to insert. string Returns A Boolean value: if successful; 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.
Page 430
Arguments {nTimes}, {bShiftIsDown} • The argument, which is optional, is the number of pages that the insertion point must move. If nTimes omitted, the default is 1. • The argument, which is optional, is a Boolean value that indicates whether content is being bShiftIsDown selected.
Page 431
Returns Nothing. dom.source.replaceRange() Availability Dreamweaver 4. Description Replaces the range of source text between than or if either offset is not a positive integer, it does nothing and returns endOffset than the number of characters in the file, it replaces the range between are greater than the number of characters in the file, it inserts the text at the end of startOffset endOffset...
Page 432
Arguments nTimes • The argument is the number of lines to scroll. If nTimes Returns Nothing. dom.source.scrollLineUp() Availability Dreamweaver 4. Description Scrolls the Code view up line by line without moving the insertion point. Arguments nTimes • The argument is the number of lines to scroll. If nTimes Returns Nothing.
Page 433
• The argument is the number of pages to scroll. If nTimes 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. Returns Nothing. dom.source.selectParentTag() Availability Dreamweaver 4.
Page 434
Returns A Boolean value: if successful; true false dom.source.startOfDocument() Availability Dreamweaver 4. Description Places the insertion point at the beginning of the Code view document. If content is already selected, this function extends the selection to the beginning of the document. Arguments bShiftIsDown •...
Page 435
Arguments {nTimes}, {bShiftIsDown} • The argument, which is optional, is the number of pages that the insertion point must move. If nTimes omitted, the default is 1. • The argument, which is optional, is a Boolean value that indicates whether content is being bShiftIsDown selected.
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 437
DREAMWEAVER CS3 API Reference Description If a tag is selected, this function opens the tag editor for that tag, so you can edit the tag. Arguments None. Returns Nothing. Enabler See “dreamweaver.canPopupEditTagDialog()” on page 449. dreamweaver.showTagChooser() Availability Dreamweaver MX. Description This function displays the Tag Chooser dialog box, brings it to the front, and sets it in focus.
Page 438
DREAMWEAVER CS3 API Reference Arguments fileURL • The argument is the URL of a file, relative to the Configuration/Tag Libraries folder, as fileURL filename.vtm shown in the following example: "HTML/img.vtm" Returns A DOM pointer to a new or previously existing file within the TagLibraries folder. dreamweaver.tagLibrary.getSelectedLibrary() Availability Dreamweaver MX.
Page 439
• The argument is the path to DTD or schema file, in local URL format. fileURL • The argument is the prefix string that should be added to all tags in this tag library. Prefix Returns Name of the imported tag library. dreamweaver.tagLibrary.getImportedTagList() Availability Dreamweaver MX.
Chapter 19: Enablers Adobe® Dreamweaver® CS3 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 descriptions are true...
Page 441
DREAMWEAVER CS3 API Reference 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 442
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 Dreamweaver; true dom.canClipPasteText() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Paste as Text operation. Arguments None.
Page 443
Returns A Boolean value: if all the content in the true document is not based on a template; dom.canDecreaseColspan() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Decrease Colspan operation. Arguments None. Returns A Boolean value: if the current cell has a true otherwise.
Page 444
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 site.canEditColumns() Description Checks whether a site exists. Arguments None.
Page 445
Returns A Boolean value: if there are any cells to the right of the current cell; true dom.canIncreaseRowspan() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Increase Rowspan operation. Arguments None. Returns A Boolean value: if there are any cells below the current cell; true dom.canInsertTableColumns() Availability...
Page 446
dom.canMakeNewEditableRegion() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a New Editable Region operation. Arguments None. Returns A Boolean value: if the current document is a template (DWT) file. true dom.canMarkSelectionAsEditable() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Mark Selection as Editable operation. Arguments None.
Page 447
Arguments None. 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; true dom.canRemoveEditableRegion() Availability...
Page 448
dom.canSetLinkHref() Availability Dreamweaver 3. Description Checks whether Dreamweaver can change the link around the current selection or create one if necessary. Arguments None. Returns A Boolean value: if the selection is an image, text, or if the insertion point is inside a link; true A text selection is defined as a selection for which the text Property inspector would appear.
Page 449
Description Checks whether Dreamweaver can perform a Split Cell operation. Arguments None. Returns A Boolean value: if the insertion point is inside a table cell or the selection is a table cell; true dom.canStopPlugin() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Stop operation. Arguments None.
Page 450
Returns A Boolean value: if the document has a tracing image; true dreamweaver.assetPalette.canEdit() Availability Dreamweaver 4. Description Enables menu items in the Assets panel for editing. Arguments None. Returns Returns a Boolean value: if the asset can be edited; true URLs in the Site list, and returns a false dreamweaver.assetPalette.canInsertOrApply()
Page 451
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 dreamweaver.canClipPaste() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Paste operation. Arguments None.
Page 452
dreamweaver.canExportCSS() (deprecated) Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Export CSS Styles operation. Arguments None. Returns A Boolean value: if the document contains any class styles that are defined in the true otherwise. dreamweaver.canExportTemplateDataAsXML() Availability Dreamweaver MX. Description Checks whether Dreamweaver can export the current document as XML.
Page 453
Returns A Boolean value: if a search pattern has already been established; true dreamweaver.canFitSelection() Availability Dreamweaver 8. Description Checks whether there is a selection in an active Design view, which means that Arguments None. Returns A Boolean value: if there is a selection in an active Design view; true dreamweaver.canOpenInFrame() Availability...
Page 454
DREAMWEAVER CS3 API Reference dreamweaver.canPlayRecordedCommand() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Play Recorded Command operation. Arguments None. Returns A Boolean value: if there is an active document and a previously recorded command that can be played; true false otherwise.
Page 455
Description Checks whether Dreamweaver can perform a Revert (to the last-saved version) operation. Arguments documentObject • The argument is the object at the root of a document’s DOM tree (the value that the documentObject function returns). weaver.getDocumentDOM() Returns A Boolean value that indicates whether the document is in an unsaved state and a saved version of the document exists on a local drive.
Page 456
Description Checks whether Dreamweaver can perform a Save As Template operation on the specified document. Arguments documentObject • The argument is the root of a document’s DOM (the same value that the documentObject function returns). weaver.getDocumentDOM() Returns A Boolean value that indicates whether the document can be saved as a template. dreamweaver.canSaveFrameset() Availability Dreamweaver 3.
Page 457
DREAMWEAVER CS3 API Reference 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 458
Returns A Boolean value: if there is an active Design view; true dreamweaver.cssRuleTracker.canEditSelectedRule() Availability Dreamweaver MX 2004. Description Checks whether the Property Grid editor can be applied to the selected rule. Because the Property Grid can display rules in locked files, a return value of Arguments None.
Page 459
dreamweaver.cssStylePalette.canDeleteSelectedStyle() Availability Dreamweaver MX. Description Checks the current selection to determine whether the selected style can be deleted. Arguments { pane } • The argument, which is optional, is a string that specifies the pane of the Styles Panel to which this function pane applies.
Page 460
• The argument, which is optional, is a string that specifies the pane of the Styles Panel to which this function pane applies. Possible values are "stylelist" applicable, relevant rules in “Current” mode; in “Current” mode; and "ruleInspector" default value is "stylelist"...
Page 461
Description Checks the current active document to see whether the selected style can be renamed. Arguments { pane } • The argument, which is optional, is a string that specifies the pane of the Styles Panel to which this function pane applies.
Page 462
Description Checks whether you can clear the contents of the Results panel that is currently in focus. Arguments None. Returns A Boolean value: if the contents can clear; true dreamweaver.resultsPalette.canCopy() Availability Dreamweaver MX. Description Checks whether the current Results window can display a copied message in its contents. Arguments None.
Page 463
Returns A Boolean value: if the contents can display; true 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; true dreamweaver.resultsPalette.canOpenInEditor() Availability Dreamweaver MX. Description Checks whether the current report can display in an editor.
Page 464
dreamweaver.resultsPalette.canSelectAll() Availability Dreamweaver MX. Description Checks whether a Select All message can be sent to the window that is currently in focus. Arguments None. Returns A Boolean value: if the Select All message can be sent; true dreamweaver.siteSyncDialog.canCompare() Availability Dreamweaver 8. Description Ths function checks whether the Compare context menu in the Site Synchronize dialog box can be displayed.
Page 465
Description This function checks whether the Change Action to Get context menu in the Site Synchronize dialog box can be displayed. Arguments None. Returns A Boolean value: if the Change Action to Get context menu can be displayed; true dreamweaver.siteSyncDialog.canMarkIgnore() Availability Dreamweaver 8.
Page 466
Arguments None. Returns A Boolean value: if the Change Action to Synced context menu can be displayed; true dreamweaver.snippetpalette.canEditSnippet() Availability Dreamweaver MX. Description Checks whether you can edit the currently selected item and returns either a or disable menu items for editing. Arguments None.
Page 467
Returns Nothing. site.canAddLink() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform an Add Link to [Existing File | New File] operation. Arguments None. Returns A Boolean value: if the selected document in the site map is an HTML file; true site.canChangeLink() Availability...
Page 468
• If a document window has focus, the file has been saved in a local site; or, if the Site panel has focus, one or more files or folders are selected. • The Check In/Check Out feature is turned on for the site. site.canCheckOut() Availability Dreamweaver 3.
Page 469
Description This function checks whether Dreamweaver can perform the Compare function on selected files. Arguments None. Returns A Boolean value: if two files (one local file and one remote file, two local files, or two remote files) are selected; true otherwise.
Page 470
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. Arguments siteOrURL • The argument must be the siteOrURL selection in the Site panel or the URL for a single file.
Page 471
• If the second argument is the keyword files (not the site map) and whether the selection is in the opposite pane from the argument site.canMakeEditable() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Turn Off Read Only operation. Arguments None.
Page 472
site.canPut() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Put operation. Arguments siteOrURL • The argument must be the siteOrURL selection in the Site panel, or the URL for a single file. Returns One of the following values: •...
Page 473
Returns A value of if the true localOrRemote whether a remote site has been defined. site.canRemoveLink() Availability Dreamweaver 3. Description Checks whether Dreamweaver can perform a Remove Link operation. Arguments None. Returns A Boolean value that indicates that an HTML or Flash file links to the selected file in the site map. site.canSetLayout() Availability Dreamweaver 3.
Page 474
DREAMWEAVER CS3 API Reference site.canSelectNewer() Availability Dreamweaver 3. Description Determines whether Dreamweaver can perform a Select Newer [Remote | Local] operation. Arguments localOrRemote • The 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.
Page 475
Description Determines whether Dreamweaver can perform an uncloaking operation. Arguments siteOrURL • The argument must be the siteOrURL act on the selection in the Site panel or the URL of a particular folder, which indicates that the function should act on the specified folder and all its contents. Returns A Boolean value: if Dreamweaver can perform the uncloaking operation on the current site or the specified...
Page 486
enabler function, about 435 converting to local drive path 26, endOfDocument() 132, 420 converting to local file path 23 endOfLine() 133, 420 FilePathToLocalURL() 28 endPage() 421 files errata 5 attributes 13 error messages 96 checked out 95 JavaBeans 80 checking in 93, 103 lengthsource control systems 96 checking out 94 source control systems 96...
Page 487
forceToolbarUpdate() 168 path 253 formatRange() 415 print 412 formatSelection() 415 quick tag editor 413 forms, posting 20, 21 report 193 frame and frameset functions 351 results window 138 frames selection 255 listing 351 server behavior 323 splitting 352 server components 314 framesets 352 server model 325 saving 352...
Page 489
getTables() 67 hasHorizontalGuide() 378 getTagLibraryDOM() 432 hasTracingImage() 444 getTagSelectorTag() 431 hasVerticalGuide() 378 getTempFolderPath() 254 Help files, opening 108 getText() 422 hidden files 13 getTextAlignment() 401 hide Toolbar 160 getTextCallback() 19 hideInfoMessagePopup() 245 getTextFormat() 401 hints, code 388 getting history functions 119 current DOM 236 History panel 123, 124 named connection objects 48...
Page 490
Flash elements 41, 127 about 79 string into document 114 MMJB.getClasses() 79 tags 115 MMJB.getClassesFromPackage() 8 insertion page 134 MMJB.getErrorMessage() 83 insertion point MMJB.getEvents() 80 beginning of document 135 MMJB.getMethods() 81 beginning of line 136 MMJB.getProperties() 79 beginning of next paragraph 133 JavaScript down one page 134 executing in Fireworks 35...
Need help?
Do you have a question about the 38040334 - Dreamweaver CS3 and is the answer not in the manual?
Questions and answers