Adobe 27510753 Scripting Guide - Page 30
Your first InDesign script, Visual Basic, AppleScript
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 30 highlights
22 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Visual Basic To view the InDesign object library in Visual Basic (the steps shown are for Visual Basic 6; Visual Basic 5 CCE and Visual Basic.NET users will see slightly different dialog boxes): 1. In any Visual Basic project, choose Project > References. Visual Basic displays the References dialog box. 2. Select the Adobe InDesign CS2 Type Library option from the list of available references and click OK. If the library does not appear in the list of available references, click Browse and locate and select the file Resources for Visual Basic.tlb (which is usually inside ~:\Documents and Settings\user_name\Application Data\Adobe\InCopy\Version 4.0\Scripting Support\4.0-where user_name is your user name). Once you've found the file, click Open to add the reference to your project. 3. Choose View > Object Browser. Visual Basic displays the Object Browser dialog box. 4. Choose InDesign from the list of open libraries shown in the Project/Library menu. Visual Basic displays the objects that make up the InDesign object model. 5. Click an object class. Visual Basic displays the properties and methods of the object. For more information on a property or method, select the item; Visual Basic displays the definition of the item at the bottom of the Object Browser window. Your first InDesign script The traditional first project in any programming language is to display, or print, the message "Hello World!" In this example, we'll create a new InDesign publication, then add a frame containing this message. The document page created by the script resembles the following: AppleScript To create an AppleScript script: 1. Locate and open the Apple Script Editor. 2. Enter the following script. The lines preceded by double dashes (--) are comments and are ignored by the scripting system. They're included to describe the operation of the program. As you look through the script, you'll see how we create, then address, each object in turn. The AppleScript command tell specifies which object will receive the next message that we send.