External application functions

 < Day Day Up > 

External application functions handle operations that are related to the Macromedia Flash application 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 URL.

    NOTE

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


  • The browser argument, which was added in Dreamweaver 3, 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 user's primary browser.

Returns

Nothing.

Example

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

 function goToHotwired(){   dreamweaver.browseDocument('http://www.hotwired.com/'); } 

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

 function goToHotwired(){   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.hotwired.com/',theBrowser); } 

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

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 user's computer, 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 user's computer, 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/Macromedia/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 user's computer 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 user's computer, 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 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.

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 Help or 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

    A 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  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 following 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 value of 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 invokes a special Macromedia 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, this function should never be called 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.

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net