Scripting Guide
Page 2
...hardcopy or electronic form) may be used or copied in the United States and other countries. Adobe InDesign CS2 Scripting Guide © 2005 Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for demonstration purposes only and are for any means, ... with software that may only be reproduced or transmitted, in the United States and other countries. Adobe, the Adobe logo, Acrobat, Adobe PDF, Adobe Creative Suite, Illustrator, InDesign, InCopy, GoLive, and Photoshop are the property of Apple Computer, Inc., registered in the United...
...hardcopy or electronic form) may be used or copied in the United States and other countries. Adobe InDesign CS2 Scripting Guide © 2005 Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for demonstration purposes only and are for any means, ... with software that may only be reproduced or transmitted, in the United States and other countries. Adobe, the Adobe logo, Acrobat, Adobe PDF, Adobe Creative Suite, Illustrator, InDesign, InCopy, GoLive, and Photoshop are the property of Apple Computer, Inc., registered in the United...
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 ...130 Setting print preferences 130 Using printer presets ...133 Creating printer presets from printing preferences 133 Exporting a document as PDF 138 Using current PDF export options 138 Setting PDF export options and exporting pages separately 139 Exporting a range of pages 141 Exporting pages as EPS 141 Exporting all ...
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 ...130 Setting print preferences 130 Using printer presets ...133 Creating printer presets from printing preferences 133 Exporting a document as PDF 138 Using current PDF export options 138 Setting PDF export options and exporting pages separately 139 Exporting a range of pages 141 Exporting pages as EPS 141 Exporting all ...
Scripting Guide
Page 7
Adobe InDesign CS2 Scripting Guide Contents v 7 Working with Documents in VBScript 143 Basic document management 144 Creating a new document 144 Opening a document...144 Closing a document...145 Saving a document ...... a document 165 Printing using page ranges 165 Setting print preferences 166 Creating printer 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 Exporting pages separately 172 Exporting pages as EPS 173 Exporting all pages ...173 Exporting...
Adobe InDesign CS2 Scripting Guide Contents v 7 Working with Documents in VBScript 143 Basic document management 144 Creating a new document 144 Opening a document...144 Closing a document...145 Saving a document ...... a document 165 Printing using page ranges 165 Setting print preferences 166 Creating printer 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 Exporting pages separately 172 Exporting pages as EPS 173 Exporting all pages ...173 Exporting...
Scripting Guide
Page 10
...the scripts in this Adobe® PDF® document and paste it into your InDesign folder (create the Scripts folder if it does not include VBA. Adobe GoLive® and other programs include VBA. Macintosh To use InDesign scripting on an Adobe implementation of JavaScript 1.5...use either JavaScript or AppleScript. Microsoft Office, Visio, AutoCAD, and other Adobe products also use any user with Long Lines". 2. How to the InDesign Scripts palette. 2 Introduction Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that contains ...
...the scripts in this Adobe® PDF® document and paste it into your InDesign folder (create the Scripts folder if it does not include VBA. Adobe GoLive® and other programs include VBA. Macintosh To use InDesign scripting on an Adobe implementation of JavaScript 1.5...use either JavaScript or AppleScript. Microsoft Office, Visio, AutoCAD, and other Adobe products also use any user with Long Lines". 2. How to the InDesign Scripts palette. 2 Introduction Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that contains ...
Scripting Guide
Page 29
...Editor. The Script Editor displays a standard Open File dialog box. 3. Instead, refer to view the InDesign object model. JavaScript and VBScript If you're using AppleScript or VBScript. Adobe InDesign CS2 Scripting Guide Getting Started with each object. You also can see "System Requirements" in the story) ... controls, dropdowns, checkbox controls, and so on) for building modal dialog boxes) Looking at the InDesign object model Although the objects and commands available in InDesign are using JavaScript or VBScript to an exported PDF). If you can in AppleScript or VBScript.
...Editor. The Script Editor displays a standard Open File dialog box. 3. Instead, refer to view the InDesign object model. JavaScript and VBScript If you're using AppleScript or VBScript. Adobe InDesign CS2 Scripting Guide Getting Started with each object. You also can see "System Requirements" in the story) ... controls, dropdowns, checkbox controls, and so on) for building modal dialog boxes) Looking at the InDesign object model Although the objects and commands available in InDesign are using JavaScript or VBScript to an exported PDF). If you can in AppleScript or VBScript.
Scripting Guide
Page 83
...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, "Getting Started with InDesign Scripting," you might want to do so before continuing with this chapter, which assumes that you... have already read that you do in InDesign revolves around documents-creating them, saving them, and populating them with Documents in AppleScript Most of the work that chapter and know how to create a script. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 75 ...
...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, "Getting Started with InDesign Scripting," you might want to do so before continuing with this chapter, which assumes that you... have already read that you do in InDesign revolves around documents-creating them, saving them, and populating them with Documents in AppleScript Most of the work that chapter and know how to create a script. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 75 ...
Scripting Guide
Page 87
...the bleed and slug for the final printing of a document. tell application "Adobe InDesign CS2" --Create a new document. The two areas can be printed or included in an exported PDF. tell application "Adobe InDesign CS2" --Create a new document. set slug right or outside the page margins that ...pages per document to 16 end tell end tell Note: The application object also has a document preferences object. Adobe InDesign CS2 Scripting Guide Working with Documents in the preceding example, you can alternatively use the document bleed uniform size property: --UniformBleed.as ...
...the bleed and slug for the final printing of a document. tell application "Adobe InDesign CS2" --Create a new document. The two areas can be printed or included in an exported PDF. tell application "Adobe InDesign CS2" --Create a new document. set slug right or outside the page margins that ...pages per document to 16 end tell end tell Note: The application object also has a document preferences object. Adobe InDesign CS2 Scripting Guide Working with Documents in the preceding example, you can alternatively use the document bleed uniform size property: --UniformBleed.as ...
Scripting Guide
Page 99
... text defaults of a file. To learn more about XMP, see the XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. This metadata includes the creation and modification dates of the document, the author of the document, the copyright ...default paragraph style for text in all new documents. --Assumes that an application default paragraph style named "BodyText" exists tell application "Adobe InDesign CS2" tell text defaults set the text defaults for embedding metadata in AppleScript 91 set strike through offset to 3 set strike through ...
... text defaults of a file. To learn more about XMP, see the XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. This metadata includes the creation and modification dates of the document, the author of the document, the copyright ...default paragraph style for text in all new documents. --Assumes that an application default paragraph style named "BodyText" exists tell application "Adobe InDesign CS2" tell text defaults set the text defaults for embedding metadata in AppleScript 91 set strike through offset to 3 set strike through ...
Scripting Guide
Page 107
Adobe InDesign CS2...Properties corresponding to the controls in the print command: --PrintDocumentWithPreset.as --An InDesign CS2 AppleScript --Prints the active document using the specified preset. print active document using...PDF to false --The following line assumes that you have a flattener preset --named "high quality flattener". try set flattener preset name to "high quality flattener" end try set source space to use document set intent to use color management property of a document: --CreatePrinterPreset.js --An InDesign CS2 AppleScript tell application "Adobe InDesign CS2...
Adobe InDesign CS2...Properties corresponding to the controls in the print command: --PrintDocumentWithPreset.as --An InDesign CS2 AppleScript --Prints the active document using the specified preset. print active document using...PDF to false --The following line assumes that you have a flattener preset --named "high quality flattener". try set flattener preset name to "high quality flattener" end try set source space to use document set intent to use color management property of a document: --CreatePrinterPreset.js --An InDesign CS2 AppleScript tell application "Adobe InDesign CS2...
Scripting Guide
Page 112
...!") end tell end tell Exporting a document as --An InDesign CS2 AppleScript --Sets pdf export preferences. tell application "Adobe InDesign CS2" --Get the bleed amounts from your page layout documents. Using current PDF export options The following script exports the current document as PDF using a PDF export preset: --ExportPDF.as --An InDesign CS22 AppleScript --Assumes you have a document open --export command...
...!") end tell end tell Exporting a document as --An InDesign CS2 AppleScript --Sets pdf export preferences. tell application "Adobe InDesign CS2" --Get the bleed amounts from your page layout documents. Using current PDF export options The following script exports the current document as PDF using a PDF export preset: --ExportPDF.as --An InDesign CS22 AppleScript --Assumes you have a document open --export command...
Scripting Guide
Page 113
Adobe InDesign CS2 Scripting Guide Working with PDF to false set include structure to false set interactive elements to false... bit set color bitmap sampling to none --threshold to document bleed bottom offset end tell tell PDF export preferences --Basic PDF output options. set compression type to Compress None set compress text and line art to true... offset set myY1Offset to document bleed top offset set myX2Offset to document bleed outside or right offset set optimize PDF to none. --Other compression options. set bleed bottom to myY2Offset set bleed top to myY1Offset set bleed inside...
Adobe InDesign CS2 Scripting Guide Working with PDF to false set include structure to false set interactive elements to false... bit set color bitmap sampling to none --threshold to document bleed bottom offset end tell tell PDF export preferences --Basic PDF output options. set compression type to Compress None set compress text and line art to true... offset set myY1Offset to document bleed top offset set myX2Offset to document bleed outside or right offset set optimize PDF to none. --Other compression options. set bleed bottom to myY2Offset set bleed top to myY1Offset set bleed inside...
Scripting Guide
Page 114
... open a document and try again." tell application "Adobe InDesign CS2" if (count documents) 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 , and that that document contains at least 12 pages. tell application "Adobe InDesign CS2" tell PDF export preferences --page range can be either...
... open a document and try again." tell application "Adobe InDesign CS2" if (count documents) 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 , and that that document contains at least 12 pages. tell application "Adobe InDesign CS2" tell PDF export preferences --page range can be either...
Scripting Guide
Page 115
... + the value --of the counter + ".pdf". The index of the page in the document is not necessarily the name of the page (as Unicode text--that --they don't cause --problems with file naming. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 107 set...the section options for the section containing the page). export format PDF type to myFilePath end tell end repeat else destroy myDialog end if end tell end myExportPages on myExportPages(myFolder) tell application "Adobe InDesign CS2" set myDocument to active document set myDocumentName to name of myBaseNameField...
... + the value --of the counter + ".pdf". The index of the page in the document is not necessarily the name of the page (as Unicode text--that --they don't cause --problems with file naming. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 107 set...the section options for the section containing the page). export format PDF type to myFilePath end tell end repeat else destroy myDialog end if end tell end myExportPages on myExportPages(myFolder) tell application "Adobe InDesign CS2" set myDocument to active document set myDocumentName to name of myBaseNameField...
Scripting Guide
Page 117
... showing options end tell end repeat else destroy myDialog end if end tell end myExportPages on myExportPages(myFolder) tell application "Adobe InDesign CS2" set myDocument to active document set myDocumentName to name of myDocument set myDialog to make dialog with properties {name:"ExportPages"}...is true then --The name of the exported files will be the base name + the --value of the counter + ".pdf". Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 109 end myChooseFolder on myReplace(myString, myFindString, myChangeString) set AppleScript's text item delimiters to...
... showing options end tell end repeat else destroy myDialog end if end tell end myExportPages on myExportPages(myFolder) tell application "Adobe InDesign CS2" set myDocument to active document set myDocumentName to name of myDocument set myDialog to make dialog with properties {name:"ExportPages"}...is true then --The name of the exported files will be the base name + the --value of the counter + ".pdf". Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 109 end myChooseFolder on myReplace(myString, myFindString, myChangeString) set AppleScript's text item delimiters to...
Scripting Guide
Page 119
...64257;le) l Create a document template l Print a document l Export a document as PDF l Export pages of the work that chapter and know how to create a script. Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 111 6 Working with Documents in InDesign revolves around documents-creating them, saving them, and populating them with this chapter... do in JavaScript Most of a document as EPS Note: If you have not already worked through Chapter 3, "Getting Started with InDesign Scripting," you might want to do so before continuing with page items, colors, styles, and text.
...64257;le) l Create a document template l Print a document l Export a document as PDF l Export pages of the work that chapter and know how to create a script. Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 111 6 Working with Documents in InDesign revolves around documents-creating them, saving them, and populating them with this chapter... do in JavaScript Most of a document as EPS Note: If you have not already worked through Chapter 3, "Getting Started with InDesign Scripting," you might want to do so before continuing with page items, colors, styles, and text.
Scripting Guide
Page 122
..., you use the documentPreferences object to control the settings: //DocumentPreferences.jsx //An InDesign CS2 JavaScript //Use the documentPreferences object to ".indt". 114 Working with Documents in an exported PDF. if(myFileName.indexOf(".indd")!=-1){ var myRegularExpression = /.indd/gi myFileName = myFileName.replace...landscape; The following script sets up the bleed and slug for objects that can be printed or included in JavaScript Adobe InDesign CS2 Scripting Guide //If the file name contains the extension ".indd", change the //dimensions and orientation of the document....
..., you use the documentPreferences object to control the settings: //DocumentPreferences.jsx //An InDesign CS2 JavaScript //Use the documentPreferences object to ".indt". 114 Working with Documents in an exported PDF. if(myFileName.indexOf(".indd")!=-1){ var myRegularExpression = /.indd/gi myFileName = myFileName.replace...landscape; The following script sets up the bleed and slug for objects that can be printed or included in JavaScript Adobe InDesign CS2 Scripting Guide //If the file name contains the extension ".indd", change the //dimensions and orientation of the document....
Scripting Guide
Page 134
...specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. var myDocument = app.documents.add(); jobName = "XMP_Example_2003"; copyrightStatus = CopyrightStatus.yes; 126 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Setting the active document...container (email, in the document's metadataPreferences object. This example also shows that are in this example). //MetadataExample.jsx //An InDesign CS2 JavaScript //Adds metadata to a document using the File Info dialog box (File > File Info). description = "Example of ...
...specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. var myDocument = app.documents.add(); jobName = "XMP_Example_2003"; copyrightStatus = CopyrightStatus.yes; 126 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Setting the active document...container (email, in the document's metadataPreferences object. This example also shows that are in this example). //MetadataExample.jsx //An InDesign CS2 JavaScript //Adds metadata to a document using the File Info dialog box (File > File Info). description = "Example of ...
Scripting Guide
Page 146
... as File //ShowingOptions as boolean (setting this option to true displays the //PDF Export dialog box) //Using as PDF InDesign scripting offers full control over the creation of a //PDF export preset) 138 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide catch(e){} try{ myPreset.sourceSpace = sourceSpace; } catch(e){} try{ myPreset.intent = intent; } catch(e){} try{ myPreset.crd...
... as File //ShowingOptions as boolean (setting this option to true displays the //PDF Export dialog box) //Using as PDF InDesign scripting offers full control over the creation of a //PDF export preset) 138 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide catch(e){} try{ myPreset.sourceSpace = sourceSpace; } catch(e){} try{ myPreset.intent = intent; } catch(e){} try{ myPreset.crd...
Scripting Guide
Page 147
....replace(myRegExp, "_"); app.pdfExportPreferences.pageRange = myPageName; //The name of an InDesign CS document as PDF. var myDialog = app.dialogs.add(); myCounter < myDocument.pages.length; if(myResult == true){ var myBaseName = myBaseNameField.editContents; //Remove the dialog box from memory. myFilePath = myFolder + "/" + myBaseName + "_" + myPageName + ".pdf"; Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 139 var myPDFExportPreset = app...
....replace(myRegExp, "_"); app.pdfExportPreferences.pageRange = myPageName; //The name of an InDesign CS document as PDF. var myDialog = app.dialogs.add(); myCounter < myDocument.pages.length; if(myResult == true){ var myBaseName = myBaseNameField.editContents; //Remove the dialog box from memory. myFilePath = myFolder + "/" + myBaseName + "_" + myPageName + ".pdf"; Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 139 var myPDFExportPreset = app...
Scripting Guide
Page 149
....epsType, myFile, false); pageRange = "1, 3-6, 7, 9-11, 12"; } var myPDFExportPreset = app.pdfExportPresets.item("prepress") app.activeDocument.exportFile(ExportFormat.pdfType, File("/c/myTestDocument.pdf"), false, myPDFExportPreset); Adobe InDesign CS2 Scripting Guide Working with Documents in the Print or Export PDF dialog box). viewPDF = false; } //Now export the document. Exporting a range of pages The following script exports the pages of...
....epsType, myFile, false); pageRange = "1, 3-6, 7, 9-11, 12"; } var myPDFExportPreset = app.pdfExportPresets.item("prepress") app.activeDocument.exportFile(ExportFormat.pdfType, File("/c/myTestDocument.pdf"), false, myPDFExportPreset); Adobe InDesign CS2 Scripting Guide Working with Documents in the Print or Export PDF dialog box). viewPDF = false; } //Now export the document. Exporting a range of pages The following script exports the pages of...