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. These functions let you get information about these external applications and open files with them.

dreamweaver.browseDocument()

Availability

Dreamweaver 2; enhanced in 3 and 4.

Description

Opens the specified URL in the specified browser.

Arguments

fileName, {browser}

  • The fileName argument is the name of the file to open, which is expressed as an absolute.

  • The browser argument specifies a browser. This argument can be the name of a browser, as defined in the Preview in Browser preferences, or either primary or secondary. If the argument is omitted, the URL opens in the primary browser of the user.

Note:

Some browsers cannot locate the file if the URL contains an anchor, such as "Configuration/ExtensionHelp/browseHelp.htm#helpyou.”

Returns

Nothing.

Example

The following function uses the dreamweaver.browseDocument() function to open the Adobe Home page in a browser:

 function goToadobe(){ 
    dreamweaver.browseDocument('http://www.adobe.com/'); 
}

In Dreamweaver 4, you can expand this operation to open the document in Microsoft Internet Explorer using the following code:

 function goToadobe(){ 
    var prevBrowsers = dw.getBrowserList(); 
    var theBrowser = ""; 
    for (var i=1; i < prevBrowsers.length; i+2){ 
        if (prevBrowsers[i].indexOf('Iexplore.exe') != -1){ 
            theBrowser = prevBrowsers[i]; 
            break; 
        } 
    } 
    dw.browseDocument('http://www.adobe.com/',theBrowser); 
}

For more information on the dreamweaver.getBrowserList() function, see dreamweaver.getBrowserList().

dreamweaver.getBrowserList()

Availability

Dreamweaver 3.

Description

Gets a list of all the browsers in the File > Preview in Browser submenu.

Arguments

None.

Returns

An array that contains a pair of strings for each browser in the list. The first string in each pair is the name of the browser, and the second string is its location on the computer of the user, which is expressed as a file:// URL. If no browsers appear in the submenu, the function returns nothing.

dreamweaver.getExtensionEditorList()

Availability

Dreamweaver 3

Description

Gets a list of editors for the specified file from the External Editors preferences.

Arguments

fileURL

  • The fileURL argument can be a complete file:// URL, a filename, or a file extension (including the period).

Returns

An array that contains a pair of strings for each editor in the list. The first string in each pair is the name of the editor, and the second string is its location on the computer of the user, which is expressed as a file:// URL. If no editors appear in Preferences, the function returns an array that contains one empty string.

Example

A call to the dreamweaver.getExtensionEditorList(".gif") function might return an array that contains the 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.

Returns

A string that contains the name of the text editor that is suitable for presentation in the user interface (UI), not the full path.

dreamweaver.getFlashPath()

Availability

Dreamweaver MX.

Description

Gets the full path to the Flash MX application in the form of a file URL.

Arguments

None.

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.

Example

The following example calls the dw.getFlashPath() function to obtain the path to the Flash application and then passes the path in the form of a file://URL to the dw.openWithApp() function to open the document with Flash:

 var myDoc = dreamweaver.getDocumentDOM(); 
 
if (dreamweaver.validateFlash()) { 
    var flashArray = dreamweaver.getFlashPath(); 
    dreamweaver.openWithApp(myDoc.myForm.swfFilePath, flashArray[1]); 
}

dreamweaver.getPrimaryBrowser()

Availability

Dreamweaver 3.

Description

Gets the path to the primary browser.

Arguments

None.

Returns

A string that contains the path on the computer of the user to the primary browser, which is expressed as a file:// URL. If no primary browser is defined, it returns nothing.

dreamweaver.getPrimaryExtensionEditor()

Availability

Dreamweaver 3.

Description

Gets the primary editor for the specified file.

Arguments

fileURL

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

Returns

An array that contains a pair of strings. The first string in the pair is the name of the editor, and the second string is its location on the computer of the user, which is expressed as a file:// URL. If no primary editor is defined, the function returns an array that contains one empty string.

dreamweaver.getSecondaryBrowser()

Availability

Dreamweaver 3.

Description

Gets the path to the secondary browser.

Arguments

None.

Returns

A string that contains the path on the computer of the user to the secondary browser, which is expressed as a file:// URL. If no secondary browser is defined, it returns nothing.

dreamweaver.openHelpURL()

Availability

Dreamweaver MX.

Description

Opens the specified Help file in the operating system Help viewer.

Dreamweaver displays help content in the standard operating system help viewer instead of a browser. Help content is in HTML, but it is packaged for Windows HTML Helpor Help Viewer for Mac OS X.

