000_DW_API_Print.
000_DW_API_Print.
000_DW_API_Print.book Page 3 Wednesday, August 20, 2003 9:14 AM CONTENTS CHAPTER 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Extending Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 4 Wednesday, August 20, 2003 9:14 AM DWfile.setAttributes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 DWfile.write() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 CHAPTER 3: The HTTP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 How the HTTP API works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 5 Wednesday, August 20, 2003 9:14 AM CHAPTER 6: Flash Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 How Flash elements work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inserting Flash elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Adding a Flash element to the Insert Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 6 Wednesday, August 20, 2003 9:14 AM MMDB.getSPParameters() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 MMDB.getSPParamsAsString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 MMDB.getTables() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 MMDB.getViews(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 MMDB.
000_DW_API_Print.book Page 7 Wednesday, August 20, 2003 9:14 AM bool SCS_UndoCheckout() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . int SCS_GetNumCheckedOut() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . bool SCS_GetFileCheckoutList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . int SCS_GetErrorMessageLength(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . bool SCS_GetErrorMessage() . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 8 Wednesday, August 20, 2003 9:14 AM dreamweaver.showDynamicDataDialog() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 dreamweaver.showPreferencesDialog() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 dreamweaver.showTagChooser() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 CHAPTER 12: Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 History functions . . . . . . . . .
000_DW_API_Print.book Page 9 Wednesday, August 20, 2003 9:14 AM Menu functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 dreamweaver.getMenuNeedsUpdating() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 dreamweaver.notifyMenuUpdated() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 dreamweaver.reloadMenus() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Results window functions .
000_DW_API_Print.book Page 10 Wednesday, August 20, 2003 9:14 AM dom.setShowFrameBorders() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 dom.setShowGrid() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 dom.setShowHeadView() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 dom.setShowInvalidHTML() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 dom.
000_DW_API_Print.book Page 11 Wednesday, August 20, 2003 9:14 AM Window functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dom.getFocus(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dom.getView() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dom.getWindowTitle(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dom.
000_DW_API_Print.book Page 12 Wednesday, August 20, 2003 9:14 AM site.getAppServerPathToFiles() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 site.getAppURLPrefixForSite() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 site.getCheckOutUser() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 site.getCheckOutUserForFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 site.
000_DW_API_Print.book Page 13 Wednesday, August 20, 2003 9:14 AM CHAPTER 14: Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 dom.convertLayersToTable() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 dom.convertTablesToLayers() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 14 Wednesday, August 20, 2003 9:14 AM dreamweaver.getObjectTags() (deprecated) . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 dreamweaver.getPreferenceInt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 dreamweaver.getPreferenceString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 dreamweaver.setPreferenceInt(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 dreamweaver.
000_DW_API_Print.book Page 15 Wednesday, August 20, 2003 9:14 AM dreamweaver.assetPalette.locateInSite() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 dreamweaver.assetPalette.newAsset(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 dreamweaver.assetPalette.newFolder(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 dreamweaver.assetPalette.recreateLibraryFromDocument(). . . . . . . . . . . . . . . 298 dreamweaver.assetPalette.refreshSiteAssets() . .
000_DW_API_Print.book Page 16 Wednesday, August 20, 2003 9:14 AM dom.getIsLibraryDocument() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 dom.getIsTemplateDocument() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 dom.getSelectedEditableRegion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 dom.insertLibraryItem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 dom.
000_DW_API_Print.book Page 17 Wednesday, August 20, 2003 9:14 AM dom.serverModel.getServerExtension() (deprecated). . . . . . . . . . . . . . . . . . . . 340 dom.serverModel.getServerIncludeUrlPatterns(). . . . . . . . . . . . . . . . . . . . . . . 340 dom.serverModel.getServerInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 dom.serverModel.getServerLanguage() (deprecated) . . . . . . . . . . . . . . . . . . . . 342 dom.serverModel.getServerName(). . . . . . . . . . . . . . .
000_DW_API_Print.book Page 18 Wednesday, August 20, 2003 9:14 AM dom.setTracingImagePosition(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 dom.setTracingImageOpacity(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 dom.snapTracingImageToSelection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 dom.stopAllPlugins() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 dom.stopPlugin() . . . . .
000_DW_API_Print.book Page 19 Wednesday, August 20, 2003 9:14 AM CHAPTER 18: Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 Code functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 dreamweaver.codeHints.addMenu() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 dreamweaver.codeHints.addFunction(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.book Page 20 Wednesday, August 20, 2003 9:14 AM dom.setTextAlignment() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 dom.setTextFieldKind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 dom.setTextFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 dom.showFontColorDialog() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 dreamweaver.
000_DW_API_Print.book Page 21 Wednesday, August 20, 2003 9:14 AM dom.source.scrollLineUp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 dom.source.scrollPageDown(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 dom.source.scrollPageUp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 dom.source.scrollTopFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 dom.source.
000_DW_API_Print.book Page 22 Wednesday, August 20, 2003 9:14 AM dom.canSetLinkHref() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 dom.canShowListPropertiesDialog(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 dom.canSplitFrame() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 dom.canSplitTableCell() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 dom.
000_DW_API_Print.book Page 23 Wednesday, August 20, 2003 9:14 AM site.canCheckIn() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 site.canCheckOut() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 site.canCloak() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 site.canConnect() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.
000_DW_API_Print.book Page 25 Wednesday, August 20, 2003 9:14 AM CHAPTER 1 Introduction The Dreamweaver API Reference describes two application programming interfaces (APIs) that let you perform various supporting tasks when developing Macromedia Dreamweaver MX 2004 extensions and adding program code to your Dreamweaver web pages. These two APIs are the utility API and the JavaScript API. The utility API contains subsets of related functions that let you perform specific types of tasks.
000_DW_API_Print.book Page 26 Wednesday, August 20, 2003 9:14 AM Background This book assumes that you are familiar with Dreamweaver, HTML, XML, JavaScript programming and, if applicable, C programming. If you are writing extensions for building web applications, you should also be familiar with server-side scripting on at least one platform, such as Active Server Pages (ASP), ASP.net, PHP: Hypertext Preprocessor (PHP), ColdFusion, or Java Server Pages (JSP).
000_DW_API_Print.book Page 27 Wednesday, August 20, 2003 9:14 AM Document The following new Global document functions have been added to the Document chapter. Global document • • • “dom.hideInfoMessagePopup()” on page 268 “dreamweaver.showTargetBrowsersDialog()” on page 276 “dom.showInfoMessagePopup()” on page 269 Design The following new CSS, HTML, and Table Editing functions have been added to the Design chapter. CSS • • • • “dreamweaver.cssRuleTracker.newRule()” on page 347 “dreamweaver.
000_DW_API_Print.book Page 28 Wednesday, August 20, 2003 9:14 AM Page content In the Page Content chapter, the following Timeline functions have been removed: Timeline functions • • • • • • • • • • • • • • • • • • • dreamweaver.timelineInspector.addBehavior() dreamweaver.timelineInspector.addFrame() dreamweaver.timelineInspector.addKeyframe() dreamweaver.timelineInspector.addObject() dreamweaver.timelineInspector.addTimeline() dreamweaver.timelineInspector.changeObject() dreamweaver.timelineInspector.
000_DW_API_Print.book Page 29 Wednesday, August 20, 2003 9:14 AM Code In the Code chapter, the following JavaScript Debugger and Tag Inspector functions have been removed: JS Debugger functions • • • • dreamweaver.debugDocument() dreamweaver.startDebugger() dreamweaver.getIsAnyBreakpoints() dreamweaver.removeAllBreakpoints() Tag Inspector functions • • • • • • • • • • dreamweaver.tagInspector.deleteTags() dreamweaver.tagInspector.deleteTagsEnabled() dreamweaver.tagInspector.editTagName() dreamweaver.
000_DW_API_Print.book Page 30 Wednesday, August 20, 2003 9:14 AM The Extending Dreamweaver book is designed to serve the user who wants to learn how to build a Dreamweaver extension. The Dreamweaver API Reference is designed to serve the experienced Dreamweaver programmer who wants to quickly locate the right function to accomplish a particular task.
000_DW_API_Print.book Page 31 Wednesday, August 20, 2003 9:14 AM Learn about the Macromedia Dreamweaver MX 2004 utility functions that you can use to access local and web-based files, work with Macromedia Fireworks MX 2004, and Macromedia Flash MX 2004 objects, manage database connections, create new database connection types, access JavaBeans fscomponents, and integrate Dreamweaver with various source control systems. Chapter 2: The File I/O API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
000_DW_API_Print.
000_DW_API_Print.book Page 33 Wednesday, August 20, 2003 9:14 AM CHAPTER 2 The File I/O API Macromedia Dreamweaver MX 2004 includes a C shared library called DWfile, which gives authors of objects, commands, behaviors, data translators, floating panels, and Property inspectors the ability to read and write files on the local file system. This chapter describes the File I/O API and how to use it.
000_DW_API_Print.book Page 34 Wednesday, August 20, 2003 9:14 AM DWfile.copy() Availability Dreamweaver 3. Description This function copies the specified file to a new location. Arguments originalURL, copyURL • The originalURL argument, which is expressed as a file:// URL, is the file you want to copy. • The copyURL argument, which is expressed as a file:// URL, is the location where you want to save the copied file. Returns A Boolean value: true if the copy succeeds; false otherwise.
000_DW_API_Print.book Page 35 Wednesday, August 20, 2003 9:14 AM DWfile.exists() Availability Dreamweaver 2. Description This function tests for the existence of the specified file. Arguments fileURL • The fileURL argument, which is expressed as a file:// URL, is the requested file. Returns A Boolean value: true if the file exists; false otherwise. Example The following code checks for the mydata.
000_DW_API_Print.book Page 36 Wednesday, August 20, 2003 9:14 AM Example The following code gets the attributes of the mydata.txt file and displays an alert box if the file is read only: 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.
000_DW_API_Print.book Page 37 Wednesday, August 20, 2003 9:14 AM DWfile.getCreationDate() Availability Dreamweaver 4. Description This function gets the time when the file was created. Arguments fileURL • The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the creation time. Returns A string that contains a hexadecimal number that represents the number of time units that have elapsed since some base time.
000_DW_API_Print.book Page 38 Wednesday, August 20, 2003 9:14 AM DWfile.getModificationDateObj() Availability Dreamweaver MX. Description This function gets the JavaScript Date object that represents the time when the file was last modified. Arguments fileURL • The fileURL argument, which is expressed as a file:// URL, is the file for which you are checking the time of the most recent modification.
000_DW_API_Print.book Page 39 Wednesday, August 20, 2003 9:14 AM Arguments folderURL, {constraint} • The folderURL argument is the folder for which you want a contents list, which is expressed as • a file:// URL, plus an optional wildcard file mask. Valid wildcards are asterisks (*), which match one or more characters, and question marks (?), which match a single character. The constraint argument, if it is supplied, must be either "files" (return only files) or "directories" (return only folders).
000_DW_API_Print.book Page 40 Wednesday, August 20, 2003 9:14 AM DWfile.remove() Availability Dreamweaver 3. Description This function moves the specified file to the Recycling Bin or Trash. Arguments fileURL • The fileURL argument, which is expressed as a file:// URL, is the file you want to remove. Returns A Boolean value: true value if the operation succeeds; false otherwise. Example The following example uses the DWfile.
000_DW_API_Print.book Page 41 Wednesday, August 20, 2003 9:14 AM DWfile.setAttributes() Availability Dreamweaver MX. Description This function sets the system-level attributes of a particular file. Arguments fileURL, strAttrs • The fileURL argument, which is expressed as a file:// URL, identifies the file for which you are setting the attributes. • The strAttrs argument specifies the system-level attributes for the file that is identified by the fileURL argument.
000_DW_API_Print.book Page 42 Wednesday, August 20, 2003 9:14 AM DWfile.write() Availability Dreamweaver 2. 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 fileURL argument, which is expressed as a file:// URL, is the file to which you are writing. • The text argument is the string to be written. • The mode argument, if it is supplied, must be "append".
000_DW_API_Print.book Page 43 Wednesday, August 20, 2003 9:14 AM CHAPTER 3 The HTTP API Extensions are not limited to working within the local file system. Macromedia Dreamweaver MX 2004 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. How the HTTP API works All functions in the HTTP API are methods of the MMHttp object.
000_DW_API_Print.book Page 44 Wednesday, August 20, 2003 9:14 AM The HTTP API This section details the functions that are methods of the MMHttp object. MMHttp.clearServerScriptsFolder() Availability Dreamweaver MX. Description Deletes the _mmServerScripts folder—and all its files—under the root folder for the current site, which can be local or remote. The _mmServerScripts folder is located in Configuration/ Connections/Scripts/server-model/_mmDBScripts folder.
000_DW_API_Print.book Page 45 Wednesday, August 20, 2003 9:14 AM 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.
000_DW_API_Print.book Page 46 Wednesday, August 20, 2003 9:14 AM Returns An object that represents the reply from the server. The data property of this object is a string that contains the location where the file is saved, which is expressed as a file:// URL. Normally, the statusCode property of the object contains the status code that is received from the server.
000_DW_API_Print.book Page 47 Wednesday, August 20, 2003 9:14 AM MMHttp.getFileCallback() Description This function gets the file at the specified URL, saves it in the Configuration/Temp folder inside the Dreamweaver application folder, and then calls the specified function with the request ID and reply result. When saving the file locally, Dreamweaver automatically creates subfolders that mimic the folder structure of the server; for example, if the specified file is at www.dreamcentral.com/people/index.
000_DW_API_Print.book Page 48 Wednesday, August 20, 2003 9:14 AM • The serverScriptsFolder argument is an optional string that names a particular folder— relative to the Configuration folder on the application server—from which you want to retrieve server scripts. To retrieve the scripts, Dreamweaver uses the appropriate transfer protocol (such as FTP, WebDAV, or Remote File System). Dreamweaver copies these files to the _mmServerScripts subfolder under the root folder for the current site.
000_DW_API_Print.book Page 49 Wednesday, August 20, 2003 9:14 AM • The dataToPost argument is the data to post. If the third argument is "application/x-wwwform-urlencoded" or omitted, dataToPost must be form-encoded according to section 8.2.1 of the RFC 1866 specification (available at www.faqs.org/rfcs/rfc1866.html). • The contentType argument, which is optional, is the content type of the data to post. If omitted, this argument defaults to "application/x-www-form-urlencoded".
000_DW_API_Print.book Page 50 Wednesday, August 20, 2003 9:14 AM • The dataToPost argument is the data to be posted. If the third argument is "application/xor omitted, data must be form-encoded according to section 8.2.1 of the RFC 1866 specification (available at www.faqs.org/rfcs/rfc1866.html). The contentType argument, which is optional, is the content type of the data to be posted. If omitted, this argument defaults to "application/x-www-form-urlencoded".
000_DW_API_Print.book Page 51 Wednesday, August 20, 2003 9:14 AM CHAPTER 4 The Design Notes API Macromedia Dreamweaver MX 2004, Macromedia Fireworks MX 2004, and Macromedia Flash MX 2004 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. MMNotes is a C shared library that lets extensions authors read and write Design Notes files.
000_DW_API_Print.book Page 52 Wednesday, August 20, 2003 9:14 AM The Design Notes JavaScript API All functions in the Design Notes JavaScript API are methods of the MMNotes object. MMNotes.close() Description This function closes the specified Design Notes file and saves any changes. If all the key/value pairs are removed, Dreamweaver deletes the Design Notes file. If it is the last Design Notes file in the _notes folder, Dreamweaver also deletes the folder. Note: Always call the MMNotes.
000_DW_API_Print.book Page 53 Wednesday, August 20, 2003 9:14 AM MMNotes.get() Description This function gets the value of the specified key in the specified Design Notes file. Arguments fileHandle, keyName • The fileHandle argument is the file handle that MMNotes.open() returns. • The keyName argument is a string that contains the name of the key. Returns A string that contains the value of the key. Example See “MMNotes.getKeys()” on page 53. MMNotes.
000_DW_API_Print.book Page 54 Wednesday, August 20, 2003 9:14 AM Example The following code might be used in a custom floating panel to display the Design Notes information for the active document: 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 += theKeys[i] + " = " theValue + "\n"; } document.theForm.bigTextField.
000_DW_API_Print.book Page 55 Wednesday, August 20, 2003 9:14 AM MMNotes.getVersionNum() Description This function gets the version number of the MMNotes shared library. 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 fileURL argument, which is expressed as a file:// URL, is the path to a local file.
000_DW_API_Print.book Page 56 Wednesday, August 20, 2003 9:14 AM MMNotes.remove() Description The function removes the specified key (and its value) from the specified Design Notes file. Arguments fileHandle, keyName • The fileHandle argument is the file handle that the MMNotes.open() function returns. • The keyName argument is a string that contains the name of the key to remove. Returns A Boolean value: true indicates the operation is successful; false otherwise. MMNotes.
000_DW_API_Print.book Page 57 Wednesday, August 20, 2003 9:14 AM The Design Notes C API In addition to the JavaScript API, the MMNotes shared library also exposes a C API that lets other applications create Design Notes files. It is not necessary to call these C functions directly if you use the MMNotes shared library in Dreamweaver because the JavaScript versions of the functions call them. This section contains descriptions of the functions, their arguments, and their return values.
000_DW_API_Print.book Page 58 Wednesday, August 20, 2003 9:14 AM BOOL GetNote() Description This function gets the value of the specified key in the specified Design Notes file. Arguments FileHandle noteHandle, const char keyName[64], char* valueBuf, int valueBufLength • • • • The noteHandle argument is the file handle that the OpenNotesFile() function returns. The keyName[64] argument is a string that contains the name of the key. The valueBuf argument is the buffer where the value is stored.
000_DW_API_Print.book Page 59 Wednesday, August 20, 2003 9:14 AM int GetNotesKeyCount() Description This function gets the number of key/value pairs in the specified Design Notes file. Arguments FileHandle noteHandle • The noteHandle argument is the file handle that the OpenNotesFile() function returns. Returns An integer that represents the number of key/value pairs in the Design Notes file. BOOL GetNotesKeys() Description This function gets a list of all the keys in a Design Notes file.
000_DW_API_Print.book Page 60 Wednesday, August 20, 2003 9:14 AM BOOL GetSiteRootForFile() Description This function determines the site root for the specified Design Notes file. Arguments const char* filePath, char* siteRootBuf, int siteRootBufMaxLen, {InfoPrefs* infoPrefs} • The filePath argument is the file://URL of the file for which you want the site root. • The siteRootBuf argument is the buffer where the site root is stored.
000_DW_API_Print.book Page 61 Wednesday, August 20, 2003 9:14 AM BOOL GetVersionNum() Description This function gets the version number of the MMNotes shared library, which lets you determine whether certain functions are available. Arguments char* versionNumBuf, int versionNumBufMaxLen • The versionNumBuf argument is the buffer where the version number is stored. • The versionNumBufMaxLen argument is the maximum size of the buffer that versionNumBuf references.
000_DW_API_Print.book Page 62 Wednesday, August 20, 2003 9:14 AM FileHandle OpenNotesFilewithOpenFlags() Description This function opens the Design Notes file that is associated with the specified file or creates one if none exists. You can open the file in read-only mode.
000_DW_API_Print.book Page 63 Wednesday, August 20, 2003 9:14 AM CHAPTER 5 Fireworks Integration FWLaunch is a C shared library that gives authors of objects, commands, behaviors, and Property inspectors the ability to communicate with Macromedia Fireworks MX 2004. Using FWLaunch, you write JavaScript to open the Fireworks user interface (UI) and provide commands to Fireworks through its own JavaScript API documented in the Extending Fireworks manual.
000_DW_API_Print.book Page 64 Wednesday, August 20, 2003 9:14 AM 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.
000_DW_API_Print.book Page 65 Wednesday, August 20, 2003 9:14 AM FWLaunch.getJsResponse() Availability Dreamweaver 3, Fireworks 3. Description This function determines whether Fireworks is still executing the JavaScript passed to it by the FWLaunch.execJsInFireworks() function, whether the script completed successfully, or whether an error occurred. Arguments progressTrackerCookie • The progressTrackerCookie argument is the cookie object that the FWLaunch.execJsInFireworks() function returns.
000_DW_API_Print.book Page 66 Wednesday, August 20, 2003 9:14 AM // got a valid response! alert("Nice to meet you, " + response); window.close(); } doneFlag = true; } } } FWLaunch.mayLaunchFireworks() Availability Dreamweaver 2, Fireworks 2. Description This function determines whether it is possible to open a Fireworks optimization session. Arguments None.
000_DW_API_Print.book Page 67 Wednesday, August 20, 2003 9:14 AM Returns Zero, if a Fireworks optimization session successfully opens for the specified image; otherwise, a nonzero error code that indicates one of the following errors occurred: • Invalid usage, which indicates that the docURL argument, the imageURL argument, or both, are • • • • specified as a null value or an empty string. File I/O error, which indicates that Fireworks cannot create a response file because the disk is full.
000_DW_API_Print.book Page 68 Wednesday, August 20, 2003 9:14 AM A simple FWLaunch communication example The following command asks Fireworks to prompt the user for their name and returns the name to Dreamweaver:
Prompt in Fireworks