-
Using HomeSite+ for Dreamweaver MX HomeSite+ for Dreamweaver MX for Windows 98, Windows ME, Windows NT 4.
-
Copyright Notice Copyright 2002 Macromedia, Inc. All rights reserved. Macromedia, the Macromedia logo, ColdFusion, Dreamweaver, Flash, HomeSite, JRun, Quick Tag Editor, Roundtrip, and what the web can be are trademarks or registered trademarks of Macromedia, Inc. which may be registered in the United States and internationally. Java and Solaris are trademarks of Sun Microsystems, Inc.
-
Contents About This Book ............................... xiii Intended audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv Developer resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macromedia website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ColdFusion web resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
iv Contents Managing servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 About server mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Adding a server mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Chapter 3 Exploring the Workspace .............. 25 The workspace areas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
Contents v Selecting a tag from Tag Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Completing a tag with a tag editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Using inline tools to enter code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Tag Insight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Function Insight . . . . . . . . . . . . . . . .
-
vi Contents Creating and editing an event handler script block . . . . . . . . . . . . . . . . . . . 79 Formatting pages with Cascading Style Sheets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 About Cascading Style Sheets (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 About the integrated style editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Macro Recorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
Contents vii Editing tag definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Chapter 8 Accessing Data Sources .............. 129 Introduction to database tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Working with data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring a ColdFusion data source . . . . . . . . . . . . . . . . . . . . . . . . . .
-
viii Contents Running the Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Debug window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Debugging across multiple pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stepping through code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Evaluating an expression and setting a watch . . . . . . . . . . . . . . . .
-
Contents ix 197 About Visual Tools Markup Language (VTML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Using Tag Chooser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Exploring the new VTML structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 About dialog definition files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Category tag . . . . . . . . .
-
x Contents Wizard definition page library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 SelectDataSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Chapter 15 Scripting the Visual Tools Object Model 223 Writing and executing scripts . . . . . . . . . . . . . . . . . . . . . . . . . .
-
Contents xi Table of CommandID values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 Table of SettingID values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 Glossary ....................................
-
xii Contents
-
About This Book Using HomeSite+ for Dreamweaver MX is designed to familiarize you with the product’s user interface and the productivity tools that you can use to quickly develop high-quality applications and web content. Contents • Intended audience ................................................................................................... xiv • Developer resources................................................................................................. xiv • About the documentation ......
-
xiv About This Book Intended audience This book is intended for professional web developers who have a working knowledge of HTML and web server environments. It introduces you to the user interface and development tools, and provides instructions for installing, configuring, and using the product. Developer resources Macromedia Corporation is committed to setting the standard for customer support in developer education, technical support, and professional services.
-
Developer resources Resource xv Description URL Professional education Information about developer certification www.macromedia.com/support/ and the classes, on-site training, and online training/ courses offered by Macromedia Macromedia alliances Connection with the growing network of solution providers, application developers, resellers, and hosting services that create solutions with Macromedia products www.macromedia.
-
xvi About This Book About the documentation The documentation is designed to provide support for the complete spectrum of participants. The print and online versions are organized to allow you to quickly locate the information that you need. The online documentation is provided in HTML and Adobe Acrobat formats. You can also access release notes, product support information, and several developer resources from the Help menu.
-
About the documentation xvii To view the online HTML Help: 1 Select Help > Open Help References Window. The Help tab of the Resources window appears, displaying a tree of online books that includes several language references, as well as the documentation. 2 Find the Help topic you need, using the tree, search engine, index, or bookmarks. For details, see “Getting the most from the online Help system” on page 35. 3 Double-click a topic to display it in the Document window.
-
xviii About This Book Getting answers One of the best ways to solve particular programming problems is to tap into the vast expertise of the HomeSite+ for Dreamweaver MX developer communities which you can by following the Community links on http://www.macromedia.com/software/ homesite/. Other developers on the forum can help you figure out how to do just about anything with http://www.macromedia.com/software/homesite/.
-
Copyright information xix Copyright information Portions of the software are copyrighted as follows: Copyright © 2001, Macromedia Inc. All rights reserved. Copyright © 1987-2000 by Francois Piette, Rue de Grady 24, 4053 Embourg, Belgium. Copyright © 1998-2000 World Wide Web Consortium (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University) ARR. Quality freeware from Sight&Sound, Slovenia: http://www.sight-sound.si Version 1.
-
xx About This Book
-
Chapter 1 Setting Up the Product This chapter describes how to install or upgrade HomeSite+ for Dreamweaver MX and how to initially configure it. Contents • System requirements .................................................................................................. 2 • Installing or upgrading ............................................................................................... 2 • Completing the setup ....................................................................................
-
2 Chapter 1 Setting Up the Product System requirements The minimum installation requirements are as follows: • Pentium-compatible processor (Pentium II or higher recommended) • Microsoft Windows® 98, Windows ME, Windows NT® 4.0, Windows 2000, or Windows XP • Internet Explorer 4.
-
Completing the setup 3 To install or upgrade: 1 If you are upgrading, you can uninstall the previous version before installing the new version, but do not delete the UserData and AutoBackup folders from the previous installation. If you delete them, you cannot import your customizations, or the files that were created by Auto Backup, into the new version. 2 Close all open applications and insert the HomeSite+ for Dreamweaver MX CD-ROM. 3 When the initial window displays, click Install.
-
4 Chapter 1 Setting Up the Product You can run the ICW again at any time by selecting File > New and then selecting Initial Configuration Wizard from the Custom tab. Using the Initial Configuration Wizard This section explains how to complete the ICW after a first-time installation on a computer, and after an upgrade. The ICW automatically starts when you run HomeSite+ for Dreamweaver MX for the first time.
-
Completing the setup 3 5 In the Preserve Editor Settings dialog box, select the options to carry over to the current version. Click Next. You can change these options later by selecting Options > Settings and making changes in the Editor pane, Validation pane, and the panes underneath Editor. 4 In the Preserve General Settings dialog box, select the customizations to carry over to the current version. (Only nondefault options appear.) Click Next.
-
6 Chapter 1 Setting Up the Product Monitoring system resources On Windows 98 and Windows ME platforms, HomeSite+ for Dreamweaver MX uses a great amount of Windows Graphics Device Interface (GDI) and user resources. This section describes the resource problem and how to mitigate it. For more information, also see http://www.allaire.com/Handlers/ index.cfm?ID=21011&Method=FullKnowledge Base article 21011/a on the Macromedia website.
-
Monitoring system resources 7 Using the Resource Level Monitor This section explains how to respond to warnings and how to configure the monitor. Responding to warnings A warning dialog box appears if your available Windows Graphics Device (GDI) or user resources drop below your default warning thresholds. For example, it appears if your default warning threshold for GDI resources is 15% and your available GDI resources drop to 14%. For best results, save your work, even if you choose to continue.
-
8 Chapter 1 Setting Up the Product
-
Chapter 2 Configuring Browsers and Servers This chapter contains instructions for setting up browsers and servers. Contents • Configuring the internal browser............................................................................. 10 • Configuring an external browser ............................................................................. 12 • Working with files on remote servers ......................................................................
-
10 Chapter 2 Configuring Browsers and Servers Configuring the internal browser You can use the internal browser to browse documents and application pages from within HomeSite+ for Dreamweaver MX. With a server mapping, you can also preview server-side processes in your page; for example, server-side includes, results from submitting a form to a CGI program, and the results of server-side code. For more information, see “About server mappings” on page 20.
-
Configuring the internal browser 11 3 Add the Mozilla bin directory to your PATH environment variable. Reboot if necessary. If you are using Windows 95/98, you may have to specify the short name version of the path; for example, c:\mozil~1\bin. 4 If your Mozilla bin directory does not have component.reg, or it is small ( < 5k), then delete it and run mozilla.exe. This generates a new component.reg file. This file is the database that XPCOM uses to create new objects.
-
12 Chapter 2 Configuring Browsers and Servers Configuring an external browser As part of the installation process, the program compiles a list of the web browsers it detects on your computer. You can view, add, edit, and remove browser configurations; you can change the default browser; and you can set the file saving behavior for your browsers. The following procedures describe how to configure the external browsers. To view the list of browsers: • Select Options > Configure External Browsers.
-
Configuring an external browser 13 To remove a browser from the list: 1 Select Options > Configure External Browsers. 2 In the External Browsers dialog box, select a browser and click Delete. 3 Click Yes to confirm. 4 Click OK. HomeSite+ for Dreamweaver MX saves your changes. To change the default browser: 1 Select Options > Configure External Browsers. 2 In the External Browsers dialog box, select the appropriate browser, and click the up arrow until it is the first item in the list.
-
14 Chapter 2 Configuring Browsers and Servers Working with files on remote servers Working with directories and files on remote servers is similar to working with them on local or network drives. For example, when you save files, changes are saved to the remote server. The primary difference is that you must establish a connection to a remote server before you can work with its files.
-
Working with files on remote servers 2 Select the appropriate compatibility option: • • 3 15 Allaire HomeSite/Studio 4.5.2 Enables the remote server functionality in both this version and in previous versions, and changes the name of the SNE node to “Allaire FTP & RDS.” Macromedia HomeSite/Studio 5.0+ Enables the remote server functionality only in this version. Click Switch, then click Close.
-
16 Chapter 2 Configuring Browsers and Servers To connect to an FTP server: 1 On the Files resource tab, in the top pane, select Macromedia FTP & RDS from the drop-down list. • • If you see Allaire FTP & RDS in the list, you can select this instead. For more information, see “Using the SNE node” on page 14. If you do not see any FTP & RDS node in the list, select Options > Settings > File Settings > FTP & RDS > Enable Explorer shell integration.
-
Working with files on remote servers Field 17 Description Comment Request Timeout Maximum number of seconds to wait for a server connection to complete. Disable passive mode Option to select if the server does not use passive connections. File time offset The number of hours ahead or If you set this value, you behind the current local time to cannot select the Assume UTC use in the date and time file times option. information for files on the FTP server.
-
18 Chapter 2 Configuring Browsers and Servers 3 Click Configure SSL and enter the appropriate certificate information. For more information, click Help. 4 Click OK. The following table summarizes the error messages that you could receive: Error message Cause Unable to connect to the FTP server.Success Remote Server Operation Failure: Winsock Error: Connection aborted. SSL has not been enabled in the Configure FTP Server dialog box, and you attempted to connect to a server requiring SSL.
-
Working with files on remote servers 19 Field Description Port Accept the default Port or enter your ColdFusion Server port number. Use Secure Sockets Layer Select this option if needed for SSL security. Remaining RDS Complete these fields based on the settings in the ColdFusion security fields Administrator. For details, see “Managing ColdFusion security for RDS” on page 19. 4 Click OK.
-
20 Chapter 2 Configuring Browsers and Servers 2 In the confirmation dialog box, click Yes. HomeSite+ for Dreamweaver MX removes the remote server from the Macromedia FTP & RDS list. About server mappings A development mapping is essential for working with files using Remote Development Services (RDS). With mappings, you can process pages on a server from within HomeSite+ for Dreamweaver MX, and you can debug application code on a remote server using RDS.
-
Working with files on remote servers 21 Understanding RDS mappings A file mapping ensures that HomeSite+ for Dreamweaver MX, the RDS server, and your browser can resolve a local path into a server path and URL. The path fields in the Configure RDS Server dialog box specify how each — HomeSite+ for Dreamweaver MX, the RDS server, and your browser—can find the directory that you are mapping.
-
22 Chapter 2 Configuring Browsers and Servers To resolve the URL paths, you must create a mapping for the App1 directory, as in the following table: ColdFusion Server and HomeSite+ for Dreamweaver MX on same computer HomeSite+ path C:\webprojects\App1\ ColdFusion Server path C:\webprojects\App1\ Browser/URL path http://215.180.21.1/ Using drive mappings Developers often debug against a remote server across an internal network. In many cases, they use a network drive mapping.
-
Working with files on remote servers 23 HomeSite+ for Dreamweaver MX and the ColdFusion Server must understand how a file location appears to the parties involved, so you must create a mapping for the App1 directory, as in the following table: HomeSite+ accesses files on remote server using UNC paths/Network Neighborhood HomeSite+ path \\MyServer\webprojects\App1\ ColdFusion Server path C:\webprojects\App1\ Browser/URL path http://215.180.21.
-
24 Chapter 2 Configuring Browsers and Servers To add a mapping: 1 In the Options > Settings > Browse pane, select Microsoft Internet Explorer, Netscape Mozilla NGLayout, or the built-in browser as the internal browser. 2 Click Development Mappings. 3 In the Remote Development Settings dialog box, on the Mapping tab, select a server from the drop-down list of configured servers. If a server is not on the list, add it. For more information, see “Adding a server mapping” on page 23.
-
Chapter 3 Exploring the Workspace This chapter acquaints you with the main areas of the user interface. It also guides you in customizing the workspace to make your development work as productive as possible. Contents • The workspace areas ................................................................................................. 26 • Working in the Resources window........................................................................... 28 • Creating and browsing files in the Document window....
-
26 Chapter 3 Exploring the Workspace The workspace areas The term workspace describes the user interface that you see when you first load the program. The workspace has four principal areas: • Command area At the top of the workspace is the title bar, which displays the file path of the current document. Below that is the menu bar, which contains standard Windows commands plus development menus. Below the menus are toolbars that provide one-click access to commands and application tools.
-
The workspace areas 27 Setting options The Settings dialog box lets you configure many HomeSite+ for Dreamweaver MX options to fit your work style, and you can easily change settings for different tasks. To set options: 1 Select Options > Settings (F8) to open the dialog box. 2 Click a feature category in the left pane to display options in the right pane. Expand a category to view further options. 3 Click Apply to save the settings.
-
28 Chapter 3 Exploring the Workspace Working in the Resources window The Resources window is a tabbed user interface that gives you quick access to file management, development, and Help resources. Select a tab at the bottom of the window to open the pane for each resource. Context menus and specialized toolbars provide the set of commands for each pane.
-
Creating and browsing files in the Document window 29 Creating and browsing files in the Document window You work primarily in the Document window as you develop code and content. The three tabs at the top of the give you access to the following activities: • Edit Develop code and content. • Browse Preview your work in the internal browser. • Help View Help. This tab appears the first time you open a file from the Help tab at the bottom of the Resources window.
-
30 Chapter 3 Exploring the Workspace Note You can cycle through all of the pages that have been opened in the Help tab during the current session. To do this, click in a page and then hold down the Alt key while pressing the left or right arrow key. Tracking your work in the Results window The Results window displays the results of document operations in individual panels.
-
Customizing the workspace 31 Customizing the workspace If you are interested in configuring the workspace to more readily support the way you work, you can start by viewing a list of the functions that are available in HomeSite+ for Dreamweaver MX, to see if you are using the program to its full potential. To view a list of HomeSite+ for Dreamweaver MX functions: 1 Select Options > Customize. 2 In the Customize dialog box, on the Toolbars tab, review the contents of the Toolbuttons list.
-
32 Chapter 3 Exploring the Workspace The tab on the top of the list appears on the far left side of the QuickBar. 3 Click Close. To hide or show a toolbar: 1 Select Options > Customize. 2 In the Customize dialog box, in the Visible Toolbars box, clear the check box next to every toolbar that you want to hide, and select the check box next to every toolbar that you want to show.
-
Customizing the workspace 33 The toolbutton is added to the toolbar in the workspace. To add a custom toolbutton to a toolbar: 1 Select Options > Customize. 2 In the Customize dialog box, in the Visible Toolbars box, select a toolbar. 3 Click Add Custom Button. 4 In the Custom Toolbutton dialog box, specify what you want the custom toolbutton to do, as described in the following table: For the custom button to do this... Do this...
-
34 Chapter 3 Exploring the Workspace 3 In the picture of the toolbar, drag each toolbutton that you want to move to its new position. 4 Click Close. To remove a toolbutton: 1 Select Options > Customize. 2 In the Customize dialog box, in the Visible Toolbars box, select a toolbar. 3 In the picture of the toolbar, drag the toolbutton that you want to remove to a position outside of the toolbar. 4 Click Close. To add a custom toolbar: 1 Select Options > Customize.
-
Getting the most from the online Help system 35 Getting the most from the online Help system The online Help system provides you with several types of information: • Pop-up Help for basic tag syntax (press F2) • Comprehensive context-sensitive tag Help (press F1) • Embedded Help in tag editors, Tag Chooser, and Expression Builder (press F1 or Ctrl+F1) • An extensive collection of searchable references in the Help tab Opening Help in tag editors and Tag Chooser Help text in tag editors and in Tag Chooser
-
36 Chapter 3 Exploring the Workspace Bookmarking Help You can quickly access your favorite Help documents by bookmarking them. You can assign bookmarks to documents in the Help, file system, or the Internet. To bookmark a document in the Help Tree: • Right-click the document title and select Add bookmark. If the Help document is open, it automatically displays in the Bookmarks list. If the document is not open, right-click again and select Refresh.
-
Getting the most from the online Help system 37 Using an online index With the exception of language references, each book in the Help has an online index. To search a book using an index: 1 Decide on the term or terms that you want to find in the index. 2 Do one of the following: • On the Help tab, in the Help toolbar, click Help tree, and open the book that you want to search. Double-click the Index page.
-
38 Chapter 3 Exploring the Workspace 6 Click Search. The search results appear in the Help pane. 7 To open a document from the results list, double-click it. The results list is saved until a new search is run. To return to the search results: • On the Help toolbar, click Search results. To redo a recent search: 1 On the Help toolbar, click Search.
-
Getting the most from the online Help system 39 Adding content to the Help tree You can add files or whole references (folders) to the Help tree. To create a new folder in the Help tree: 1 In a Files tab, navigate to the Help folder in your installation. 2 Right-click in the Files pane and select Create Folder. A new folder with a highlighted name box appears. 3 Enter a name for the folder in the box, and press Enter. 4 If necessary, press F5 to refresh the Help display.
-
40 Chapter 3 Exploring the Workspace The new folder appears in the order that you set, but the files in the folder appear in alphabetical order. If you want to control the order of chapters and pages, add tags in the booktree file for these entries, and rearrange them. Displaying text files in the Help tree You can add text files to the Help tree. The Help browser default file type is HTML, so it looks for a title tag in each file.
-
Chapter 4 Managing Files This chapter describes how to perform file management tasks such as opening, closing, saving, and automatically backing up files. This chapter also describes how to work with Unicode and DBCS (Double-Byte Character Set) files. The tasks described in this chapter do not replace the need for creating a project to organize the files in a website or web application. For instructions on how to use projects, see “Managing Projects” on page 137.
-
42 Chapter 4 Managing Files About the Files tabs You can select the Files tabs in the Resources window to access servers, drives, directories, and files. Having two Files tabs reduces the amount of file system navigation needed to work across multiple directories and drives. The following screenshot shows the main areas of the Files tabs. Following are some tips on how the two Files tabs work together: • Set the Drive list to My Computer to easily access local and network drives and Macromedia FTP & RDS.
-
About file encoding 43 Several operations—such as opening and saving files, backing up before replacing text in files, displaying thumbnails for the images in a folder, browsing to files in tag editors, and creating an image map—refer to the current directory. The Files tabs use the following rules to determine which directory is the current directory: • When browsing to a file in a tag editor, the current directory is the folder that the current document is in.
-
44 Chapter 4 Managing Files Working with files You can use the following procedures to work with files, regardless of their location (local drive, network drive, or remote server). Opening and saving files refer to the current directory. For information about how HomeSite+ for Dreamweaver MX determines the current directory with two Files tabs, see “About the Files tabs” on page 42. Setting startup options You have a number of choices in how files are folders are displayed when you start HomeSite+.
-
Working with files 45 If you attempt to open a Unicode file without having selected the Enable non-ANSI file encoding option, the encoding format of the file cannot be detected or handled properly. The file is loaded as an ANSI string of the same type specified in your system language settings. To open a recently used file: 1 Select File > Recent Files. A drop-down list appears, listing the last ten files that were closed. 2 Select a file from the list.
-
46 Chapter 4 Managing Files Saving a file with encoding If you work with non-ANSI–encoded documents, select character encoding from the Save As dialog box. For this release, do not save a file as Unicode or Unicode Big Endian on an SSL-enabled FTP server, or else the files are not created and saved correctly. Also, saving Unicode files might result in zero-byte files. This is a known problem that tends to occur when changing Unicode encoding selections.
-
Working with files 47 2 While you are working on a file, Auto-Backup creates a backup file with the following name convention: filename + an incremented 3 digit number + the file extension; for example, myfile000.htm. 3 If the application closes abnormally, when you restart the application, Auto-Backup opens all of the open files that were saved by Timed Backup.
-
48 Chapter 4 Managing Files 3 Otherwise, select Options > Auto-Backup File Maintenance and, in the Auto-Backup File Maintenance dialog box, check the files that you must recover and select File > Open Selected Files for Edit. The files open in the Editor. Changing the file list display You can arrange the file list to display exactly what you want.
-
Working with files 49 To view a favorite folder: 1 On a Files tab, right-click in the file list and select Favorite Folders. 2 From the Favorite Folders submenu, select the folder. The folder opens in the directory tree and its files appear in the file list. To organize your favorite folders: 1 On a Files tab, right-click in the file list and select Favorite Folders > Organize Favorites.
-
50 Chapter 4 Managing Files
-
Chapter 5 Writing Code and Web Content HomeSite+ for Dreamweaver MX manages many different web development tasks, from writing basic HTML pages to designing, testing, and deploying complex, dynamic sites. This chapter describes basic techniques for creating web content and application code. Contents • Inserting code............................................................................................................ 52 • Using inline tools to enter code .............................................
-
52 Chapter 5 Writing Code and Web Content Inserting code HomeSite+ for Dreamweaver MX coding tools support a range of writing styles, from typing to point-and-click, and you can set the level of support you want: for repetitive tasks, you can use its productivity tools to enter repeated code blocks and required text; when coding tags that you are not familiar with, you can display pop-up tips and lists of language elements.
-
Inserting code 53 To do this Do this Add custom toolbutton Click Add Custom Button. Custom Toolbutton dialog box displays. Select an action; complete entries for action; click OK. Add separator In Customize dialog box, Visible Toolbars list, click a toolbar. Click Add Separator. Separator is added. Drag separator. Remove toolbutton In Customize dialog box, Visible Toolbars list, click a toolbar. or separator Drag item from toolbar to outside of toolbar.
-
54 Chapter 5 Writing Code and Web Content Completing a tag with a tag editor You can use a tag editor to add a lot of content within an existing tag, for example in the body tag. To complete the details for a tag: 1 In the Editor, position the cursor in the tag to complete. 2 Right-click, and select Edit Current Tag from the pop-up menu. 3 Complete the tag editor dialog box. 4 Click OK. The tag editor closes, adding the attributes and values that you specified to the tag.
-
Using inline tools to enter code 55 Using inline tools to enter code You have a number of tools to help you insert new code and to edit existing code as you type. Each of these tools supports a distinct language element, such as tags, objects, and functions. You can set the options for these inline tools in the Settings dialog box (F8). Using Tag Insight Tag Insight lets you insert tag names, attributes, and values as you type, after typing a start bracket (<) for a tag.
-
56 Chapter 5 Writing Code and Web Content Press the Esc key to close a drop-down list. • To change an attribute — Delete the attribute and add a new attribute. • To add a value — Press the spacebar after the attribute to display a drop-down list of known values for the attribute. Select a value and press Enter. • To change a value — Delete the value and add a new value. Using Function Insight Function Insight lets you insert function argument syntax as you type.
-
Using inline tools to enter code 57 Using Auto Completion Auto Completion completes a code block by inserting the appropriate code when you enter the opening code fragment (trigger string). You can set options for this feature in the Options > Settings > Editor > Auto Completion pane. A few strings are listed by default; such as, to insert a Comment end tag (-->) after you enter the start tag ( PAGE 237
Creating a wizard definition page 217
PAGE 238
218 Chapter 14 Customizing the Development Environment Creating a wizard output template The Wizard Markup Language (WIZML) enables the customization of files produced by the wizards. WIZML is used inside the templates to dynamically create files based on the data provided by the wizard. For example, if a wizard generates a tag called with a single attribute FILEPATH, the template could look like this: This example creates a file with a single tag.
-
Creating a wizard output template 219 For syntax and usage information, see ../VTML_Reference/ functions.htmlExpressions and Functions/a in the VTML Reference. WIZ Tags The behavior of wizard output templates is controlled by the use of WIZ tags in the template. These tags are like ColdFusion tags except that they are prefixed with the characters WIZ instead of ColdFusion. The following tags are supported tags: • WIZSET Sets a wizard parameter. • WIZINCLUDE Includes another wizard output template.
-
220 Chapter 14 Customizing the Development Environment Wizard definition page library A set of seven page definition files is available in HomeSite+ for Dreamweaver MX. The library can be used to quickly build data access capabilities into wizards. Examples Following are examples of each of the seven wizard definition pages available in the library. For complete syntax and usage information, see the ../VTML_Reference/ wizards.htmlWizards Definition Page Library/a section of the VTML Reference.
-
Wizard definition page library 221 SelectTables PAGE 242
222 Chapter 14 Customizing the Development Environment
SelectFields PAGE 243
Chapter 15 Scripting the Visual Tools Object Model Using the Macromedia Visual Tools Object Model (VTOM), developers can extend their work in two broad categories: • Power users can script recurring tasks. • Application developers can call HomeSite+ for Dreamweaver MX functionality for use in their applications. This chapter describes how to write and execute scripts in HomeSite+ for Dreamweaver MX. It also provides the syntax and examples of the objects in HomeSite+ for Dreamweaver MX.
-
224 Chapter 15 Scripting the Visual Tools Object Model Writing and executing scripts HomeSite+ for Dreamweaver MX exposes an Object Model, enabling developers to manipulate program functionality from external applications. In addition, power users can create scripts to automate tasks using JScript or VBScript and run the scripts from HomeSite+ for Dreamweaver MX. This internal scripting feature requires the Microsoft ActiveScripting engine version 3.1 or later, also known as Windows Script.
-
Writing and executing scripts 225 The program determines which language engine to use based on the extension of the script file. If the file extension is BAS, VB, or VBS, the VBScript engine executes the script. Otherwise, the program uses the JScript engine. To automate HomeSite+ for Dreamweaver MX tasks, you must familiarize yourself with the Visual Tools Object Model (VTOM). The main object is the Application object.
-
226 Chapter 15 Scripting the Visual Tools Object Model Creating a custom toolbutton or toolbar After you write a script, you can create a custom toolbutton to execute the script from within the program. If you intend to write multiple scripts, you can create a toolbar for them. You can rearrange the buttons and add separators in the toolbar. To create a custom toolbutton: 1 On the Toolbars tab, select your custom script toolbar from the Toolbars list. The toolbar displays at the top of the tab.
-
Application object 227 Application object You can script the Application object’s child objects to perform common tasks and to create toolbars dynamically. Properties ActiveDocument Syntax Description ActiveDocument: object (read-only) The current document. For details, see “ActiveDocument object” on page 258. ApplicationType Syntax Description ApplicationType: integer (read-only) The current application type.
-
228 Chapter 15 Scripting the Visual Tools Object Model } default: { sMessage = 'an unknown application type'; }MessageBox('You are enjoying ' + sMessage + '.', 'Application Type', 0); } AppPath Syntax Description Example AppPath: OleString (read-only) Path to application executable. function Main() { var sPath; with (Application) { sPath = AppPath; // Store the path in a variable } } CurrentFolder Syntax Description Example CurrentFolder: OleString Path currently displayed in the local file list.
-
Application object 229 Sample CurrentView script //**********************************************************// // This script switches the views inside the application //*********************************************************// function Main () { var sMessage; with (Application) { CurrentView = 1; sMessage = "You are now in Edit View of your " + VersionText; MessageBox (sMessage, VersionText, 0); CurrentView = 2; sMessage = "You are now in Browse View of your " + VersionText; MessageBox (sMessage, Vers
-
230 Chapter 15 Scripting the Visual Tools Object Model DocumentCount Syntax Description Example DocumentCount: integer (read-only) Number of open documents. function Main() { Var sMessage; with (Application){ sMessage = "There are "; sMessage = sMessage + sDocumentCount + " open.\n"; // Get the number of open documents. sMessage = sMessage + sDocumentIndex + ".\n"; // Get the index of the current document.
-
Application object 231 Height Syntax Description Example Height: integer Height in pixels of main window.
-
232 Chapter 15 Scripting the Visual Tools Object Model Left Syntax Description Example Left: integer Left (x-coordinate) of main window.
-
Application object 233 Top Syntax Description Example Top: integer Top (y-coordinate) of main window.
-
234 Chapter 15 Scripting the Visual Tools Object Model Width Syntax Description Width: integer Width in pixels of the main application window. Use this property with the Height property to return the size of the main window as well as to resize the window. WindowState Syntax Description WindowState: integer Set and get window state.
-
Application object 235 BrowseText Syntax Description Example BrowseText(sText, BaseHREF: OleVariant); Displays the passed text in the internal browser. Use the BaseHREF parameter to interpret relative paths. For local files, BaseHREF is the folder that contains the file.
-
236 Chapter 15 Scripting the Visual Tools Object Model ExtractFileName Syntax Description Example ExtractFileName(const wsFile: WideString): WideString; Returns only the file portion of the passed filename. function Main() { Var sFullFilePath; Var sFileName; sFullFilePath = "C:/Temp/MyScript.js" with (Application){ sFileName = ExtractFileName(sFullFilePath); // Returns 'MySript.
-
Application object 237 ActiveDocument.InsertText('
', false); } } } GetImageHeight Syntax Description GetImageHeight(const wsImageName: WideString): Integer; Returns the height in pixels of the passed image. Returns 0 on error. Example /* Tests GetImageHeight, GetImageWidth Looks for first GIF image in current directory */ function Main(){ with (Application) { aFileObj= new ActiveXObject("Scripting.FileSystemObject"); aFolder= aFileObj.GetFolder(CurrentFolder); aFiles= new Enumerator(aFolder.
-
238 Chapter 15 Scripting the Visual Tools Object Model GetImageSize Syntax Description Example GetImageSize(const wsImageFile: WideString; var nHeight, nWidth: Integer): WordBool; Boolean. Retrieves the size of the passed image. Returns False on error. function Main() { Var sFullImagePath; Var Height; Var Width; sFullImagePath = "C:/Temp/photos/MyPic.
-
Application object 239 GetRelativePath Syntax Description GetRelativePath(const wsBaseURL, wsFolderURL: WideString): WideString; Returns the relative path of a folder given a base URL. For example, GetRelativePath ("http://www.macromedia.com/", "http:// www.macromedia.com/software/") returns "products/". Example function Main() { Var sFullPath1; Var sRelativePath; Var sFullPath2; sFullPath1 = "http://www.macromedia.com/"; sFullPath2 = "http://www.macromedia.
-
240 Chapter 15 Scripting the Visual Tools Object Model GetURL Syntax Description Example GetURL(const wsURL: WideString): WideString; Retrieves a URL and returns its contents. function Main() { Var sURL; Var sContents; sURL = "http://www.macromedia.com/"; with (Application){ sContents = GetURL(sURL); // Storing HTML code of the URL in sContents } } GetURLResponse Syntax Description Example GetURLResponse(const wsURL: WideString): WideString; Retrieves a URL and returns its contents.
-
Application object 241 GetURLStatus Syntax Description GetURLStatus(const wsURL: WideString; var vResponse: OleVariant): Integer; Returns the HTTP status code for the passed URL. The text of the server response is returned in the second parameter. GetURLStatusCode Syntax Description Example GetURLStatusCode(const wsURL: WideString): Integer; Returns the status code for the passed URL. See the GetURLResponse example. HideProgress Syntax Description Example HideProgress(); Hides the progress bar.
-
242 Chapter 15 Scripting the Visual Tools Object Model } } } HTMLGetAttribute Syntax Description HTMLGetAttribute(const wsInTag, wsAttr: WideString): WideString; Returns the value for a particular attribute of a tag. For example, HTMLGetAttribute("<TABLE WIDTH=100>", "WIDTH"); returns 100.
-
Application object 243 with (Application) { sInput = InputBox(VersionText, "What is your name?", "Alex"); sOutput = "I know you, your name is " + sInput + "."; MessageBox (sOutput, VersionText, 0); } } InstallParserScript Syntax Description Example InstallParserScript(const WordBool; wsScriptFile, wsFileExtAssoc: WideString): Boolean. Returns False on error. Installs a parser (color-coding) script and associates it with the passed list of semicolon-separated file extensions.
-
244 Chapter 15 Scripting the Visual Tools Object Model } } } LogMemoryStatus Syntax Description Example LogMemoryStatus(const wsLogFile, wsDescrip: WideString); Writes the current memory status to a log file, wsLogFile: logfilename. Creates the file if it does not exist, otherwise appends status to the file. The description text for the entry is entered in wsDescrip: text. function Main(){ with (Application){ LogMemoryStatus('D:\\Test\\MemLog.
-
Application object Example 245 function Main() { Var sInput; Var sOutput; with (Application) { sInput = InputBox(VersionText, "What is your name?", "Alex"); sOutput = "I know you, your name is " + sInput + "."; MessageBox (sOutput, VersionText, 0); } } NewDocument Syntax Description Example NewDocument(wbUseDefaultTemplate: WordBool); Boolean. Creates a new document, optionally from the default template.
-
246 Chapter 15 Scripting the Visual Tools Object Model When using this method in JScript, you must escape backslashes inside a string. For example, in Application.OpenFile("C:\\Documents\\MyFile.htm"); each backslash is preceded by an additional backlash. Example function Main() { Var sFile; Var bResult; sFile = "C:\\Temp\myDoc.txt" with (Application) { If(OpenFile(sFile)) MessageBox("File opened successfuly.", VersionText); Else MessageBox("File does not exist or already open.
-
Application object 247 RunCodeSweeper Syntax Description Example RunCodeSweeper(); Runs the CodeSweeper on the current document using the active CodeSweeper. To change the active CodeSweeper, use SetActiveCodeSweeper. function Main() { with (Application) { RunCodeSweeper (); } } SaveAll Syntax Description Example SaveAll(): WordBool; Boolean. Saves all open documents. Returns True if successful.
-
248 Chapter 15 Scripting the Visual Tools Object Model SetActiveCodeSweeper Syntax Description Example SetActiveCodeSweeper(const wsFileName: WideString): WordBool; Changes the active CodeSweeper format file. function Main(){ var sCS_File = 'C:\\Program Files\\Macromedia\\ColdFusion Studio 5\\Extensions\\CodeSweepers\\WebXML.vtm'; with (Application){ SetActiveCodeSweeper(sCS_File); } } SetActiveResults Syntax Description SetActiveResults(resType: TCurrentResultsType); Boolean.
-
Application object Example 249 function Main(){ var sFolder1 var sFolder2 = 'C:\\Program Files\\Bradbury\\TopStyle2'; = 'C:\\InetPub\\wwwroot'; with (Application) { SetFileTabFolder(1, sFolder1); SetFileTabFolder(2, sFolder2); } } SetProgress Syntax Description SetProgress(nProgress: Integer); Sets the position of the progress bar in the status area.
-
250 Chapter 15 Scripting the Visual Tools Object Model ShellToAppAndWait Syntax Description Example ShellToAppAndWait(const wsAppFileName: WideString); Boolean. Same as ShellToApp but waits for the external program to close before returning. The application is locked until ShellToAppAndWait returns, so use this method with caution. function Main(){ with (Application){ // Edit current document in notepad and then reload it ShellToAppAndWait('notepad.exe ' + ActiveDocument.Filename); ActiveDocument.
-
Application object Example 251 function Main(){ with (Application){ if (ActiveDocument.Modified){ StatusError('Current document is modified'); } } } StatusWarning Syntax Description Example StatusWarning(const wsMsg: WideString); Displays a warning message in the status bar. Message appears on a blue background and displays for at least 5 seconds. function Main(){ with (Application){ if (ActiveDocument.
-
252 Chapter 15 Scripting the Visual Tools Object Model Wait Syntax Description Example Wait(nMilliseconds: Integer); Pauses for given number of milliseconds. Use Wait to enable scripts to execute loops, yet still allow access to the UI. Without the call to Wait in the loop, the application appears locked and the user cannot change views. The following JScript sample waits for the user to return to edit source view: var app = Application; while (app.CurrentView != 1) { app.
-
Application object 253 AddScriptToolbutton Syntax Description Example AddScriptToolbutton(wsToolbarName, wsScriptFile, wsImageFile: WideString): WordBool; wsHint, wsCaption, Boolean. Adds a script toolbutton (executes passed JScript or VBScript file when clicked) to the passed toolbar. Fails if toolbar does not exist. Returns True if a toolbutton already exists, but does not add a duplicate toolbutton.
-
254 Chapter 15 Scripting the Visual Tools Object Model with (Application){ AddVTMToolbutton('Common', sVTM_File, 'Block quote', 'BQ', ''); } } CreateToolbar Syntax Description Example CreateToolbar(wsToolbarName: WideString): WordBool; Boolean. Creates a new, undocked toolbar of the passed name. Fails if the toolbar of the same name already exists.
-
Application object 255 SetToolbarDockPos Syntax Description SetToolbarDockPos(wsToolbarName: WideString; nDockPos: Integer): WordBool; Boolean. Sets the docking position of the toolbar. Fails if the toolbar does not exist. The following values for nDockPos are allowed: 1 2 3 4 Example = = = = Top Bottom Left Right function Main(){ with (Application){ SetToolbarDockPos('Standard', 2); } } ShowToolbar Syntax Description Example ShowToolbar(wsToolbarName: WideString): WordBool; Boolean.
-
256 Chapter 15 Scripting the Visual Tools Object Model Sample toolbar script 1 //******************************************************// // This script creates a toolbar named Apps if one does not exist, // then adds two custom toolbuttons to it. The first toolbutton // launches Windows Explorer, the second one opens Windows Explorer // at the current folder in the Editor. //****************************************************// function Main() { var TB_NAME = ‘Apps’; var app = Application; if (!app.
-
Application object 257 Sample toolbar script 2 //*************************************************************// // This script creates a toolbar which is capable of executing // all of the scripts contained in the Document Cache //*************************************************************// function Main () { var var var var var sToolBarName; Result; count; fname; fnamepath; with (Application) {fnamepath sToolBarName = InputBox (VersionText, "Enter the Toolbar name.
-
258 Chapter 15 Scripting the Visual Tools Object Model ActiveDocument object Use the ActiveDocument object to refer to the document currently displayed in the Editor. To access an open document that is not active, use the Application.DocumentCache object. Properties CanRedo Syntax Description Example CanRedo: WordBool (read-only) Boolean. Returns True if changes can be re-done. function Main() { var sMessage; sMessage = "CanRedo : "; with (Application) { If(ActiveDocument.
-
ActiveDocument object 259 CaretPosX Syntax Description Example CaretPosX: integer (read-only) The X-axis caret position. function Main(){ with (Application){ if (ActiveDocument.CaretPosX > 1){ ActiveDocument.CursorLineStart(false); } } } CaretPosY Syntax Description Example CaretPosY: integer (read-only) The Y-axis caret position. function Main(){ with (Application){ if (ActiveDocument.CaretPosY > 1){ ActiveDocument.
-
260 Chapter 15 Scripting the Visual Tools Object Model LineCount Syntax Description Example LineCount: integer (read-only Number of lines in the current document. function Main() { var sMessage; sMessage = "Your file line count is: "; with (Application) { sMessage = sMessage + ActiveDocument.LineCount; MessageBox(sMessage, VersionText, 0); } } Lines Syntax Description Example Lines(Index: integer) OleString Gets and sets the text of the line at the passed index.
-
ActiveDocument object 261 MessageBox(sMessage, VersionText, 0); } } ReadOnly Syntax Description Example ReadOnly: WordBool (read-only) Boolean. Returns True if the current document is read-only. function Main(){ with (Application){ if (ActiveDocument.ReadOnly){ MessageBox('Current document is Read-Only', 'Information', 0); } } } SelLength Syntax Description Example SelLength: integer Gets and sets the length of the current selection.
-
262 Chapter 15 Scripting the Visual Tools Object Model SelText Syntax Description Example SelText: OleString Gets and sets the text in the current selection. function Main() { var sMessage; sMessage = "The length of the selected text of your document is "; with (Application) { sMessage = sMessage + ActiveDocument.SelText; MessageBox(sMessage, VersionText, 0); } } TabIndex Syntax Description Example TabIndex Gets and sets the tab index of the document tab.
-
ActiveDocument object 263 Clear Syntax Description Clear(); Clears all text from the current document. Close Syntax Description Close(wbPromptToSave: WordBool): WordBool; Boolean. Closes the current document. If wbPromptToSave is True, the user is prompted to save any changes. Returns True if the document was closed (that is, the user didn’t cancel saving changes). Cursor Syntax Description Cursor_ (wbSelect: WordBool); Boolean. Positions the cursor.
-
264 Chapter 15 Scripting the Visual Tools Object Model } finally{ ActiveDocument.EndUpdate(); } MessageBox('Total tags: ' + iTags, 'Tag Count', 0); } } GetCaretPos Syntax Description GetCaretPos(var x, y: integer); Returns the caret pos (x=column, y=line). GetCurrentChar Syntax Description GetCurrentChar(): OleVariant; Returns the current character. GetNextChar Syntax Description GetNextChar(): OleVariant; Returns the next character.
-
ActiveDocument object 265 GotoNextEndTag Syntax Description GotoNextEndTag(wbSelect: WordBool): WordBool; Boolean. Moves the next end tag, and selects it if wbSelect is True. Returns False if no tag found. GotoNextStartTag Syntax Description GotoNextStartTag(wbSelect: WordBool): WordBool; Boolean. Moves the next starting tag and selects it if wbSelect is True. Returns False if no tag is found. GotoPreviousEndTag Syntax Description Example GotoPreviousEndTag(wbSelect: WordBool): WordBool; Boolean.
-
266 Chapter 15 Scripting the Visual Tools Object Model Description Boolean. Inserts the passed tag pair at the current cursor position, overwriting the selection if wbOverwriteSelection is True. The cursor is positioned between the start and end tags after this operation. If wbOverwriteSelection is False, the tags surround the current selection. Example function Main(){ with (Application){ ActiveDocument.CursorDocEnd(false); ActiveDocument.InsertTag('PAGE 287
ActiveDocument object 267 Reload Syntax Description Reload(wbPromptToSave: WordBool); Boolean. Reloads the current document. If wbPromptToSave is True, prompts the user to save changes. ReplaceAll Syntax Description ReplaceAll(strSearch, strReplace: OleVariant; bMatchCase: WordBool): Integer; Boolean. Replaces all occurrences of strSearch with strReplace, matching case if bMatchCase is True. Returns the number of replacements made. Save Syntax Description Save: WordBool(); Boolean.
-
268 Chapter 15 Scripting the Visual Tools Object Model SelectAll Syntax Description SelectAll(); Selects all the text in the current document. SelectCurrentLine Syntax Description SelectCurrentLine(); Highlights the current line. SelectLine Syntax Description SelectLine(Index: Integer); Highlights the passed line. SetCaretPos Syntax Description SetCaretPos(x, y: Integer); Sets the current column/line.
-
DocumentCache object 269 DocumentCache object It is very important to understand the DocumentCache object when using the VTOM. Although HomeSite+ for Dreamweaver MX enables you to open dozens of files at once, only the current document stays in memory. When a document becomes inactive, that is, when the user switches to a different document in the Document window, the previously current document is cached to conserve resources. Every open document has an element in the Application.DocumentCache array.
-
270 Chapter 15 Scripting the Visual Tools Object Model Example function Main() { var sMessage; sMessage = "Your filename is: "; with (Application) { sMessage = sMessage + DocumentCache (0).Filename; } } Modified Syntax Description Example Modified: WordBool (read-only) Boolean. Returns True if the cached document changed since it was last saved. function Main() { var sMessage; sMessage = "Modified: "; with (Application) { If(DocumentCache (0).
-
DocumentCache object Text Syntax Description Example Text: OleString (read-only) File contents of the cached document. function Main() { var sMessage; sMessage = "Your document contains the following text: \n"; with (Application) { sMessage = sMessage + DocumentCache (0).
-
272 Chapter 15 Scripting the Visual Tools Object Model Project object The Project object provides a basic set of properties and methods for scripting project maintenance tasks. The ProjectManager and DeploymentManager objects extend the capabilities of the Project object. For more information, see “ProjectManager object” on page 274 and “DeploymentManager object” on page 280.
-
Project object 273 ShowLastProjectError Syntax Description ShowLastProjectError(); Displays an error message for the last project-related error. UploadProject Syntax Description UploadProject(const wsTargetDir: WideString; const wbForceLCase, wbUploadOnlyNewer, wbEncryptCFML: WordBool): WordBool; Boolean. Uploads a project based on the passed criteria. The wbEncryptCFML parameter is specific to ColdFusion Studio. UploadProjectDlg Syntax Description UploadProjectDlg(): WordBool; Boolean.
-
274 Chapter 15 Scripting the Visual Tools Object Model ProjectManager object The ProjectManager object provides extensive and granular scripting capabilities. This section groups the PropertyManager methods by function. Properties FileCount Syntax Description FileCount: Integer (read-only) The number of files in the project. IsDirty Syntax Description IsDirty: WordBool (read-only) Boolean.
-
ProjectManager object 275 AddFolder Syntax Description AddFolder(Folder: OleVariant; FolderType: TFolderType; FolderPath: OleVariant; Parent: OleVariant); Adds a new folder to the project root. To add a subfolder to an existing folder, use a folder-level method. CheckedIn Syntax Description CheckedIn: WordBool; Boolean. Checks a project into source control. CreateProject Syntax Description CreateProject(ProjectName: OleVariant; ProjectPath: OleVariant); Creates a new project.
-
276 Chapter 15 Scripting the Visual Tools Object Model RemoveFolder Syntax Description RemoveFolder(FolderName: OleVariant); Removes a folder from the project. Save Syntax Description Save; Saves the current project to disk in WDDX format. SelectFile Syntax Description SelectFile(Filename: OleVariant); Selects a file for source control operations. Folder methods FolderAddFile Syntax Description FolderAddFile(Folder: OleVariant; Filename: OleVariant); Add a file to the specified folder.
-
ProjectManager object 277 FolderDeployTarget Syntax Description FolderDeployTarget(Folder: FolderTarget: OleVariant); OleVariant; out FolderType: Integer; out Gets the folder deployment target and type. FolderFileCount Syntax Description FolderFileCount(Folder: OleVariant): Integer; Counts the number of files in the project folder. FolderRemoveFile Syntax Description FolderRemoveFile(Folder: OleVariant; Filename: OleVariant); Removes file from specified folder.
-
278 Chapter 15 Scripting the Visual Tools Object Model Deployment methods DeploymentScriptAdd Syntax Description DeploymentScriptAdd: OleVariant; Adds a deployment script to the project. DeploymentScriptCount Syntax Description DeploymentScriptCount: Integer; Returns the number of scripts. DeploymentScriptList Syntax Description DeploymentScriptList: OleVariant; Lists all project deployment scripts.
-
ProjectManager object DeploymentServerRemove Syntax Description DeploymentServerRemove(ServerName: OleVariant); Removes a deployment server from a project.
-
280 Chapter 15 Scripting the Visual Tools Object Model DeploymentManager object The DeploymentManager object is a scriptable interface to the Project Deployment engine. The DeploymentManager object provides a collection of methods and properties that enable you to write highly customized scripts to control the deployment process. For examples of DeploymentManager Object syntax, see the “Sample deployment script” on page 285.
-
DeploymentManager object 281 ServerCount Syntax Description ServerCount: Integer (read-only) Counts the deployment servers associated with the current open project, including any new servers that were added temporarily using the AddServer method. UploadOnlyIfNewer Syntax Description UploadOnlyIfNewer: WordBool (read-write) Boolean. Determines whether the deployment engine only uploads a file if it has a newer date/time stamp than the target file.
-
282 Chapter 15 Scripting the Visual Tools Object Model CopyFile Syntax Description CopyFile(const SourceFile: WideString; const TargetFile: WideString): Integer; Copies the source file to the target file location. CopyFileExtended Syntax Description CopyFileExtended(const SourceFile: WideString; const TargetFile: WideString; CreateFolder: WordBool; UploadOnlyIfNewer: WordBool; EncryptCFML: WordBool): Integer; Boolean.
-
DeploymentManager object 283 such as "Rds://localhost/D:/main/images/TestImage.jpg" which you can pass as the second argument to the UploadFile method. GetFolderDeployPath Syntax Description GetFolderDeployPath(const wsFolderName:String): WideString; Returns the deployment path of the passed folder name. Use this path in conjunction with the GetDeployServerName and GetFolderName methods.
-
284 Chapter 15 Scripting the Visual Tools Object Model GetLastErrorMessage Syntax Description GetLastErrorMessage(): WideString; Tests the result of an UploadFile call by returning last associated RDS error message. IsFolderDeployable Syntax Description IsFolderDeployable(const wsFolderName:WideString): WordBool; Boolean. Returns the deployment status of the passed folder name. Use this method to skip folders that are designated as Do Not Deploy folders.
-
DeploymentManager object 285 UploadFile Syntax Description UploadFile(const wsFile:Widestring, sTargetFile: WideString); Uploads an individual file to the server. The first OleString represents the fully qualified path of an individual file to upload. The second OleString represents the fully qualified target name, such as rds://localhost/main/index.html.
-
286 Chapter 15 Scripting the Visual Tools Object Model // // // // // =================================================================== Server List: Local Deployment =================================================================== function Main() { var app = Application; var DeploymentManager = Application.
-
DeploymentManager object 287 // =========================================================== // Iterate through Project Folders //=========================================================== for (j=0; j <= DeploymentManager.FolderCount-1; j++) { sFolderName = DeploymentManager.GetFolderName(j); sDeployPath = DeploymentManager.
-
288 Chapter 15 Scripting the Visual Tools Object Model HTTPProvider object The HTTPProvider object is a general purpose HTTP protocol object. You can use it in VTOM scripts for low-level HTTP operations. The HTTPProvider object is an alternative to simplified HTTP-related methods, such as the GetURL method of the main Application object, which has a limited number of customizable HTTP parameters.
-
HTTPProvider object Description 289 Sets and gets the Content-Type entity-header field, which indicates the media type of the Entity-Body sent to the recipient. For the HEAD method, indicates the media type that is sent if the request is a GET. Cookie Syntax Description Example Cookie: OleVariant Sets and gets the Cookie header element. Use this property to send a set of client cookies to the server along the HTTP request.
-
290 Chapter 15 Scripting the Visual Tools Object Model MultiThreaded Syntax Description MultiThreaded: WordBool Boolean. Sets and gets whether the HTTPProvider uses multithreading when executing HTTP requests. NoCache Syntax Description NoCache: WordBool Boolean. Sets and gets the NoCache request-header field. Password Syntax Description Password: OleVariant Sets and gets the web server access password. Proxy Syntax Description Proxy: OleVariant Sets and gets the proxy server.
-
HTTPProvider object 291 RcvdCount Syntax Description RcvdCount: Integer (read-only) The size of the content stream received from the server. Use this property to display progress during asynchronous GET operations. Use the ContentLength property value extracted from the document header to get the total length of the incoming content stream. ReasonPhrase Syntax Description ReasonPhrase: OleVariant (read-only) The Reason-Phrase element provides a short textual description of the Status-Code.
-
292 Chapter 15 Scripting the Visual Tools Object Model Reference Syntax Description Reference: OleVariant Sets and gets the Referer request-header field. This field allows the client to specify, for the server’s benefit, the address (URI) of the resource from which the Request-URI was obtained. This allows a server to generate lists of back-links to resources for interest, logging, optimized caching, and so on. It also allows obsolete or mis-typed links to be traced for maintenance.
-
HTTPProvider object 293 StatusCode Syntax Description StatusCode: Integer (read-only) The HTTP request Status-Code element. This is a 3-digit integer result code of the attempt to understand and satisfy the request. URL Syntax Description URL: OleVariant Sets and gets the URL location of the resource on which an HTTP method is to be applied. Username Syntax Description Username: OleVariant Sets and gets the web server access username.
-
294 Chapter 15 Scripting the Visual Tools Object Model httpPro.URL = "http://www.macromedia.com"; httpPro.Get(); app.MessageBox( httpPro.ReceivedHeaderAsString ,"Received HTTP Header", hsOKInfo); app.MessageBox( "URL=’ "+ httpPro.URL + "‘\n" + "ProxyUsername=’" + httpPro.Username + "‘\n" + "ProxyPassword=’" + httpPro.Password + "‘\n" + "Proxy=’" + httpPro.Proxy + "‘\n" + "ProxyPort=’" + httpPro.Proxyport + "‘\n" + "ProxyUsername=’" + httpPro.ProxyUsername + "‘\n" + "ProxyPassword=’" + httpPro.
-
HTTPProvider object 295 HeadAsync Syntax Description HeadAsync(); Performs an HTTP HEAD method request asynchronously. Post Syntax Description Example Post(); Performs an HTTP POST method request. Sample POST script //*******************************************// // This script illustrates a POST method by which // three FORM variables are submitted to a ColdFusion page. //***********************************************// function Main () { var app = Application; var httpPro = app.
-
296 Chapter 15 Scripting the Visual Tools Object Model The following error messages are predefined. Check for the error strings to detect these error cases: • File already exits—Returned when file specified in FilePath exists and bOverwrite is set to False. • Path does not exist—Returned when the path specified in FilePath does not exist.
-
HTTPProvider object 297 with (Application){ if (HTTPProvider.State == 0){ // Set the URL property of HTTPProvider Object. HTTPProvider.URL = InputBox(VersionText, "Please Enter the URL.", "http://www.yahoo.com"); // Perform HTTP Get Request HTTPProvider.Get(); sSource = ''; if (HTTPProvider.ReasonPhrase == "OK") // Check if the requested URL can be displayed sSource = HTTPProvider.
-
298 Chapter 15 Scripting the Visual Tools Object Model ZIPProvider object The ZIPProvider object is the general purpose PKZIP services object used by HomeSite+ for Dreamweaver MX for ZIP file composition and extraction. You can use this object in your VTOM scripts for low-level PKZIP operations from within HomeSite+ for Dreamweaver MX. Because Macromedia uses a licensed control for its ZIP operations, you cannot use ZIPProvider outside of HomeSite+ for Dreamweaver MX.
-
ZIPProvider object 299 ZIPComment Syntax Description ZIPComment: OleVariant Sets and gets the comment for the archive file. Use this property to read a comment of an existing archive file, or set the comment for a new archive file that you created. ZIPFile Syntax Description ZIPFile: OleVariant Sets and gets the archive file path against which the operation is to be applied.
-
300 Chapter 15 Scripting the Visual Tools Object Model breaks. The function returns a status code that can be investigated to determine the success of the operation. Example Sample Add script function Main () { var hsOKInfo = 64; var app = Application; var ZIPPro = app.ZIPProvider; //Identify the files to be compressed var ZIPFiles = ‘d:\\projects\\hs4\\scripts\\test.htm’; ZIPFiles = ZIPFiles + ‘\n’ + ‘d:\\projects\\hs4\\scripts\\test.zip’; ZIPFiles = ZIPFiles + ‘\n’ + ‘d:\\projects\\hs4\\scripts\\*.
-
ZIPProvider object 301 else if (nStatusCode == 410){sMessage else if (nStatusCode == 420){sMessage else if (nStatusCode == 430){sMessage else if (nStatusCode == 440){sMessage else if (nStatusCode == 450){sMessage "ErrorCantOpenSfxConfig";} else if (nStatusCode == 460){sMessage "ErrorInvalidEventParam";} else if (nStatusCode == 470){sMessage else if (nStatusCode == 490){sMessage else if (nStatusCode == 500){sMessage else if (nStatusCode == 510){sMessage = = = = = "ErrorMultidisk";} "ErrorWrongDisk";} "Er
-
302 Chapter 15 Scripting the Visual Tools Object Model FileIsHidden Syntax Description FileIsHidden(nIndex: Integer): WordBool; Boolean. Use this function to determine whether a specific element in an archive is a hidden file. The index value can be from 0 to FileCount-1. FileIsReadOnly Syntax Description FileIsReadOnly(nIndex: Integer): WordBool; Boolean. Use this function to determine whether a specific element in an archive is read-only. The index value can be from 0 to FileCount-1.
-
ZIPProvider object 303 // Loop through the contents of the ZIP file for ( x = 0; x < ZIPPro.FileCount; x++ ) { if ( ZIPPro.FileName(x) == 'cfabort.vtm' ) { app.MessageBox( "File found in the archive.","ZIPProvider", hsOKInfo); } } } FileSize Syntax Description FileSize(nIndex: Integer): Double; Returns the size of an existing archive file element (file/directory/volume) by index. The nIndex value can be from 0 to FileCount-1.
-
304 Chapter 15 Scripting the Visual Tools Object Model ActiveScripting examples JScript
JScript Example //*****************************************************// // ActiveScripting example (JScript) //*****************************************************// // Generates a table of the filenames of all open documents, // listing their modified status and read-only property.
-
ActiveScripting examples 305 //Is this document Modified? if (DocumentCache (count).Modified) sTable = sTable + '
Yes'+''; else sTable = sTable + ' No' + ' | '; //Is this document Read-Only? if (DocumentCache (count).ReadOnly) sTable = sTable + 'Yes'+ ' | '; else sTable = sTable + 'No' + ' | '; // close row. sTable = sTable + ' | ' + newline; count ++; // increment count by 1.
-
306 Chapter 15 Scripting the Visual Tools Object Model VBScript
VBScript Example //********************************************************// // Displays a table containing file information //********************************************************// Sub Main dim app dim idx dim sTable dim newline, fname, br, tab dim nCurrentIdx newline = chr(13) + chr(10) br = "
" tab = chr(9) ‘ create app reference.
-
ActiveScripting examples 307 ‘ is this document modified? if app.DocumentCache(idx).Modified then sTable = sTable + "Yes" sTable = sTable + "
" ‘ is this document read-only? if app.DocumentCache(idx).ReadOnly then sTable = sTable + "Yes" ‘ close row sTable = sTable + " | " + newline next sTable = sTable + newline + "" ‘ add a new document (False = don’t create from default template blank) app.
-
308 Chapter 15 Scripting the Visual Tools Object Model Third-party add-ins Scripting support offers many possibilities for third-party developers. For the latest news on third-party add-ins, visit the VTOM Scripts section of the Macromedia Developer Exchange at www.macromedia.com/desdev/developer/. Running a script at startup If you want to distribute an add-in, you can register it to run a script the first time the program loads.
-
Third-party add-ins 309 Toolbutton", "SC", "" ’ add VTM toolbutton app.AddVTMToolbutton TB_NAME, app.AppPath + "Extensions\TagDefs\HTML\div.
-
310 Chapter 15 Scripting the Visual Tools Object Model Table of CommandID values The following table lists the set of currently exposed commands. For backward compatibility, these values will not change, but some value might become obsolete and be removed from the set.
-
Table of CommandID values Command ID 311 Value CMDID_cmdCursorDocStart 32 CMDID_cmdCursorDocEnd 33 CMDID_cmdCursorLineStart 34 CMDID_cmdCursorLineEnd 35 CMDID_cmdEditBackspace 36 CMDID_cmdEditCut 37 CMDID_cmdEditCopy 38 CMDID_cmdEditPaste 39 CMDID_cmdEditUndo 40 CMDID_cmdEditRedo 41 CMDID_cmdEditRepeatLastTag 42 CMDID_cmdEditCodeFormat // CodeSweeper 43 CMDID_cmdEditToggleInsertMode 44 CMDID_cmdEditDelete 45 CMDID_cmdEditDeleteLine 46 CMDID_cmdEditDeleteToEOL 47 CMDID_cmd
-
312 Chapter 15 Scripting the Visual Tools Object Model Command ID CMDID_cmdSelectionAddBR Value 67 CMDID_cmdSelectionStripTags 68 CMDID_cmdSelectionUCase 69 CMDID_cmdSelectionLCase 70 CMDID_cmdSearchFind 71 CMDID_cmdSearchReplace 72 CMDID_cmdSearchAgain 73 CMDID_cmdSearchFindEx 74 CMDID_cmdSearchReplaceEx 75 CMDID_cmdSearchFindMatchingTag 76 CMDID_cmdSearchReplaceDoubleSpacing 77 CMDID_cmdSearchReplaceExtChars 78 CMDID_cmdToolsTagChooser 79 CMDID_cmdToolsSpellCheck 80 CMDID_cmd
-
Table of CommandID values Command ID 313 Value CMDID_cmdViewEditSource 102 CMDID_cmdViewToggleEditPreview 103 CMDID_cmdViewToggleEditDesign 104 CMDID_cmdViewToggleTagInspectorFocus 105 CMDID_cmdViewToggleSpecialChar 106 CMDID_cmdViewTagInsight 107 CMDID_cmdViewTagTip 108 CMDID_cmdViewEditorToolbar 109 CMDID_cmdViewEditorTab 110 CMDID_cmdViewToggleQuickBar 111 CMDID_cmdViewResults 112 CMDID_cmdOptionsSettings 113 CMDID_cmdOptionsCustomize 114 CMDID_cmdOptionsOrganizeQuickBar 11
-
314 Chapter 15 Scripting the Visual Tools Object Model Table of SettingID values The following table lists currently exposed setting IDs. For backward compatibility, these values will not change, but some might become obsolete and be removed from the set.
-
Table of SettingID values 315 Setting ID Value Description SET_MSIE_AUTO_REFRESH 19 Automatically refresh MSIE after navigating (needed for IE3.
-
316 Chapter 15 Scripting the Visual Tools Object Model Setting ID Value Description SET_USE_CSE_VALIDATOR 41 Use CSE validator for full-page validation.
-
Table of SettingID values 317 Setting ID Value Description SET_SHOW_SKIPPED_FILES _IN_SEARCH 66 See dxSearchResults.AddSkipItem SET_LOWERCASE_LINKS 67 Lowercase IMG, A, and other dropped links SET_ALLOW_MULTIPLE_INSTANCES 79 Only for debugging.
-
318 Chapter 15 Scripting the Visual Tools Object Model Setting ID Value Description SET_USE_VTM_IMAGE_DIALOG 107 Use vtml image dialog SET_USE_VTM_ANCHOR_DIALOG 108 Use vtml anchor dialog SET_USE_VTM_BODY_DIALOG 109 Use vtml body dialog SET_TEMPFILE_PREFIX 110 Prefix to use for temp files SET_FILELIST_COLS_ACTIVE 120 Set local columns as active SET_FILELIST_COL_SIZES 121 Local FileList Column Size Settings SET_REMOTE_FILELIST_COLS_ACTIVE 122 Set remote columns as active SET_REMOTE_F
-
Table of SettingID values 319 Setting ID Value Description SET_DIR_WIZARDS 159 Set location of wizard root directory SET_DIR_CUSTOM_TEMPLATES 160 Set location of custom templates directory SET_DIR_OLD_TEMPLATES 161 Set location of old templates directory SET_DIR_OLD_TAGEDITORS 162 Set location of old tag editors directory SET_DIR_EXTENSIONS 163 Set location of extensions directory SET_DIR_TAGDEFS 164 Set location of tag definitions directory SET_DIR_CUSTOM_TAGDEFS 165 Set location of
-
320 Chapter 15 Scripting the Visual Tools Object Model Setting ID Value Description SET_QUICKBAR_DATA_FILE 207 Set location of file containing data about what toolbars are in the QuickBar SET_INSIGHT_TAGLIST_FILE 208 Set location of tag insight file SET_STYLE_EDIT_EXE 209 Set location of styleedit executable SET_CODETEMPLATE_FILE 210 Set location of code template file SET_AUTOREPLACE_FILE 211 Set location of code template replace file SET_TAGCOMPLETION_FILE 212 Set location of tag compl
-
Table of SettingID values 321 Setting ID Value Description SET_EDITOR_AUTOCLOSE_ASP 314 Add %> when <% entered SET_EDITOR_AUTOCOMMENT 315 Add --> when