The following four types of files comprise the full help content. For more information on Help files, see your operating system documentation.

  • Help book

    The Help book consists of the HTML Help files, images, and indexes. In Windows, the Help book is a file that has a name with a .chm extension. On the Macintosh, the Help book is a folder.

    The Help book files reside in the Dreamweaver Help folder.

  • The help.xml file

    The help.xml file maps book IDs to help book names. For example, the following XML code maps the book ID for Dreamweaver Help to the filenames that contains help on both the Windows and Macintosh operating systems:

    <?xml version = "1.0" ?> <help-books><book-id id="DW_Using" win-mapping="UsingDreamweaver.chm" mac-mapping="Dreamweaver Help"/> </help-books>

    Each book-id entry has the following attributes:

    • The id attribute is the book ID that is used in the help.map and HelpDoc.js files.

    • The win-mapping attribute is the Windows book name, which is "UsingDreamweaver.chm" in this example.

    • The mac-mapping attribute is the Macintosh book name, which is "Dreamweaver Help" in this example.

  • The help.map file

    The help.map file maps a help content ID to a specific help book. Dreamweaver uses the help.map file to locate specific help content when it calls help internally.

  • The helpDoc.js file

    The helpDoc.js file lets you map variable names that you can use in place of the actual book ID and page string. The helpDoc.js file maps a help content ID to an HTML page in a specific help book. Dreamweaver uses the helpDoc.js file when it calls help from JavaScript.

Arguments

bookID

  • The bookID argument, which is required, has the format: ID:page

    The ID portion is the bookID of the entry in the help.xml file that names the file that contains the help content to display. The page portion of the entry identifies the specific page to display. The pages are referenced in the help.map file.

Returns

A Boolean value: true if successful; false if Dreamweaver cannot open the specified file in the help viewer.

Example

 openHelpURL("DW_Using:index.htm");

dreamweaver.openWithApp()

Availability

Dreamweaver 3.

Description

Opens the specified file with the specified application.

Arguments

fileURL, appURL

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

  • The appURL argument is the path to the application that is to open the file, which is expressed as a file:// URL.

Returns

Nothing.

dreamweaver.openWithBrowseDialog()

Availability

Dreamweaver 3.

Description

Opens the Select External Editor dialog box to let the user select the application with which to open the specified file.

Arguments

fileURL

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

Returns

Nothing.

dreamweaver.openWithExternalTextEditor()

Availability

Dreamweaver 3.

Description

Opens the current document in the external text editor that is specified in the External Editors entry in the Preferences dialog box.

Arguments

None.

Returns

Nothing.

dreamweaver.openWithImageEditor()

Availability

Dreamweaver 3.

Description

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.

Arguments

fileURL, appURL

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

  • The appURL argument is the path to the application with which to open the file, which is expressed as a file:// URL.

Returns

Nothing.

dreamweaver.validateFlash()

Availability

Dreamweaver MX.

Description

Determines whether Flash MX (or a later version) is installed on the local computer.

Arguments

None.

Returns

A Boolean value: true if Flash MX (or a later version) is installed on the local computer; false otherwise.

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.

Arguments:

strFiles

  • The strFiles argument is a string that specifies the file \paths and names of the files to insert. Multiple filenames can be passed to this function.

Returns

Nothing

dreamweaver.activateApp()

Availability

Dreamweaver CS3.

Description

Makes the specified application the frontmost application.

Arguments:

applicationID

  • The applicationID is a string that specifies the application to activate, such as dreamweaver.

Returns

Nothing

dreamweaver.printDocument()

Availability

Dreamweaver CS3.

Description

Performs the equivalent of the Dreamweaver File > Print Code command on the requested file.

Arguments:

fileName

  • The fileName argument is a string that specifies the name of the file to print, expressed as a URL.

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.

Arguments:

fileName

  • The fileName is a string that specifies the name of the file to reveal, expressed as a URL.

Returns

Nothing

dreamweaver.launchApp()

Availability

Dreamweaver CS5.

Description

Launches the specified application with optional command line arguments.

Arguments:

fileURL

  • The fileURL is the path to the application specified as a file:// URL.

optionalArgs

  • The optionalArgs is a string that can be used to pass command line arguments to the specified application.

Returns

Nothing

Example

// Launches the notepad application to edit filefoo.txt file. 
dreamweaver.launchApp("file:///c:/windows/system32/notepad.exe",  “c:\temp\foo.txt”); 
// Launches myapp with some command line arguments. 
dreamweaver.launchApp("file:///c:/bin/myapp.exe",  “-chrome false –print c:\temp\foo.txt”);

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