Adobe 27510753 Scripting Guide

Adobe 27510753 - InDesign CS2 - PC Manual

Adobe 27510753 manual content summary:

  • Adobe 27510753 | Scripting Guide - Page 1
    Scripting Guide bc Adobe® InDesign® cs2
  • Adobe 27510753 | Scripting Guide - Page 2
    Adobe, the Adobe logo, Acrobat, Adobe PDF, Adobe Creative Suite, Illustrator, InDesign, InCopy, GoLive, and Photoshop are either registered trademarks or trademarks of Adobe as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or transmitted,
  • Adobe 27510753 | Scripting Guide - Page 3
    Adobe InDesign CS2 Scripting Guide Contents i Contents 1 Introduction 1 What is in this book ...1 Who should read this book 1 What you need to use scripting 1 JavaScript .....� 2 Macintosh ....� 2 Windows ......� 2 How to use
  • Adobe 27510753 | Scripting Guide - Page 4
    ii Contents Adobe InDesign CS2 Scripting Guide Control structures ...15 Conditional statements...15 Loops 16 the Scripts palette...40 Using the Script Label palette 41 Testing and troubleshooting 42 AppleScript debugging...42 VBScript debugging ...42 JavaScript debugging ...42 4
  • Adobe 27510753 | Scripting Guide - Page 5
    Adobe InDesign CS2 Scripting Guide Contents iii User notification helper functions 63 Global alert function pixel and percentage values 67 Computing with unit values 68 Modular programming support 69 Preprocessor directives ...69 Importing and exporting between scripts 71 Operator overloading
  • Adobe 27510753 | Scripting Guide - Page 6
    iv Contents Adobe InDesign CS2 Scripting Guide Exporting a document as PDF 104 Using current PDF export options 104 Setting PDF export options 104 Exporting a range of pages 106 Exporting pages separately 106 Exporting pages as EPS 107 Exporting all pages ...108 Exporting a range of pages
  • Adobe 27510753 | Scripting Guide - Page 7
    Adobe InDesign CS2 Scripting Guide Contents v 7 Working with Documents in VBScript 143 Basic document management 144 presets from printing preferences 169 Exporting a document as PDF 170 Using current PDF export options 170 Setting PDF export options 171 Exporting a range of pages 172
  • Adobe 27510753 | Scripting Guide - Page 8
    vi Contents Adobe InDesign CS2 Scripting Guide
  • Adobe 27510753 | Scripting Guide - Page 9
    Guide Introduction 1 1 Introduction If you're reading this, you've discovered the most powerful feature in Adobe® InDesign® CS2. No other feature-no tool, palette, or dialog box that you see in the program's user interface-can save you as much time, trouble scripting languages supported by InDesign
  • Adobe 27510753 | Scripting Guide - Page 10
    Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that they work with InDesign are similar. Each example script in this manual is shown in all languages. Translating a script from one language to another is a fairly easy task. JavaScript InDesign supports downloaded
  • Adobe 27510753 | Scripting Guide - Page 11
    Adobe InDesign CS2 Scripting Guide Introduction 3 3. Display the Scripts palette by choosing Window > Automation ExtendScript Toolkit and run the script. Where to find more information The Adobe InDesign CS2 Scripting Reference provides details about the objects, properties, and methods available
  • Adobe 27510753 | Scripting Guide - Page 12
    InDesign CS2 Scripting Guide InDesign online scripting resources For more information on InDesign scripting, visit: l http://partners.adobe.com/public/developer/scripting/index.html l http://www.adobeforums.com, the InDesign Scripting User-to-User forum. In the forum, scripters can ask questions
  • Adobe 27510753 | Scripting Guide - Page 13
    Adobe InDesign CS2 Scripting Guide Scripting Basics 5 2 Scripting Basics If you've used InDesign, you've worked with frames and their contents, and you've learned to apply colors, formatting,
  • Adobe 27510753 | Scripting Guide - Page 14
    6 Scripting Basics Adobe InDesign CS2 Scripting Guide On the Macintosh, scripting is often accomplished using images, correcting errors in text, and preparing files for printing at an image-setting service provider often reduces the time that you have available for doing creative work. Wouldn't it
  • Adobe 27510753 | Scripting Guide - Page 15
    Adobe InDesign CS2 Scripting Guide Scripting Basics 7 Making script files readable Comments within scripts break a line but that direct the script to read the broken line as a legitimate instruction. In AppleScript, type Option+Return (displays as ¬) to enter a continuation character. In VBScript
  • Adobe 27510753 | Scripting Guide - Page 16
    8 Scripting Basics Adobe InDesign CS2 Scripting Guide Objects and classes The terminology of object-oriented programming can be hard to understand, at first. This section defines commonly used terms and provides
  • Adobe 27510753 | Scripting Guide - Page 17
    Adobe InDesign CS2 Scripting Guide Scripting Basics 9 AppleScript first text frame of the first the text object, use the object reference property, as shown in this example: tell application "Adobe InDesign CS2" set myDocument to make document tell spread 1 of myDocument set myTextFrame to make
  • Adobe 27510753 | Scripting Guide - Page 18
    10 Scripting Basics Adobe InDesign CS2 Scripting Guide Value type Double (VBScript), fixed or real (AppleScript), floating or you can fill the variable with a reference to an existing object: tell application "Adobe InDesign CS2" set myTextFrame to first text frame of the first spread of the first
  • Adobe 27510753 | Scripting Guide - Page 19
    Adobe InDesign CS2 Scripting Guide Scripting Basics 11 The same operation in JavaScript is more similar to VBScript than it is to AppleScript (in InDesign JavaScript, app is a reference to
  • Adobe 27510753 | Scripting Guide - Page 20
    Basics Adobe InDesign CS2 Scripting Guide Like VB.NET, JavaScript does not require Set when you assign values to variables, regardless of the type of the variable: var myDocument = app.documents.add(); var myString = "X"; Array variables AppleScript, VBScript, and JavaScript all support arrays
  • Adobe 27510753 | Scripting Guide - Page 21
    Adobe InDesign CS2 Scripting Guide Scripting Basics 13 VBScript Rem To convert from a number to a string: myNumber = 2 myString = cstr(myNumber) Rem To convert from a string to an integer: myString = "2" myNumber =
  • Adobe 27510753 | Scripting Guide - Page 22
    14 Scripting Basics Adobe InDesign CS2 Scripting Guide for(myCounter = 0; myCounter < app.activeDocument.pages.item(0).pageItems.length; myCounter ++){ var myPageItem = app.activeDocument.pages.item(0).pageItems.item(myCounter); var myPageItemType = myPageItem.getElements()[0].constructor.name;
  • Adobe 27510753 | Scripting Guide - Page 23
    InDesign CS2 Scripting Guide Scripting Basics 15 AppleScript In AppleScript, you can also use the "with properties" to specify object properties as the object is created. tell application "Adobe InDesign CS2" --Example of an optional parameter (requires that you have a document preset --named
  • Adobe 27510753 | Scripting Guide - Page 24
    16 Scripting Basics Adobe InDesign CS2 Scripting Guide AppleScript tell application "Adobe InDesign CS2" if (count documents) = 0 then display dialog "No InDesign documents are open!" end if end tell VBScript Set myInDesign = CreateObject ("InDesign.Application.CS2") If
  • Adobe 27510753 | Scripting Guide - Page 25
    Adobe InDesign CS2 Scripting Guide Scripting Basics 17 VBScript Here is a simple loop: For counter = 1 to geometric center of a selected page item --Assumes you have a single page item selected. tell application "Adobe InDesign CS2" set mySelection to item 1 of selection --Use "my" (or "of me") to
  • Adobe 27510753 | Scripting Guide - Page 26
    18 Scripting Basics Adobe InDesign CS2 Scripting Guide VBScript Rem Calculate the geometric center of a selected page item Rem Assumes you have a single page item selected. Set myInDesign = CreateObject("InDesign.Application.CS2") Set
  • Adobe 27510753 | Scripting Guide - Page 27
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 19 3 Getting Started with InDesign Scripting This chapter gives background information that is important for you to know when creating
  • Adobe 27510753 | Scripting Guide - Page 28
    Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide AppleScript tell application "Adobe InDesign CS2" set mySelection as "1.5." InDesign does this because your scripting system would have trouble trying to perform arithmetic operations using measurement strings-trying to add
  • Adobe 27510753 | Scripting Guide - Page 29
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 21 The InDesign ) l A button is a page item (it's a way to add an interactive button to an exported PDF). l Application: Dialogs (script dialog boxes) (includes most of the other user interface gadgets (radio button controls
  • Adobe 27510753 | Scripting Guide - Page 30
    22 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Visual Basic To view the InDesign 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
  • Adobe 27510753 | Scripting Guide - Page 31
    InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 23 --Hello World tell application "Adobe InDesign CS2" --Create a new document and assign its --identity to the variable "myDocument" set myDocument to make document tell myDocument --Create a new text frame on
  • Adobe 27510753 | Scripting Guide - Page 32
    24 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide 2. Use the CommandButton tool to create a new button on the default form. Double-click the button to open the Code window. 3. Enter the following code (
  • Adobe 27510753 | Scripting Guide - Page 33
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 25 Adding features to Editor to create a new script. 3. Enter the following code: --Improved "Hello World" tell application "Adobe InDesign CS2" --Get a reference to a font. try --Enter the name of a font on your system
  • Adobe 27510753 | Scripting Guide - Page 34
    Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide set justification to center align end tell end tell end tell end tell --myGetBounds is a handler that returns the bounds of the "live area" of a page. on myGetBounds(myDocument, myPage) tell application "Adobe InDesign CS2" set
  • Adobe 27510753 | Scripting Guide - Page 35
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 27 4. Save the text as a plain text file with the file extension .vbs in the Scripts folder inside the Presets
  • Adobe 27510753 | Scripting Guide - Page 36
    28 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide 6. Save the form. 7. Click the button you created in Step 3 to run the new script. JavaScript To create the script: 1. Make sure that you have
  • Adobe 27510753 | Scripting Guide - Page 37
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 29 Adding a user interface to "Hello World" If you want your script to collect and act on information entered by
  • Adobe 27510753 | Scripting Guide - Page 38
    30 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Like any other InDesign scripting object, each part of AppleScript in your script editor. --Simple User Interface Example tell application "Adobe InDesign CS2" activate set myDocument to make document set myDialog to make
  • Adobe 27510753 | Scripting Guide - Page 39
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 31 set myPageWidth to page width of document preferences of myDocument set myLeft to left of margin preferences of myPage
  • Adobe 27510753 | Scripting Guide - Page 40
    32 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide JavaScript 1. Enter the following JavaScript using any text editor or the ExtendScript Toolkit. //Simple User Interface Example var myDialog = app.dialogs.add({name:"Simple User
  • Adobe 27510753 | Scripting Guide - Page 41
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 33 Creating a more complex the following AppleScript in your script editor. --Complex User Interface Example tell application "Adobe InDesign CS2" activate set myDocument to make document set myDialog to make dialog --This
  • Adobe 27510753 | Scripting Guide - Page 42
    34 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide tell myDialogColumn make static text with to myPointSize end tell end tell on myGetBounds(myDocument, myPage) tell application "Adobe InDesign CS2" set myPageHeight to page height of document preferences of myDocument set
  • Adobe 27510753 | Scripting Guide - Page 43
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 35 set myLeft to left of margin preferences of myPage set myTop to top of margin preferences of myPage set
  • Adobe 27510753 | Scripting Guide - Page 44
    36 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Set myTempDialogColumn = myBorderPanel.DialogColumns.Add Set myRadioButtonGroup = myTempDialogColumn.RadiobuttonGroups.Add Set myLeftRadioButton = myRadioButtonGroup.RadiobuttonControls.Add myLeftRadioButton.StaticLabel
  • Adobe 27510753 | Scripting Guide - Page 45
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 37 JavaScript 1. Enter the following JavaScript using any text editor. //Complex User Interface Example //Create a dialog. var myDialog = app.dialogs.
  • Adobe 27510753 | Scripting Guide - Page 46
    38 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide if(myVerticalJustificationMenu.selectedIndex == 0){ myVerticalJustification = VerticalJustification.topAlign; } else if(myVerticalJustificationMenu.selectedIndex == 1){ myVerticalJustification = VerticalJustification.
  • Adobe 27510753 | Scripting Guide - Page 47
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 39 Handling errors Imagine that how you can stop a script when no objects are selected in InDesign. AppleScript tell application "Adobe InDesign CS2" --First, check to see whether any InDesign documents are open. --If no
  • Adobe 27510753 | Scripting Guide - Page 48
    40 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide } else { //No documents are open, so display an error message. alert("No InDesign documents are open. Please open a document and try again.") } You can also
  • Adobe 27510753 | Scripting Guide - Page 49
    Adobe InDesign CS2 Scripting Guide Getting Started with InDesign Scripting 41 run a script using the Scripts palette, InDesign suppresses screen drawing until the script has finished. To view the script
  • Adobe 27510753 | Scripting Guide - Page 50
    42 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Testing and troubleshooting Scripting environments provide tools for monitoring the progress of your script as it runs. This makes it easier to find problems that your script might encounter or cause. AppleScript
  • Adobe 27510753 | Scripting Guide - Page 51
    Guide Using ExtendScript Tools and Features 43 4 Using ExtendScript Tools and Features ExtendScript is Adobe's extended implementation of JavaScript, and is used by all Adobe export statements. See the "Modular Programming Support" section. l Support for extending or overriding math and logical
  • Adobe 27510753 | Scripting Guide - Page 52
    Scripting Guide The ExtendScript Toolkit The ExtendScript Toolkit provides an interactive development and testing environment for ExtendScript in all Adobe Creative Suite 2 applications. It includes a full-featured, syntax-highlighting editor with Unicode capabilities and multiple undo/redo support
  • Adobe 27510753 | Scripting Guide - Page 53
    Adobe InDesign CS2 Scripting Guide Select target application Using ExtendScript Tools and Features 45 Invoke target The Toolkit can debug multiple applications at one time. If you have more than one Adobe Creative Suite 2 application installed, use the drop-down list at the upper left under the
  • Adobe 27510753 | Scripting Guide - Page 54
    46 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide running halted waiting The current it. If you select an application that cannot be debugged in the Toolkit (such as Adobe Help), an error dialog reports that the Toolkit cannot connect to the selected application. The
  • Adobe 27510753 | Scripting Guide - Page 55
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 47 Tracking data The Data Browser tab is ); the triangle points down to indicate that the object is open. Note: In Photoshop® CS2, the Data Browser pane is populated only during the debugging of a JavaScript program within
  • Adobe 27510753 | Scripting Guide - Page 56
    48 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide The JavaScript console The JavaScript console is a command shell and output window for the currently selected JavaScript engine. It connects you to the global namespace
  • Adobe 27510753 | Scripting Guide - Page 57
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 49 Switching between the of Script Editor tabs; each displays one Unicode source code document. The editor supports JavaScript syntax highlighting, JavaScript syntax checking, multiple undo and redo operations, and advanced
  • Adobe 27510753 | Scripting Guide - Page 58
    50 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide Right arrow Up arrow Down arrow Page up Page down Move insertion point to start of text Move insertion point to end of text The editor supports extended keyboard input via IME (Windows) or TMS (Mac OS). This is especially
  • Adobe 27510753 | Scripting Guide - Page 59
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 51 the variables and functions are already known to the JavaScript engine. During debugging, however, this is an extremely useful
  • Adobe 27510753 | Scripting Guide - Page 60
    52 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide If the script encounters a runtime error, the Toolkit halts the execution of the script, displays the current script with the current line highlighted in red,
  • Adobe 27510753 | Scripting Guide - Page 61
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 53 You can set breakpoints on lines that do not contain any code, such as comment lines. When the Toolkit
  • Adobe 27510753 | Scripting Guide - Page 62
    54 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide Profiling The Profiling tool helps : l Green indicates the lowest number of hits, or the fastest execution time. l Red indicates trouble spots, such as a line that has been executed many times, or which line took the most
  • Adobe 27510753 | Scripting Guide - Page 63
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 55 Dollar ($) Object This global ExtendScript object provides a number of debugging facilities and informational methods. The properties of the $ object
  • Adobe 27510753 | Scripting Guide - Page 64
    56 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide objects os screens strict version Number The total count of all JavaScript objects defined so far. Read only. String The current operating system version.
  • Adobe 27510753 | Scripting Guide - Page 65
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 57 sleep Suspends the calling thread for the given number of milliseconds. $.sleep (milliseconds) Returns undefined. During a sleep period, checks
  • Adobe 27510753 | Scripting Guide - Page 66
    58 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide Prop Class Name A second reference count for the number of properties that reference the object. The garbage collector uses this count to break circular references.
  • Adobe 27510753 | Scripting Guide - Page 67
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 59 Reflection object functions find reflectionObj.find (name) Returns the ReflectionInfo object for the named property of the refl
  • Adobe 27510753 | Scripting Guide - Page 68
    dataType String defaultValue any description String help String isCollection Boolean max Number min Number name type String Number String Adobe InDesign CS2 Scripting Guide The data type of the reflected element. One of: l boolean l number l string l Classname: The class name of an
  • Adobe 27510753 | Scripting Guide - Page 69
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 61 For portions of your user interface that are displayed on the screen, you may want to localize the displayed
  • Adobe 27510753 | Scripting Guide - Page 70
    62 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide Locale names A locale name is an identifier string in that contains an ISO 639 language specifier, and optionally an ISO 3166 region specifi
  • Adobe 27510753 | Scripting Guide - Page 71
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 63 Global getMonth()+1, d.getDate())); ZString Internal use only. A ZString is an internal Adobe format for localized strings, which you might see in Adobe scripts. It is a string that begins with $$$ and contains a path
  • Adobe 27510753 | Scripting Guide - Page 72
    64 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide These dialogs are customizable to a small degree. The to appear as the title of the dialog, if the platform supports a title. Mac OS does not support titles for alert dialogs. The default title string is "Script Alert
  • Adobe 27510753 | Scripting Guide - Page 73
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 65 ➤ Examples This figure shows simple confirmation dialogs in Windows and Mac OS. This figure shows confirmation dialogs
  • Adobe 27510753 | Scripting Guide - Page 74
    66 Using ExtendScript Tools and Features This figure shows confirmation dialogs with a title value specified. Adobe InDesign CS2 Scripting Guide Specifying measurement values ExtendScript provides the UnitValue object to represent measurement values. The properties and methods of the UnitValue object
  • Adobe 27510753 | Scripting Guide - Page 75
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 67 tpc traditional pica traditional picas 12 tpt ci cicero ciceros 12.7872 pt px pixel pixels baseless (see below) %
  • Adobe 27510753 | Scripting Guide - Page 76
    68 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide l To convert pixels into length units, you must know the size of a single pixel. The size of a pixel depends on the display resolution. A common resolution
  • Adobe 27510753 | Scripting Guide - Page 77
    Adobe InDesign CS2 Scripting Guide Using ExtendScript Tools and Features 69 If one a < b; // => true a < 1; // => false a == 98; // => true Modular programming support ExtendScript provides support for a modular approach to scripting by allowing you to include one script in another as a resource
  • Adobe 27510753 | Scripting Guide - Page 78
    70 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide #engine name Identifies the ExtendScript named file into this file at the location of this statement. The file argument is an Adobe portable file specification. See the "Specifying Paths" section. As a convention, use the file
  • Adobe 27510753 | Scripting Guide - Page 79
    Adobe InDesign CS2 Scripting Guide #script name #strict on #target name Using ExtendScript . Importing and exporting between scripts The ExtendScript JavaScript language has been extended to support function calls and variable access across various source code modules and ExtendScript engines.
  • Adobe 27510753 | Scripting Guide - Page 80
    72 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide In calling the function, you deconstruct the implement both order variants in your function or return undefined for combinations that you do not support. For example: this ["/"] = function (operand, rev) { if (rev) { //
  • Adobe 27510753 | Scripting Guide - Page 81
    language code. They take the following form: appname[-version[-locale]] appname An Adobe application name. One of: acrobat aftereffects atmosphere audition bridge encore golive illustrator incopy indesign photoshop premiere version Optional. A number indicating at least a major version. If not
  • Adobe 27510753 | Scripting Guide - Page 82
    photoshop.quit(), and to call it in GoLive CS2, use golive.quit(). l To call the exported function place, defined for Illustrator® CS version 12, call illustrator12. place(myFiles). For information about the cross-DOM and exported functions, see the Bridge JavaScript Reference, available with Adobe
  • Adobe 27510753 | Scripting Guide - Page 83
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 75 5 Working with Documents in (information about a file) l Create a document template l Print a document l Export a document as PDF l Export pages of a document as EPS Note: If you have not already worked through Chapter 3, "
  • Adobe 27510753 | Scripting Guide - Page 84
    76 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide Basic document management In almost all situations until --you tell the document to create a new window. tell application "Adobe InDesign CS2" set myDocument to make document with properties {showing window:false}
  • Adobe 27510753 | Scripting Guide - Page 85
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 77 --At this need to provide a reference to a file to save to in the second --parameter (saving in). tell application "Adobe InDesign CS2" --If the file has never been saved (it's an untitled file), display a prompt. if saved
  • Adobe 27510753 | Scripting Guide - Page 86
    78 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide The save command has two optional parameters: AppleScript --If the active document has not been saved (ever), save it. tell application "Adobe InDesign CS2" if saved of active document is false then --If you do not provide
  • Adobe 27510753 | Scripting Guide - Page 87
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 79 tell document preferences a slug is an area outside the page margins that can be printed or included in an exported PDF. Typically, these areas are used for objects that extend beyond the page edges (bleed) and job/
  • Adobe 27510753 | Scripting Guide - Page 88
    the bleed and slug areas. tell application "Adobe InDesign CS2" --Assumes you have a document open. tell pasteboard preferences of active document --Any of InDesign's guides can use the UIColors constants... set bleed guide color to cute teal set slug guide color to charcoal --...or you can specify
  • Adobe 27510753 | Scripting Guide - Page 89
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 81 set top to the width of the page is less than the sum --of the inside and outside margins. tell application "Adobe InDesign CS2" set myDocument to make document tell margin preferences of page 1 of myDocument set top to 0
  • Adobe 27510753 | Scripting Guide - Page 90
    82 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide set myX1 to left set myY2 to bottom set myX2 to right --Set the application default margin preferences. set top to 0 set left to 0 set
  • Adobe 27510753 | Scripting Guide - Page 91
    command of spreads and master spreads: --CreateGuidesCommand.as --An InDesign CS2 AppleScript --Add a series of guides using the create Guides command. tell application "Adobe InDesign CS2" set myDocument to make document tell spread 1 of myDocument --Parameters (all optional): row count, column
  • Adobe 27510753 | Scripting Guide - Page 92
    for a document. --Assumes you have a document open. tell application "Adobe InDesign CS2" set myDocument to active document tell guide preferences of myDocument set guides in back to true set guides locked to false set guides shown to true set guides snapto to true end tell tell grid preferences of
  • Adobe 27510753 | Scripting Guide - Page 93
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 85 Changing measurement units and ruler to their original values. --Assumes you have a document open. tell application "Adobe InDesign CS2" set myDocument to active document tell view preferences of myDocument set myOldXUnits
  • Adobe 27510753 | Scripting Guide - Page 94
    Adobe InDesign CS2 Scripting Guide --DocumentPresetByExample.as --An InDesign CS2 AppleScript --Creates a new document preset based on the current document settings. tell application "Adobe Creates a new document preset. tell application "Adobe InDesign CS2" --If the document preset "
  • Adobe 27510753 | Scripting Guide - Page 95
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 87 with properties {name InDesign CS2 AppleScript --Set up the first master spread in a new document. tell application "Adobe InDesign CS2" set myDocument to make document --Set up the document. tell document preferences of
  • Adobe 27510753 | Scripting Guide - Page 96
    88 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide tell page 1 set myTextFrame to make text frame a master page named "B-Master" --and at least three document pages. tell application "Adobe InDesign CS2" tell active document set applied master of page 2 to master spread "B-
  • Adobe 27510753 | Scripting Guide - Page 97
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 89 Setting set balance ragged lines to false set baseline shift to 0 set capitalization to normal set composer to "Adobe Paragraph Composer" set desired glyph scaling to 100 set desired letter spacing to 0 set desired word
  • Adobe 27510753 | Scripting Guide - Page 98
    color to color myBlackSwatch set strike through gap color to myNoneSwatch set strike through gap overprint to false set strike through gap tint to 100 Adobe InDesign CS2 Scripting Guide
  • Adobe 27510753 | Scripting Guide - Page 99
    Adobe InDesign CS2 Scripting Guide paragraph style named "BodyText" exists tell application "Adobe InDesign CS2" tell text defaults set applied paragraph and other information. All this information is stored using XMP (Adobe Extensible Metadata Platform)-an open standard for embedding metadata in a
  • Adobe 27510753 | Scripting Guide - Page 100
    An InDesign CS2 AppleScript --Creates a document template, including master pages, layers, a color, paragraph and character styles, guides, and XMP information. tell application "Adobe InDesign CS2" --Make a new document. set myDocument to make document tell myDocument tell document preferences set
  • Adobe 27510753 | Scripting Guide - Page 101
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 93 --Slug set slug bottom ¬ based on:paragraph style "footer_left", justification:right align} end try --Create a layer for guides. try set myLayer to layer "GuideLayer" on error set myLayer to make layer with properties
  • Adobe 27510753 | Scripting Guide - Page 102
    Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide tell grid preferences set baseline metadata preferences set author to "Olav Martin Kvern" set copyright info URL to "http:--www.adobe.com" set copyright notice to "This document is not copyrighted." set copyright status to no
  • Adobe 27510753 | Scripting Guide - Page 103
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 95 set myDate to current date set myString to "Author:" & tab & document preferences of myDocument) ¬ - (right of myMarginPreferences) make guide with properties {orientation:vertical, location:myLeftMargin, ¬ item layer:layer
  • Adobe 27510753 | Scripting Guide - Page 104
    96 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide Printing a document The following script prints the active document using the current print preferences: --PrintDocument.as --An InDesign CS2 AppleScript --Prints the active document using
  • Adobe 27510753 | Scripting Guide - Page 105
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 97 set myY1Offset to the printer property is set to Printer.postscript file, or if the --selected printer does not support collation, then the collating --property is unavailable. Attempting to set it will generate an error
  • Adobe 27510753 | Scripting Guide - Page 106
    98 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide set thumbnails to false --The following properties is not needed because thumbnails is set to false. --set thumbnails per page to 4 set tile to false --
  • Adobe 27510753 | Scripting Guide - Page 107
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 99 --set composite frequency to 175 --set simulate overprint to false Properties corresponding to the controls in the Graphics panel --of the Print dialog box set send image data to all image data set font downloading PDF
  • Adobe 27510753 | Scripting Guide - Page 108
    100 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide --If the preset does not already exist, then create it of --print preferences of myDocument --otherwise, fill in the properties of the existing preset. tell application "Adobe InDesign CS2" try set myPreset to printer
  • Adobe 27510753 | Scripting Guide - Page 109
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 101 print preferences of myDocument end try try set paper gap of myPreset to paper gap of print preferences of
  • Adobe 27510753 | Scripting Guide - Page 110
    102 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide set bleed outside of myPreset to bleed outside of ¬ print preferences of myDocument end try try set bleed marks of myPreset to bleed marks of
  • Adobe 27510753 | Scripting Guide - Page 111
    Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 103 set black myDocument end try try set font downloading of myPreset to font downloading of ¬ print preferences of myDocument end try try set download PPD fonts of myPreset to download PPD fonts of ¬ print preferences
  • Adobe 27510753 | Scripting Guide - Page 112
    104 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide set profile of myPreset to profile of a document open --export command parameters are: --Format as (use either the pdf type enumeration or the string "Adobe PDF") --To as string (you'll have to fill in a complete file path
  • Adobe 27510753 | Scripting Guide - Page 113
    export preferences --Basic PDF output options. set page range to all pages set acrobat compatibility to acrobat 6 set export guides and grids to false set export layers to false set export nonprinting objects to false set export reader spreads to false set generate thumbnails to false try set ignore
  • Adobe 27510753 | Scripting Guide - Page 114
    --simulate overprint is only available when the export standard --is PDF/X-1a or PDF/X-3 --set simulate overprint to false set use document bleed with PDF to true --Set viewPDF to true to open the PDF in Acrobat or Adobe Reader. set view PDF to false end tell --Now export the document. tell active
  • Adobe 27510753 | Scripting Guide - Page 115
    any colons in the page name (e.g., "Sec1:1") so that --they don't cause --problems with file naming. set myPageName to my myReplace(myPageName, ":", "_") set myFilePath to myFolder & myBaseName & "_" & myPageName & ".pdf" tell myDocument --The export command will fail if you provide the file path
  • Adobe 27510753 | Scripting Guide - Page 116
    Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide Exporting all pages The following EPS files --(an EPS, by definition, can contain only a single page). tell application "Adobe InDesign CS2" set page range of EPS export preferences to all pages tell active document --You
  • Adobe 27510753 | Scripting Guide - Page 117
    Guide Working with Documents in AppleScript 109 end myChooseFolder on myExportPages(myFolder) tell application "Adobe + the --value of the counter + ".pdf". set myBaseName to edit contents of myBaseNameField -- Sec1:1") so that --they don't cause --problems with file naming. set myPageName to my
  • Adobe 27510753 | Scripting Guide - Page 118
    110 Working with Documents in AppleScript Adobe InDesign CS2 Scripting Guide
  • Adobe 27510753 | Scripting Guide - Page 119
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 111 6 Working with Documents in (information about a file) l Create a document template l Print a document l Export a document as PDF l Export pages of a document as EPS Note: If you have not already worked through Chapter 3, "
  • Adobe 27510753 | Scripting Guide - Page 120
    112 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Basic document management In almost all situations, your script needs to either open or create a document, save it, and then close it. Creating a new document
  • Adobe 27510753 | Scripting Guide - Page 121
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 113 The close method can take up to two optional parameters: //CloseWithParameters.jsx //An InDesign CS2 JavaScript //Use SaveOptions.yes
  • Adobe 27510753 | Scripting Guide - Page 122
    114 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide //If the file name contains the extension ".indd", an area outside the page margins that can be printed or included in an exported PDF. Typically, these areas are used for objects that extend beyond the page edges (bleed
  • Adobe 27510753 | Scripting Guide - Page 123
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 115 //Slug slugBottomOffset = "18p"; slugTopOffset = "3p bleed and slug widths and heights, you can control the color used to draw the guides defining the bleed and slug. This property is not in the document preferences object-
  • Adobe 27510753 | Scripting Guide - Page 124
    116 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide s.facingPages == true, //"left" means inside; "right" means outside. left = "6p" right = "4p" top = "4p" } InDesign does not allow you to create a page that is smaller
  • Adobe 27510753 | Scripting Guide - Page 125
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 117 //Create a new example document to demonstrate the change. var myDocument = app.documents.add(); myDocument.documentPreferences.pageHeight = "1p"; myDocument.documentPreferences.
  • Adobe 27510753 | Scripting Guide - Page 126
    Adobe InDesign CS2 Scripting Guide guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:(myPageHeight marginPreferences.bottom)}); //Place a guide at the vertical center of the page. guides count, row gutter, //column gutter,guide color, fit margins, remove existing, layer
  • Adobe 27510753 | Scripting Guide - Page 127
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 119 Setting grid preferences To control 's an example: //GuideAndGridPreferences.jsx //An InDesign CS2 JavaScript //Sets preferences for guides and grids. //Assumes you have a document open. var myDocument = app.activeDocument
  • Adobe 27510753 | Scripting Guide - Page 128
    120 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide //Measurement unit choices are: //* MeasurementUnits.picas //* MeasurementUnits.points //* MeasurementUnits.inches //* MeasurementUnits.inchesDecimal //* MeasurementUnits.millimeters //* MeasurementUnits.centimeters //*
  • Adobe 27510753 | Scripting Guide - Page 129
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 121 try { var myPresetName = myDocumentPreset.name; } catch (myError){ myDocumentPreset = app.documentPresets.add({name:"myDocumentPreset"}); } //Set the application default measurement units
  • Adobe 27510753 | Scripting Guide - Page 130
    122 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide columnCount = 1; documentBleedBottom = "3p"; documentBleedTop = "3p"; documentBleedLeft = "3p"; documentBleedRight = "3p"; facingPages = true; pageOrientation = PageOrientation.portrait; pagesPerDocument = 1;
  • Adobe 27510753 | Scripting Guide - Page 131
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 123 //Set up the right page (recto). with(pages.item(1)){ with(marginPreferences){ columnCount = 3; columnGutter = "1p"; bottom = "6p" //"left" means inside; "
  • Adobe 27510753 | Scripting Guide - Page 132
    Documents in JavaScript Adobe InDesign CS2 Scripting Guide try{ fontStyle = "Regular"; } catch(e){} try{ appliedLanguage = "English: USA"; } catch(e){} autoLeading = 100; balanceRaggedLines = false; baselineShift = 0; capitalization = Capitalization.normal; composer = "Adobe Paragraph Composer
  • Adobe 27510753 | Scripting Guide - Page 133
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 125 if(ruleAbove == true){ ruleAboveColor = app.colors.item("Black"); ruleAboveGapColor = app.swatches.item("None"); ruleAboveGapOverprint = false; ruleAboveGapTint = 100; ruleAboveLeftIndent = 0; ruleAboveLineWeight = .
  • Adobe 27510753 | Scripting Guide - Page 134
    126 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Setting the active document's defaults To learn more about XMP, see the XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. You can also add XMP information to a document using InDesign
  • Adobe 27510753 | Scripting Guide - Page 135
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 127 Creating a document template This example template, including master pages, layers, a color, //paragraph and character styles, guides, and XMP information. //Set the application default margin preferences. with (app.
  • Adobe 27510753 | Scripting Guide - Page 136
    128 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide //Create up a pair of paragraph styles for the page footer text. // .rightAlign, pointSize:11, leading:14}); } //Create a layer for guides. try{ myDocument.layers.item("GuideLayer").name; } catch (myError){ myDocument
  • Adobe 27510753 | Scripting Guide - Page 137
    InDesign CS2 Scripting Guide Working with Documents in JavaScript 129 documentTitle = "Example"; jobName = "7 x 9 book layout template"; keywords = ["7 x 9", "book", "template"]; var myNewContainer = createContainerItem("http://ns.adobe.com/xap/1.0/", "email"); setProperty("http://ns.adobe.com/xap
  • Adobe 27510753 | Scripting Guide - Page 138
    130 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide myRightSlug.parentStory.tables.add(); //Body text set to Printer.postscript file, or if the //selected printer does not support collation, then the collating //property is unavailable. Attempting to set it will generate an
  • Adobe 27510753 | Scripting Guide - Page 139
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 131 reverseOrder = false; //pageRange can be either PageRange.allPages or a page range string. pageRange = PageRange.allPages; printSpreads = false; printMasterPages = false; //
  • Adobe 27510753 | Scripting Guide - Page 140
    132 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide textAsBlack = false; thumbnails = false; //The following properties is not needed because thumbnails is set to false. //thumbnailsPerPage = 4; tile = false; //The following properties are not needed
  • Adobe 27510753 | Scripting Guide - Page 141
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 133 profile = Profile.postscriptCMS; } catch(e){} Properties corresponding to the controls in the Advanced panel of the //Print dialog box opiImageReplacement =
  • Adobe 27510753 | Scripting Guide - Page 142
    .paperWidth = paperWidth; } catch(e){} try{ myPreset.printPageOrientation = printPageOrientation; } catch(e){} try{ myPreset.pagePosition = pagePosition; } catch(e){} try{ myPreset.paperGap = paperGap; } catch(e){} try{ myPreset.paperOffset = paperOffset; } Adobe InDesign CS2 Scripting Guide
  • Adobe 27510753 | Scripting Guide - Page 143
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 135 catch(e){} try{ myPreset.paperTransverse = paperTransverse; } catch(e){} try{ myPreset.scaleHeight = scaleHeight; } catch(e){} try{ myPreset.scaleWidth = scaleWidth; } catch(e){} try{ myPreset.scaleMode =
  • Adobe 27510753 | Scripting Guide - Page 144
    ; } catch(e){} try{ myPreset.screening = screening; } catch(e){} try{ myPreset.flip = flip; } catch(e){} try{ myPreset.printBlack = printBlack; } catch(e){} try{ myPreset.printCyan = printCyan; } catch(e){} try{ myPreset.printMagenta = printMagenta; } Adobe InDesign CS2 Scripting Guide
  • Adobe 27510753 | Scripting Guide - Page 145
    Adobe InDesign CS2 Scripting Guide catch(e){} try{ myPreset.printYellow = printYellow; } catch(e){} try{ myPreset.blackAngle = blackAngle; } catch(e){} try{ myPreset.blackFrequency = blackFrequency; } catch(e){} try{ myPreset.cyanAngle = cyanAngle; } catch(e){} try{ myPreset.cyanFrequency =
  • Adobe 27510753 | Scripting Guide - Page 146
    138 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide catch(e){} try{ myPreset.sourceSpace = sourceSpace; } catch(e){} try{ string "Adobe PDF") //To as File //ShowingOptions as boolean (setting this option to true displays the //PDF Export dialog box) //Using as PDF export
  • Adobe 27510753 | Scripting Guide - Page 147
    Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 139 var myPDFExportPreset = app.pdfExportPresets.item("prepress"); app.activeDocument.exportFile(ExportFormat.pdfType, File("/c/myTestDocument.pdf"), false, myPDFExportPreset); Setting PDF export options and exporting pages
  • Adobe 27510753 | Scripting Guide - Page 148
    140 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide exportGuidesAndGrids = false; exportLayers = false; exportNonPrintingObjects = false; exportReaderSpreads = false; generateThumbnails = false; try{ ignoreSpreadOverrides = false; } catch(e){} includeBookmarks = true;
  • Adobe 27510753 | Scripting Guide - Page 149
    Guide Working with Documents in JavaScript 141 pdfMarkType = 1147563124; printerMarkWeight = PDFMarkWeight.p125pt; registrationMarks = true; try{ simulateOverprint = false; } catch(e){} useDocumentBleedWithPDF = true; //Set viewPDF to true to open the PDF in Acrobat or Adobe Reader. viewPDF
  • Adobe 27510753 | Scripting Guide - Page 150
    142 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide app.epsExportPreferences.pageRange = "1-3, 6, 9"; var myFile = new File("/c/myTestFile.eps"); app.activeDocument.exportFile(ExportFormat.epsType, myFile, false); Controlling export options In addition to the page range,
  • Adobe 27510753 | Scripting Guide - Page 151
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 143 7 Working with Documents in (information about a file) l Create a document template l Print a document l Export a document as PDF l Export pages of a document as EPS Note: If you have not already worked through Chapter 3, "
  • Adobe 27510753 | Scripting Guide - Page 152
    144 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Basic document management In almost all situations, your script needs to either open or create a document, save it, and then close it. Creating a new document
  • Adobe 27510753 | Scripting Guide - Page 153
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 145 Closing a document The Close method closes a document: Rem CloseDocument.vbs Rem An InDesign CS2 VBScript Rem Closes the active
  • Adobe 27510753 | Scripting Guide - Page 154
    146 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide If myDocument.Saved = False Then Rem If slug is an area outside the page margins that can be printed or included in an exported PDF. Typically, these areas are used for objects that extend beyond the page edges (bleed) and
  • Adobe 27510753 | Scripting Guide - Page 155
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 147 you might want to omit slug setting the bleed and slug widths and heights, you can control the color used to draw the guides defining the bleed and slug. This property is not in the DocumentPreferences object-instead, it's
  • Adobe 27510753 | Scripting Guide - Page 156
    148 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Setting page margins and columns Each page in a document can have its own margin and column settings. With InDesign scripting, these properties are part of
  • Adobe 27510753 | Scripting Guide - Page 157
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 149 Rem The following assumes that your default master spread contains two pages. With myDocument.MasterSpreads.Item(1).Pages.Item(1).MarginPreferences .
  • Adobe 27510753 | Scripting Guide - Page 158
    150 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem You can use either a number or a measurement string to set the space above/below. .MinimumSpaceAboveAndBelow = "12p" Rem You can set the preview background color (
  • Adobe 27510753 | Scripting Guide - Page 159
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 151 Set myDocument = myInDesign.Documents.Add myDocument.DocumentPreferences.FacingPages = True myDocument.DocumentPreferences.PagesPerDocument = 3 With myDocument.Spreads.Item(2) Rem Note the difference between these two guides
  • Adobe 27510753 | Scripting Guide - Page 160
    152 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem Set the guide color of a guide using an RGB array. With .Guides.Add() .ItemLayer = myLayer .Orientation = idHorizontalOrVertical.idHorizontal .Location = "22p" .GuideColor = Array(192, 192, 192) End With End With You can
  • Adobe 27510753 | Scripting Guide - Page 161
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 153 With myDocument.GuidePreferences .GuidesInBack = True .GuidesLocked = False .GuidesShown = True .GuidesSnapto = True End With With myDocument.GridPreferences .DocumentGridShown = False .DocumentGridSnapto =
  • Adobe 27510753 | Scripting Guide - Page 162
    154 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem At this point, you can perform any series of script actions that Rem depend on the measurement units you've set. At the end
  • Adobe 27510753 | Scripting Guide - Page 163
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 155 .PagesPerDocument = myDocument.DocumentPreferences.PagesPerDocument .SlugBottomOffset = myDocument.DocumentPreferences.SlugBottomOffset .SlugTopOffset = myDocument.DocumentPreferences.SlugTopOffset .SlugInsideOrLeftOffset =
  • Adobe 27510753 | Scripting Guide - Page 164
    156 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem Set up the first master spread in a new document. Set myDocument = myInDesign.Documents.Add Rem Set up the document. With myDocument.DocumentPreferences .PageHeight = "11i" .
  • Adobe 27510753 | Scripting Guide - Page 165
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 157 Use the same property to = False .BaselineShift = 0 .Capitalization = idCapitalization.idNormal .Composer = "Adobe Paragraph Composer" .DesiredGlyphScaling = 100 .DesiredLetterSpacing = 0 .DesiredWordSpacing = 100
  • Adobe 27510753 | Scripting Guide - Page 166
    158 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide .FirstLineIndent = "14pt" .GradientFillAngle .GradientFillLength .GridAlignFirstLineOnly = False .HorizontalScale = 100 .HyphenateAfterFirst = 3 .HyphenateBeforeLast = 4 .HyphenateCapitalizedWords = False .
  • Adobe 27510753 | Scripting Guide - Page 167
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 159 If .RuleBelow = True Then .RuleBelowColor = myInDesign.Colors.Item("Black") .RuleBelowGapColor = myInDesign.Swatches.Item("None") .RuleBelowGapOverPrint = False .RuleBelowGapTint = 100 .RuleBelowLeftIndent = 0 .
  • Adobe 27510753 | Scripting Guide - Page 168
    160 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Using text defaults To set text in learn more about XMP, see the XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. You can also add XMP information to a document using InDesign scripting
  • Adobe 27510753 | Scripting Guide - Page 169
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 161 Rem Creates a document template, including master pages, layers, Rem a color, paragraph and character styles, guides, and XMP information. Set myInDesign = CreateObject("InDesign.Application.CS2") Rem Set the application
  • Adobe 27510753 | Scripting Guide - Page 170
    162 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Set myCharacterStyle = myDocument.CharacterStyles.Add Rem restore normal error handling On Error GoTo 0 Rem Create a layer for guides. Err.Clear On Error Resume Next Set myLayer = myDocument.Layers.Item("GuideLayer
  • Adobe 27510753 | Scripting Guide - Page 171
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 163 Rem restore normal error myDocument.MetadataPreferences .Author = "Olav Martin Kvern" .CopyrightInfoURL = "http:rem www.adobe.com" .CopyrightNotice = "This document is not copyrighted." .CopyrightStatus = idCopyrightStatus.
  • Adobe 27510753 | Scripting Guide - Page 172
    164 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide .ItemLayer = myDocument.Layers.Item("GuideLayer") .Orientation = idHorizontalOrVertical.idHorizontal .Location = myBottomMargin .FitToPage = False End With With .Guides.Add .ItemLayer = myDocument.Layers.Item("GuideLayer") .
  • Adobe 27510753 | Scripting Guide - Page 173
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 165 myBottomMargin + 28, myRightMargin) myRightFooter.ParentStory.InsertionPoints.Item(1).Contents = idSpecialCharacters. idAutoPageNumber myRightFooter.ParentStory.InsertionPoints.Item(1).Contents = idSpecialCharacters.
  • Adobe 27510753 | Scripting Guide - Page 174
    with Documents in VBScript Adobe InDesign CS2 Scripting Guide myTextFrame.Contents = the printer property is set to Printer.postscript file, or if the Rem selected printer does not support collation, then the collating Rem property is unavailable. Attempting to set it will generate an error.
  • Adobe 27510753 | Scripting Guide - Page 175
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 167 Rem PaperSize = idPaperSizes.idCustom Rem Page width and height are ignored if paperSize is not PaperSizes.custom. Rem .PaperHeight =
  • Adobe 27510753 | Scripting Guide - Page 176
    168 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem idTrapping.idAdobeInRIP. If .Trapping = idTrapping.idAdobeInRIP Then .PrintBlack = True .PrintCyan = True .PrintMagenta = True .PrintYellow = True End If Rem Only change the ink angle and
  • Adobe 27510753 | Scripting Guide - Page 177
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 169 Creating printer presets from printing preferences To create a printer preset from the print preferences of a document: Rem CreatePrinterPreset.vbs
  • Adobe 27510753 | Scripting Guide - Page 178
    170 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide myPreset.CropMarks = .CropMarks myPreset.IncludeSlugToPrint ExportPDF.vbs Rem An InDesign CS2 VBScript Rem Exports the active document as PDF. Set myInDesign = CreateObject("InDesign.Application.CS2") Rem Assumes you have a
  • Adobe 27510753 | Scripting Guide - Page 179
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 171 Rem ShowingOptions: boolean (setting this option to true displays the PDF Export dialog box) Rem Using: PDF export preset (or a string that is the name of a PDF export preset) Rem The default PDF export preset names are
  • Adobe 27510753 | Scripting Guide - Page 180
    172 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide .BleedMarks = False End If .ColorBars = True Error GoTo 0 .UseDocumentBleedWithPDF = True Rem Set viewPDF to true to open the PDF in Acrobat or Adobe Reader. .ViewPDF = False End With Rem Now export the document. You'll have
  • Adobe 27510753 | Scripting Guide - Page 181
    Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 173 End If Function myExportPages(myInDesign, "_") myFilePath = myFolderName & "\" & myBaseName & "_" & myPageName & ".pdf" myDocument.Export idExportFormat.idPDFType, myFilePath, False Next Else myDialog.Destroy End If
  • Adobe 27510753 | Scripting Guide - Page 182
    174 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem An InDesign CS2 VBScript. Rem Exports a range of pages as EPS files. Set myInDesign = CreateObject("InDesign.Application.CS2") Rem Enter the name of the
  • Adobe 27510753 | Scripting Guide - Page 183
    Adobe InDesign CS2 Scripting Guide Else myDialog.Destroy End If End Function Working with Documents in VBScript 175
  • Adobe 27510753 | Scripting Guide - Page 184
    176 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184

b
c
Adobe
®
InDesign
®
cs
2
Scripting Guide