MACROMEDIA Dreamweaver 8 Reference

Category
Software
Type
Reference

This manual is also suitable for

Dreamweaver API Reference
000_DW_API_Print.book Page 1 Wednesday, July 20, 2005 11:58 AM
Trademarks
1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central,
ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite,
FlashPaper, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML,
RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev,
and WebHelp are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or
in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within
this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in
certain jurisdictions including internationally.
Third-Party Information
This guide contains links to third-party websites that are not under the control of Macromedia, and Macromedia is not
responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your
own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia
endorses or accepts any responsibility for the content on those third-party sites.
Opera ® browser Copyright © 1995-2002 Opera Software ASA and its suppliers. All rights reserved.
Copyright © 2005 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced,
translated, or converted to any electronic or machine-readable form in whole or in part without written approval from
Macromedia, Inc. Notwithstanding the foregoing, the owner or authorized user of a valid copy of the software with which
this manual was provided may print out one copy of this manual from an electronic version of this manual for the sole
purpose of such owner or authorized user learning to use such software, provided that no part of this manual may be
printed out, reproduced, distributed, resold, or transmitted for any other purposes, including, without limitation,
commercial purposes, such as selling copies of this documentation or providing paid-for support services.
Acknowledgments
Project Management: Charles Nadeau, Robert Berry
Writing: Anne Sandstrom
Editing: Anne Szabla, John Hammett
Production and Editing Management: Patrice O’Neill and Rosana Francescato
Media Design and Production: Adam Barnett, Aaron Begley, Paul Benkman, John Francis, Geeta Karmarkar
Localization Management: Melissa Baerwald
Special thanks to Jay London, Raymond Lim, Alain Dumesny, and the entire Dreamweaver engineering and QA teams.
First Edition: September 2005
Macromedia, Inc.
601 Townsend St.
San Francisco, CA 94103
000_DW_API_Print.book Page 2 Wednesday, July 20, 2005 11:58 AM
3
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Extending Dreamweaver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Additional resources for extension writers . . . . . . . . . . . . . . . . . . . . . . . . . 8
New functions in Dreamweaver 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Removed functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Errata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Conventions used in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
PART 1: UTILITY APIS
Chapter 1: The File I/O API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Accessing configuration folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
The File I/O API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 2: The HTTP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
How the HTTP API works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The HTTP API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Chapter 3: The Design Notes API . . . . . . . . . . . . . . . . . . . . . . . . . 39
How Design Notes work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
The Design Notes JavaScript API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
The Design Notes C API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 4: Fireworks Integration . . . . . . . . . . . . . . . . . . . . . . . . . 53
The FWLaunch API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 5: Flash Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
How Flash elements work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Inserting Flash elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
The Flash Objects API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
000_DW_API_Print.book Page 3 Wednesday, July 20, 2005 11:58 AM
4Contents
Chapter 6: The Database API . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
How Database API functions work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Database connection functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Database access functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Chapter 7: The Database Connectivity API . . . . . . . . . . . . . . . . . 101
How to develop a new connection type . . . . . . . . . . . . . . . . . . . . . . . . . .101
The Connection API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
The generated include file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
The definition file for your connection type . . . . . . . . . . . . . . . . . . . . . . 109
Chapter 8: The JavaBeans API. . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
The JavaBeans API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 9: The Source Control Integration API . . . . . . . . . . . . . .117
How source control integration with Dreamweaver works. . . . . . . . . .118
Adding source control system functionality. . . . . . . . . . . . . . . . . . . . . . .118
The Source Control Integration API required functions . . . . . . . . . . . .119
The Source Control Integration API optional functions . . . . . . . . . . . 126
Enablers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
PART 2: JAVASCRIPT API
Chapter 10: Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
External application functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Global application functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Chapter 11: Workspace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
History functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
Insert object functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Keyboard functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Menu functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Results window functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Toggle functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Toolbar functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
Window functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229
Code collapse functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Code view toolbar functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
000_DW_API_Print.book Page 4 Wednesday, July 20, 2005 11:58 AM
Contents 5
Chapter 12: Site. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Report functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Site functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Chapter 13: Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Conversion functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Command functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
File manipulation functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Global document functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321
Path functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Selection functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
String manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Translation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
XSLT functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .351
Chapter 14: Page Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Assets panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Behavior functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Clipboard functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Library and template functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Snippets panel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391
Chapter 15: Dynamic Documents . . . . . . . . . . . . . . . . . . . . . . . . 397
Server Components functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Data source functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Extension Data Manager functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Live data functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Server behavior functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Server model functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .410
Chapter 16: Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
CSS functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .419
Frame and frameset functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .441
Layer and image map functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Layout environment functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Layout view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Zoom functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Guide functions and properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Table editing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
000_DW_API_Print.book Page 5 Wednesday, July 20, 2005 11:58 AM
6Contents
Chapter 17: Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Code functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Find/replace functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
General editing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
Print function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Quick Tag Editor functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Code view functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
Tag editor and tag library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Chapter 18: Enablers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Enablers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
000_DW_API_Print.book Page 6 Wednesday, July 20, 2005 11:58 AM
7
Introduction
The Dreamweaver API Reference describes two application programming interfaces (APIs) that
let you perform various supporting tasks when developing Macromedia Dreamweaver 8
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. The utility API includes the following API subsets:
The File I/O API, which lets you read and write files on the local file system
The HTTP API, which lets you send and receive information from a web server
The Design Notes API, which lets you store and retrieve notes about Dreamweaver
documents
The Fireworks Integration API, which lets you communicate with Macromedia Fireworks
Flash Integration, which contains information about adding Flash elements to the
Dreamweaver user interface (UI) and details on the Flash Objects API (which lets you
build objects that create Macromedia Flash content)
The Database API, which lets you access information stored in databases and manage
database connections
The Database Connectivity API, which lets you create a new connection type and
corresponding dialog boxes for new or existing server models
The JavaBeans API, which retrieves class names, methods, properties, and events for
JavaBeans that you have defined
The Source Control Integration API, which lets you write shared libraries to extend the
Dreamweaver Check In/Check Out feature
The extensive JavaScript API lets you perform a diverse set of smaller tasks, many of which are
tasks that a user would perform when creating or editing Dreamweaver documents. These
API functions are grouped by the parts of the Dreamweaver UI that they affect. For example,
the JavaScript API includes Workspace functions, Document functions, Design functions,
and so on. These functions let you perform tasks such as opening a new document, getting or
setting a font size, finding the occurrence of a search string in HTML code, making a toolbar
visible, and much more.
000_DW_API_Print.book Page 7 Wednesday, July 20, 2005 11:58 AM
8Introduction
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).
Extending Dreamweaver
To learn about the Dreamweaver framework and the API that enables you to build
Dreamweaver extensions, see Extending Dreamweaver. Extending Dreamweaver describes the
API functions that Dreamweaver calls to implement the objects, menus, floating panels,
server behaviors, and so on, that comprise the various features of Dreamweaver. You can use
those APIs to add objects, menus, floating panels, or other features to the product. Extending
Dreamweaver also explains how to customize Dreamweaver by editing and adding tags to
various HTML and XML files to add menu items or document types, and so on.
Additional resources for extension writers
To communicate with other developers who are involved in writing extensions, you might
want to join the Dreamweaver extensibility newsgroup. You can access the website for this
newsgroup at www.macromedia.com/go/extending_newsgrp/.
New functions in Dreamweaver 8
The following new functions have been added to the Dreamweaver 8 JavaScript API. The
headings designate the chapters and sections that contain the new functions:
Application
The following Global application functions have been added to the Application chapter.
Global application
dreamweaver.showPasteSpecialDialog() on page 158
dreamweaver.showPreferencesDialog() on page 159 (added new argument)
000_DW_API_Print.book Page 8 Wednesday, July 20, 2005 11:58 AM
New functions in Dreamweaver 8 9
Workspace
The following new Window, Code collapse, and Code view toolbar functions have been
added to the Workspace chapter.
Window
dreamweaver.cascade() on page 231 (added support for the Macintosh)
dreamweaver.tileHorizontally() on page 239 (added support for the Macintosh)
dreamweaver.tileVertically() on page 240 (added support for the Macintosh)
Code collapse
dom.collapseFullTag() on page 241
dom.collapseSelectedCodeFragment() on page 243
dom.collapseSelectedCodeFragmentInverse() on page 243
dom.expandAllCodeFragments() on page 244
dom.expandSelectedCodeFragments() on page 245
dreamweaver.htmlInspector.collapseFullTag() on page 245
dreamweaver.htmlInspector.collapseSelectedCodeFragment() on page 246
dreamweaver.htmlInspector.collapseSelectedCodeFragmentInverse()
on page 247
dreamweaver.htmlInspector.expandAllCodeFragments() on page 248
dreamweaver.htmlInspector.expandSelectedCodeFragments() on page 248
Code view toolbar
dom.getOpenPathName() on page 249
dom.getShowHiddenCharacters() on page 249
dom.setShowHiddenCharacters() on page 250
dom.source.applyComment() on page 251
dom.source.removeComment() on page 251
dreamweaver.htmlInspector.getShowHiddenCharacters() on page 252
dreamweaver.htmlInspector.setShowHiddenCharacters() on page 253
Site
The following new Site functions have been added to the Site chapter.
000_DW_API_Print.book Page 9 Wednesday, July 20, 2005 11:58 AM
10 Introduction
Site
dom.getSiteURLPrefixFromDoc() on page 256
dom.localPathToSiteRelative() on page 257
dom.siteRelativeToLocalPath() on page 257
dreamweaver.compareFiles() on page 258
dreamweaver.siteSyncDialog.compare() on page 259
dreamweaver.siteSyncDialog.markDelete() on page 260
dreamweaver.siteSyncDialog.markGet() on page 260
dreamweaver.siteSyncDialog.markIgnore() on page 261
dreamweaver.siteSyncDialog.markPut() on page 261
dreamweaver.siteSyncDialog.markSynced() on page 262
site.compareFiles() on page 267
site.getAppURLPrefixForSite() on page 274
site.getSiteURLPrefix() on page 280
site.serverActivity() on page 290
site.siteRelativeToLocalPath() on page 294
Document
The following new File manipulation functions have been added to the Document chapter.
File manipulation
dreamweaver.getNewDocumentDOM() on page 312 (added new argument)
MMXSLT.getXMLSchema() on page 351
MMXSLT.getXMLSourceURI() on page 352
MMXSLT.launchXMLSourceDialog() on page 353
Page content
The following new Clipboard functions have been added to the Page content chapter:
Clipboard
dreamweaver.clipPaste() on page 383 (added new argument)
000_DW_API_Print.book Page 10 Wednesday, July 20, 2005 11:58 AM
New functions in Dreamweaver 8 11
Design
The following new CSS, Layout view, and Zoom functions have been added to the Design
chapter:
CSS
cssStylePalette.getInternetExplorerRendering() on page 419
cssStylePalette.setInternetExplorerRendering() on page 420
dom.getElementView() on page 421
dom.getShowDivBackgrounds() on page 422
dom.getShowDivBoxModel() on page 422
dom.getShowDivOutlines() on page 423
dom.resetAllElementViews() on page 424
dom.setElementView() on page 425
dom.setShowDivBackgrounds() on page 426
dom.setShowDivBoxModel() on page 426
dom.setShowDivOutlines() on page 427
dreamweaver.cssStylePalette.applySelectedStyle() on page 428 (added new
argument)
dreamweaver.cssStylePalette.deleteSelectedStyle() on page 429 (added new
argument)
dreamweaver.cssStylePalette.duplicateSelectedStyle() on page 430 (added
new argument)
dreamweaver.cssStylePalette.editSelectedStyle() on page 430 (added new
argument)
dreamweaver.cssStylePalette.editSelectedStyleInCodeview() on page 431
dreamweaver.cssStylePalette.getDisplayStyles() on page 432
dreamweaver.cssStylePalette.renameSelectedStyle() on page 436
dreamweaver.cssStylePalette.setDisplayStyles() on page 436
dreamweaver.getBlockVisBoxModelColors() on page 437
dreamweaver.getBlockVisOutlineProperties() on page 438
dreamweaver.getDivBackgroundColors() on page 439
dreamweaver.setBlockVisOutlineProperties() on page 439
dreamweaver.setDivBackgroundColors() on page 440
000_DW_API_Print.book Page 11 Wednesday, July 20, 2005 11:58 AM
12 Introduction
Layout view
dom.getShowBlockBackgrounds() on page 459
dom.getShowBlockBorders() on page 459
dom.getShowBlockIDs() on page 460
dom.getShowBoxModel() on page 461
dom.setShowBlockBackgrounds() on page 461
dom.setShowBlockBorders() on page 462
dom.setShowBlockIDs() on page 462
dom.setShowBoxModel() on page 463
Zoom
dreamweaver.activeViewScale() on page 464
dreamweaver.fitAll() on page 465
dreamweaver.fitSelection() on page 465
dreamweaver.fitWidth() on page 466
dreamweaver.zoomIn() on page 466
dreamweaver.zoomOut() on page 467
Guide
dom.clearGuides() on page 468
dom.createHorizontalGuide() on page 468
dom.createVerticalGuide() on page 469
dom.deleteHorizontalGuide() on page 470
dom.deleteVerticalGuide() on page 470
dom.guidesColor on page 471
dom.guidesDistanceColor on page 471
dom.guidesLocked on page 472
dom.guidesSnapToElements on page 473
dom.guidesVisible on page 473
dom.hasGuides() on page 474
dom.hasHorizontalGuide() on page 474
dom.hasVerticalGuide() on page 475
000_DW_API_Print.book Page 12 Wednesday, July 20, 2005 11:58 AM
Errata 13
Enablers
The following new functions have been added to the Enablers chapter:
dreamweaver.canFitSelection() on page 568
dreamweaver.canPasteSpecial() on page 568
dreamweaver.canZoom() on page 574
dreamweaver.cssStylePalette.canApplySelectedStyle() on page 575 (added new
argument)
dreamweaver.cssStylePalette.canDeleteSelectedStyle() on page 575 (added
new argument)
dreamweaver.cssStylePalette.canDuplicateSelectedStyle() on page 576 (added
new argument)
dreamweaver.cssStylePalette.canEditSelectedStyle() on page 577 (added new
argument)
dreamweaver.cssStylePalette.canEditSelectedStyleInCodeview() on page 577
dreamweaver.cssStylePalette.canRenameSelectedStyle() on page 578
dreamweaver.siteSyncDialog.canCompare() on page 582
dreamweaver.siteSyncDialog.canMarkDelete() on page 583
dreamweaver.siteSyncDialog.canMarkGet() on page 583
dreamweaver.siteSyncDialog.canMarkIgnore() on page 584
dreamweaver.siteSyncDialog.canMarkPut() on page 584
dreamweaver.siteSyncDialog.canMarkSynced() on page 585
site.canCompareFiles() on page 589
Removed functions
The following functions have been removed from the Dreamweaver 8 API because the
associated features have been removed from the product.
Errata
A current list of known issues can be found in the Extensibility section of the Dreamweaver
Support Center (www.macromedia.com/go/extending_errata).
000_DW_API_Print.book Page 13 Wednesday, July 20, 2005 11:58 AM
14 Introduction
Conventions used in this guide
The following typographical conventions are used in this guide:
Code font indicates code fragments and API literals, including class names, method
names, function names, type names, scripts, SQL statements, and both HTML and XML
tag and attribute names.
Italic code font indicates replaceable items in code.
The continuation symbol (¬) indicates that a long line of code has been broken across two
or more lines. Due to margin limits in this books format, what is otherwise a continuous
line of code must be split. When copying the lines of code, eliminate the continuation
symbol and type the lines as one line.
Curly braces ({ }) that surround a function argument indicate that the argument is
optional.
Function names that have the prefix dreamweaver.funcname can be abbreviated to
dw.funcname when you are writing code. This manual uses the full dreamweaver. prefix
when defining the function and in the index. Many examples use the
dw. prefix, however.
The following naming conventions are used in this guide:
You—the developer who is responsible for writing extensions
The user—the person using Dreamweaver
000_DW_API_Print.book Page 14 Wednesday, July 20, 2005 11:58 AM
15
1
PART 1
Utility APIs
Learn about the Macromedia Dreamweaver 8 utility functions that you can
use to access local and web-based files, work with Macromedia Fireworks,
and Macromedia Flash objects, manage database connections, create new
database connection types, access JavaBeans fscomponents, and integrate
Dreamweaver with various source control systems.
Chapter 1: The File I/O API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 2: The HTTP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Chapter 3: The Design Notes API . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Chapter 4: Fireworks Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Chapter 5: Flash Integration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Chapter 6: The Database API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Chapter 7: The Database Connectivity API . . . . . . . . . . . . . . . . . . 101
Chapter 8: The JavaBeans API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 9: The Source Control Integration API. . . . . . . . . . . . . . . .117
000_DW_API_Print.book Page 15 Wednesday, July 20, 2005 11:58 AM
000_DW_API_Print.book Page 16 Wednesday, July 20, 2005 11:58 AM
17
1
CHAPTER 1
The File I/O API
Macromedia Dreamweaver 8 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.
For general information on how C libraries interact with the JavaScript interpreter in
Dreamweaver, see “C-Level Extensibilityin Extending Dreamweaver.
Accessing configuration folders
On Microsoft Windows 2000 and Windows XP, and Mac OS X platforms, users have their
own copies of configuration files. Whenever Dreamweaver writes to a configuration file,
Dreamweaver writes it to the user’s Configuration folder. Similarly, when Dreamweaver reads
a configuration file, Dreamweaver searches for it first in the user’s Configuration folder and
then in the Dreamweaver Configuration folder. DWfile functions use the same mechanism.
In other words, if your extension reads or writes a file in the Dreamweaver Configuration
folder, your extension also accesses the users Configuration folder. For more information
about configuration folders on multiuser platforms, see Extending Dreamweaver.
The File I/O API
All functions in the File I/O API are methods of the DWfile object.
DWfile.copy()
Availability
Dreamweaver 3.
000_DW_API_Print.book Page 17 Wednesday, July 20, 2005 11:58 AM
18 The File I/O API
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.
Example
The following code copies a file called myconfig.cfg to myconfig_backup.cfg:
var fileURL = "file:///c|/Config/myconfig.cfg";
var newURL ="file:///c|/Config/myconfig_backup.cfg";
DWfile.copy(fileURL, newURL);
DWfile.createFolder()
Availability
Dreamweaver 2.
Description
This function creates a folder at the specified location.
Arguments
folderURL
The folderURL argument, which is expressed as a file:// URL, is the location of the folder
you want to create.
Returns
A Boolean value: true if the folder is created successfully; false otherwise.
000_DW_API_Print.book Page 18 Wednesday, July 20, 2005 11:58 AM
The File I/O API 19
Example
The following code tries to create a folder called tempFolder at the top level of the C drive and
displays an alert box that indicates whether the operation was successful:
var folderURL = "file:///c|/tempFolder";
if (DWfile.createFolder(folderURL)){
alert("Created " + folderURL);
}else{
alert("Unable to create " + folderURL);
}
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.txt file and displays an alert message that tells the
user whether the file exists:
var fileURL = "file:///c|/temp/mydata.txt";
if (DWfile.exists(fileURL)){
alert(fileURL + " exists!");
}else{
alert(fileURL + " does not exist.");
}
DWfile.getAttributes()
Availability
Dreamweaver 2.
000_DW_API_Print.book Page 19 Wednesday, July 20, 2005 11:58 AM
20 The File I/O API
Description
This function gets the attributes of the specified file or folder.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file or folder for which
you want to get attributes.
Returns
A string that represents the attributes of the specified file or folder. If the file or folder does
not exist, this function returns a
null value. The following characters in the string represent
the attributes:
R is read only.
D is folder.
H is hidden.
S is system file or folder.
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.
Arguments
fileURL
The fileURL argument, which is expressed as a file:// URL, is the file for which you are
checking the last modified time.
000_DW_API_Print.book Page 20 Wednesday, July 20, 2005 11:58 AM
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114
  • Page 115 115
  • Page 116 116
  • Page 117 117
  • Page 118 118
  • Page 119 119
  • Page 120 120
  • Page 121 121
  • Page 122 122
  • Page 123 123
  • Page 124 124
  • Page 125 125
  • Page 126 126
  • Page 127 127
  • Page 128 128
  • Page 129 129
  • Page 130 130
  • Page 131 131
  • Page 132 132
  • Page 133 133
  • Page 134 134
  • Page 135 135
  • Page 136 136
  • Page 137 137
  • Page 138 138
  • Page 139 139
  • Page 140 140
  • Page 141 141
  • Page 142 142
  • Page 143 143
  • Page 144 144
  • Page 145 145
  • Page 146 146
  • Page 147 147
  • Page 148 148
  • Page 149 149
  • Page 150 150
  • Page 151 151
  • Page 152 152
  • Page 153 153
  • Page 154 154
  • Page 155 155
  • Page 156 156
  • Page 157 157
  • Page 158 158
  • Page 159 159
  • Page 160 160
  • Page 161 161
  • Page 162 162
  • Page 163 163
  • Page 164 164
  • Page 165 165
  • Page 166 166
  • Page 167 167
  • Page 168 168
  • Page 169 169
  • Page 170 170
  • Page 171 171
  • Page 172 172
  • Page 173 173
  • Page 174 174
  • Page 175 175
  • Page 176 176
  • Page 177 177
  • Page 178 178
  • Page 179 179
  • Page 180 180
  • Page 181 181
  • Page 182 182
  • Page 183 183
  • Page 184 184
  • Page 185 185
  • Page 186 186
  • Page 187 187
  • Page 188 188
  • Page 189 189
  • Page 190 190
  • Page 191 191
  • Page 192 192
  • Page 193 193
  • Page 194 194
  • Page 195 195
  • Page 196 196
  • Page 197 197
  • Page 198 198
  • Page 199 199
  • Page 200 200
  • Page 201 201
  • Page 202 202
  • Page 203 203
  • Page 204 204
  • Page 205 205
  • Page 206 206
  • Page 207 207
  • Page 208 208
  • Page 209 209
  • Page 210 210
  • Page 211 211
  • Page 212 212
  • Page 213 213
  • Page 214 214
  • Page 215 215
  • Page 216 216
  • Page 217 217
  • Page 218 218
  • Page 219 219
  • Page 220 220
  • Page 221 221
  • Page 222 222
  • Page 223 223
  • Page 224 224
  • Page 225 225
  • Page 226 226
  • Page 227 227
  • Page 228 228
  • Page 229 229
  • Page 230 230
  • Page 231 231
  • Page 232 232
  • Page 233 233
  • Page 234 234
  • Page 235 235
  • Page 236 236
  • Page 237 237
  • Page 238 238
  • Page 239 239
  • Page 240 240
  • Page 241 241
  • Page 242 242
  • Page 243 243
  • Page 244 244
  • Page 245 245
  • Page 246 246
  • Page 247 247
  • Page 248 248
  • Page 249 249
  • Page 250 250
  • Page 251 251
  • Page 252 252
  • Page 253 253
  • Page 254 254
  • Page 255 255
  • Page 256 256
  • Page 257 257
  • Page 258 258
  • Page 259 259
  • Page 260 260
  • Page 261 261
  • Page 262 262
  • Page 263 263
  • Page 264 264
  • Page 265 265
  • Page 266 266
  • Page 267 267
  • Page 268 268
  • Page 269 269
  • Page 270 270
  • Page 271 271
  • Page 272 272
  • Page 273 273
  • Page 274 274
  • Page 275 275
  • Page 276 276
  • Page 277 277
  • Page 278 278
  • Page 279 279
  • Page 280 280
  • Page 281 281
  • Page 282 282
  • Page 283 283
  • Page 284 284
  • Page 285 285
  • Page 286 286
  • Page 287 287
  • Page 288 288
  • Page 289 289
  • Page 290 290
  • Page 291 291
  • Page 292 292
  • Page 293 293
  • Page 294 294
  • Page 295 295
  • Page 296 296
  • Page 297 297
  • Page 298 298
  • Page 299 299
  • Page 300 300
  • Page 301 301
  • Page 302 302
  • Page 303 303
  • Page 304 304
  • Page 305 305
  • Page 306 306
  • Page 307 307
  • Page 308 308
  • Page 309 309
  • Page 310 310
  • Page 311 311
  • Page 312 312
  • Page 313 313
  • Page 314 314
  • Page 315 315
  • Page 316 316
  • Page 317 317
  • Page 318 318
  • Page 319 319
  • Page 320 320
  • Page 321 321
  • Page 322 322
  • Page 323 323
  • Page 324 324
  • Page 325 325
  • Page 326 326
  • Page 327 327
  • Page 328 328
  • Page 329 329
  • Page 330 330
  • Page 331 331
  • Page 332 332
  • Page 333 333
  • Page 334 334
  • Page 335 335
  • Page 336 336
  • Page 337 337
  • Page 338 338
  • Page 339 339
  • Page 340 340
  • Page 341 341
  • Page 342 342
  • Page 343 343
  • Page 344 344
  • Page 345 345
  • Page 346 346
  • Page 347 347
  • Page 348 348
  • Page 349 349
  • Page 350 350
  • Page 351 351
  • Page 352 352
  • Page 353 353
  • Page 354 354
  • Page 355 355
  • Page 356 356
  • Page 357 357
  • Page 358 358
  • Page 359 359
  • Page 360 360
  • Page 361 361
  • Page 362 362
  • Page 363 363
  • Page 364 364
  • Page 365 365
  • Page 366 366
  • Page 367 367
  • Page 368 368
  • Page 369 369
  • Page 370 370
  • Page 371 371
  • Page 372 372
  • Page 373 373
  • Page 374 374
  • Page 375 375
  • Page 376 376
  • Page 377 377
  • Page 378 378
  • Page 379 379
  • Page 380 380
  • Page 381 381
  • Page 382 382
  • Page 383 383
  • Page 384 384
  • Page 385 385
  • Page 386 386
  • Page 387 387
  • Page 388 388
  • Page 389 389
  • Page 390 390
  • Page 391 391
  • Page 392 392
  • Page 393 393
  • Page 394 394
  • Page 395 395
  • Page 396 396
  • Page 397 397
  • Page 398 398
  • Page 399 399
  • Page 400 400
  • Page 401 401
  • Page 402 402
  • Page 403 403
  • Page 404 404
  • Page 405 405
  • Page 406 406
  • Page 407 407
  • Page 408 408
  • Page 409 409
  • Page 410 410
  • Page 411 411
  • Page 412 412
  • Page 413 413
  • Page 414 414
  • Page 415 415
  • Page 416 416
  • Page 417 417
  • Page 418 418
  • Page 419 419
  • Page 420 420
  • Page 421 421
  • Page 422 422
  • Page 423 423
  • Page 424 424
  • Page 425 425
  • Page 426 426
  • Page 427 427
  • Page 428 428
  • Page 429 429
  • Page 430 430
  • Page 431 431
  • Page 432 432
  • Page 433 433
  • Page 434 434
  • Page 435 435
  • Page 436 436
  • Page 437 437
  • Page 438 438
  • Page 439 439
  • Page 440 440
  • Page 441 441
  • Page 442 442
  • Page 443 443
  • Page 444 444
  • Page 445 445
  • Page 446 446
  • Page 447 447
  • Page 448 448
  • Page 449 449
  • Page 450 450
  • Page 451 451
  • Page 452 452
  • Page 453 453
  • Page 454 454
  • Page 455 455
  • Page 456 456
  • Page 457 457
  • Page 458 458
  • Page 459 459
  • Page 460 460
  • Page 461 461
  • Page 462 462
  • Page 463 463
  • Page 464 464
  • Page 465 465
  • Page 466 466
  • Page 467 467
  • Page 468 468
  • Page 469 469
  • Page 470 470
  • Page 471 471
  • Page 472 472
  • Page 473 473
  • Page 474 474
  • Page 475 475
  • Page 476 476
  • Page 477 477
  • Page 478 478
  • Page 479 479
  • Page 480 480
  • Page 481 481
  • Page 482 482
  • Page 483 483
  • Page 484 484
  • Page 485 485
  • Page 486 486
  • Page 487 487
  • Page 488 488
  • Page 489 489
  • Page 490 490
  • Page 491 491
  • Page 492 492
  • Page 493 493
  • Page 494 494
  • Page 495 495
  • Page 496 496
  • Page 497 497
  • Page 498 498
  • Page 499 499
  • Page 500 500
  • Page 501 501
  • Page 502 502
  • Page 503 503
  • Page 504 504
  • Page 505 505
  • Page 506 506
  • Page 507 507
  • Page 508 508
  • Page 509 509
  • Page 510 510
  • Page 511 511
  • Page 512 512
  • Page 513 513
  • Page 514 514
  • Page 515 515
  • Page 516 516
  • Page 517 517
  • Page 518 518
  • Page 519 519
  • Page 520 520
  • Page 521 521
  • Page 522 522
  • Page 523 523
  • Page 524 524
  • Page 525 525
  • Page 526 526
  • Page 527 527
  • Page 528 528
  • Page 529 529
  • Page 530 530
  • Page 531 531
  • Page 532 532
  • Page 533 533
  • Page 534 534
  • Page 535 535
  • Page 536 536
  • Page 537 537
  • Page 538 538
  • Page 539 539
  • Page 540 540
  • Page 541 541
  • Page 542 542
  • Page 543 543
  • Page 544 544
  • Page 545 545
  • Page 546 546
  • Page 547 547
  • Page 548 548
  • Page 549 549
  • Page 550 550
  • Page 551 551
  • Page 552 552
  • Page 553 553
  • Page 554 554
  • Page 555 555
  • Page 556 556
  • Page 557 557
  • Page 558 558
  • Page 559 559
  • Page 560 560
  • Page 561 561
  • Page 562 562
  • Page 563 563
  • Page 564 564
  • Page 565 565
  • Page 566 566
  • Page 567 567
  • Page 568 568
  • Page 569 569
  • Page 570 570
  • Page 571 571
  • Page 572 572
  • Page 573 573
  • Page 574 574
  • Page 575 575
  • Page 576 576
  • Page 577 577
  • Page 578 578
  • Page 579 579
  • Page 580 580
  • Page 581 581
  • Page 582 582
  • Page 583 583
  • Page 584 584
  • Page 585 585
  • Page 586 586
  • Page 587 587
  • Page 588 588
  • Page 589 589
  • Page 590 590
  • Page 591 591
  • Page 592 592
  • Page 593 593
  • Page 594 594
  • Page 595 595
  • Page 596 596
  • Page 597 597
  • Page 598 598
  • Page 599 599
  • Page 600 600
  • Page 601 601
  • Page 602 602
  • Page 603 603
  • Page 604 604
  • Page 605 605
  • Page 606 606
  • Page 607 607
  • Page 608 608
  • Page 609 609
  • Page 610 610
  • Page 611 611
  • Page 612 612
  • Page 613 613
  • Page 614 614
  • Page 615 615
  • Page 616 616
  • Page 617 617
  • Page 618 618
  • Page 619 619
  • Page 620 620
  • Page 621 621
  • Page 622 622
  • Page 623 623
  • Page 624 624
  • Page 625 625
  • Page 626 626
  • Page 627 627
  • Page 628 628

MACROMEDIA Dreamweaver 8 Reference

Category
Software
Type
Reference
This manual is also suitable for

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI