< Day Day Up > |
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.close() function when you finish with Design Notes so Dreamweaver writes to the file. Arguments fileHandle
Returns Nothing. Example See "MMNotes.set()" on page 549. MMNotes.filePathToLocalURL()Description This function converts the specified local drive path to a file://URL. Arguments drivePath
Returns A string that contains the file://URL for the specified file. Example A call to MMNotes.filePathToLocalURL('C:\sites\webdev\index.htm') returns "file:///c|/sites/webdev/index.htm". MMNotes.get()Description This function gets the value of the specified key in the specified Design Notes file. Arguments fileHandle, keyName
Returns A string that contains the value of the key. Example See "MMNotes.getKeys()" on page 546. MMNotes.getKeyCount()Description This function gets the number of key/value pairs in the specified Design Notes file. Arguments fileHandle
Returns An integer that represents the number of key/value pairs in the Design Notes file. MMNotes.getKeys()Description This function gets a list of all the keys in a Design Notes file. Arguments fileHandle
Returns An array of strings where each string contains the name of a key. Example The following code might be used in a custom floating panel to display the Design Notes information for the active document: 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.value = noteString; // always close noteHandle MMNotes.close(noteHandle); MMNotes.getSiteRootForFile()Description This function determines the site root for the specified Design Notes file. Arguments fileURL
Returns A string that contains the path of the Local Root folder for the site, which is expressed as a file:// URL, or an empty string if Dreamweaver is not installed or the Design Notes file is outside any site that is defined with Dreamweaver. This function searches for all the sites that are defined in Dreamweaver. MMNotes.getVersionName()Description This function gets the version name of the MMNotes shared library, which indicates the application that implemented it. Arguments None. Returns A string that contains the name of the application that implemented the MMNotes shared library. Example Calling the MMNotes.getVersionName() function from a Dreamweaver command, object, behavior, Property inspector, floating panel, or data translator returns "Dreamweaver". Calling the MMNotes.getVersionName() function from Fireworks also returns "Dreamweaver" because Fireworks uses the same version of the library, which was created by the Dreamweaver engineering team. 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
Returns A string that contains the local drive path for the specified file. Example A call to MMNotes.localURLToFilePath('file:///MacintoshHD/images/moon.gif') returns "MacintoshHD:images:moon.gif". MMNotes.open()Description This function opens the Design Notes file that is associated with the specified file or creates one if none exists. Arguments filePath, {bForceCreate}
Returns The file handle for the Design Notes file or 0 if the file was not opened or created. Example See "MMNotes.set()" on page 549. MMNotes.remove()Description The function removes the specified key (and its value) from the specified Design Notes file. Arguments fileHandle, keyName
Returns A Boolean value: TRue indicates the operation is successful; false otherwise. MMNotes.set()Description This function creates or updates one key/value pair in a Design Notes file. Arguments fileHandle, keyName, valueString
Returns A Boolean value: true indicates the operation is successful; false otherwise. Example The following example opens the Design Notes file that is associated with a file in the dreamcentral site called peakhike99/index.html, adds a new key/value pair, changes the value of an existing key, and then closes the Design Notes file: var noteHandle = MMNotes.open('file:///c|/sites/dreamcentral/ peakhike99/index.html',true); if(noteHandle > 0){ MMNotes.set(noteHandle,"Author","M. G. Miller"); MMNotes.set(noteHandle,"Last Changed","August 28, 1999"); MMNotes.close(noteHandle); } |
< Day Day Up > |