All functions in the Design Notes JavaScript API are methods of the MMNotes object. MMNotes is a C shared library that lets extensions authors read and write Design Notes files. As with the DWfile shared library, MMNotes has a JavaScript API that lets you call the functions. The functions are called from objects, commands, behaviors, floating panels, Property inspectors, and data translators in the library. The MMNotes shared library can be used independently, even if Dreamweaver is not installed.

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 deletes the folder also.

Note:

Always call the MMNotes.close() function when you finish with Design Notes so Dreamweaver writes to the file.

Arguments

fileHandle

  • The fileHandle argument is the file handle that the MMNotes.open() function returns.

Returns

Nothing.

Example

MMNotes.filePathToLocalURL()

Description

This function converts the specified local drive path to a file:// URL.

Arguments

drivePath

  • The drivePath argument is a string that contains the full drive path.

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

  • 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

MMNotes.getKeyCount()

Description

This function gets the number of key/value pairs in the specified Design Notes file.

Arguments

fileHandle

  • The fileHandle argument is the file handle that the MMNotes.open() function returns.

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

  • The fileHandle argument is the file handle that the MMNotes.open() function returns.

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 +=0theKeys[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

  • The fileURL argument, which is expressed as a file:// URL, is the path to a local file.

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

  • The fileURL argument, which is expressed as a file:// URL, is the path to a local file.

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}

  • The filePath argument, which is expressed as a file:// URL, is the path to the main file with which the Design Notes file is associated.

  • The bForceCreate argument is a Boolean value that indicates whether to create the note even if Design Notes is turned off for the site or if the filePath argument is not associated with any site.

Returns

The file handle for the Design Notes file or 0 if the file was not opened or created.

Example

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.set()

Description

This function creates or updates one key/value pair in a Design Notes file.

Arguments

fileHandle, keyName, valueString

  • 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.

  • The valueString argument is a string that contains the value.

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); 
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy