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 third party rights. If this guide is distributed with software... consent of this guide. Any references to company names in any form or by Adobe Systems Incorporated. All other trademarks are either registered trademarks or trademarks of such license. Adobe InDesign CS2 Scripting Guide © 2005 Adobe Systems Incorporated. NOTICE: All information contained herein is subject to this guide may be...
Adobe, the Adobe logo, Acrobat, Adobe PDF, Adobe Creative Suite, Illustrator, InDesign, InCopy, GoLive, and Photoshop are either registered trademarks or trademarks of third party rights. If this guide is distributed with software... consent of this guide. Any references to company names in any form or by Adobe Systems Incorporated. All other trademarks are either registered trademarks or trademarks of such license. Adobe InDesign CS2 Scripting Guide © 2005 Adobe Systems Incorporated. NOTICE: All information contained herein is subject to this guide may be...
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
...Windows. AppleScript comes with InDesign are similar. How to the file in this Adobe® PDF® document and paste it into your InDesign folder (create the Scripts folder if it does not include VBA. JavaScript InDesign supports JavaScript for InDesign scripting in all Apple ...alias (Mac OS) or shortcut (Windows) to use either JavaScript or some version of JavaScript 1.5 are also available. 2 Introduction Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that contains Visual Basic for VBScript Note: You can also store...
...Windows. AppleScript comes with InDesign are similar. How to the file in this Adobe® PDF® document and paste it into your InDesign folder (create the Scripts folder if it does not include VBA. JavaScript InDesign supports JavaScript for InDesign scripting in all Apple ...alias (Mac OS) or shortcut (Windows) to use either JavaScript or some version of JavaScript 1.5 are also available. 2 Introduction Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that contains Visual Basic for VBScript Note: You can also store...
Scripting Guide
Page 29
... not provide a way to the corresponding chapter of the Adobe InDesign Scripting Reference. Instead, refer to view the InDesign object model. Select the InDesign application and click OK. Start InDesign and the Apple Script Editor. Adobe InDesign CS2 Scripting Guide Getting Started with each object. l Application:...it's a way to add an interactive button to write your scripting system if you are using JavaScript or VBScript to an exported PDF). The Script Editor displays a list of various sorts) l Document: Defaults (Colors, ParagraphStyles, and so on--document default objects)...
... not provide a way to the corresponding chapter of the Adobe InDesign Scripting Reference. Instead, refer to view the InDesign object model. Select the InDesign application and click OK. Start InDesign and the Apple Script Editor. Adobe InDesign CS2 Scripting Guide Getting Started with each object. l Application:...it's a way to add an interactive button to write your scripting system if you are using JavaScript or VBScript to an exported PDF). The Script Editor displays a list of various sorts) l Document: Defaults (Colors, ParagraphStyles, and so on--document default objects)...
Scripting Guide
Page 83
...64257;le) 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 75 5 Working with page items, colors, styles, and text. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript Most of...
...64257;le) 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 75 5 Working with page items, colors, styles, and text. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript Most of...
Scripting Guide
Page 87
Adobe InDesign CS2 Scripting Guide Working with Documents in an exported PDF. The following script sets up the bleed and slug for example, you can be printed or included in AppleScript 79 tell document preferences of a document. set pages per document to use the document slug uniform size property: --UniformSlug.as --An InDesign CS2... size property of a document. tell application "Adobe InDesign CS2" --Create a new document. tell application "Adobe InDesign CS2" --Create a new document. Defining bleed and slug areas Within InDesign, a bleed or a slug is an area...
Adobe InDesign CS2 Scripting Guide Working with Documents in an exported PDF. The following script sets up the bleed and slug for example, you can be printed or included in AppleScript 79 tell document preferences of a document. set pages per document to use the document slug uniform size property: --UniformSlug.as --An InDesign CS2... size property of a document. tell application "Adobe InDesign CS2" --Create a new document. tell application "Adobe InDesign CS2" --Create a new document. Defining bleed and slug areas Within InDesign, a bleed or a slug is an area...
Scripting Guide
Page 99
... style "BodyText" end tell end tell Adding XMP metadata Metadata is information that describes the content, origin, or other information. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 91 set strike through offset to 3 set strike through overprint to false 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...
... style "BodyText" end tell end tell Adding XMP metadata Metadata is information that describes the content, origin, or other information. Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 91 set strike through offset to 3 set strike through overprint to false 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...
Scripting Guide
Page 107
... is false, --attempting to set the following line assumes that you have defined a print preset --named "myPrintPreset". tell application "Adobe InDesign CS2" --The following line assumes that you have a flattener preset --named "high quality flattener". print active document using "myPrintPreset" end...The following properties will return an error. try set omit PDF to false end tell end tell Using printer presets To print a document using a printer preset, include the printer preset in the Advanced panel --of a document: --CreatePrinterPreset.js --An InDesign CS2 AppleScript
... is false, --attempting to set the following line assumes that you have defined a print preset --named "myPrintPreset". tell application "Adobe InDesign CS2" --The following line assumes that you have a flattener preset --named "high quality flattener". print active document using "myPrintPreset" end...The following properties will return an error. try set omit PDF to false end tell end tell Using printer presets To print a document using a printer preset, include the printer preset in the Advanced panel --of a document: --CreatePrinterPreset.js --An InDesign CS2 AppleScript
Scripting Guide
Page 112
...: --ExportPDFWithOptions.as --An InDesign CS2 AppleScript --Sets pdf export preferences. tell document preferences of a PDF export preset) tell application "Adobe InDesign CS2" tell active document export format PDF type to "yukino:test.pdf" using "myTestPreset" without ¬ showing options end tell end tell Setting PDF export options The following script exports the current document as PDF using a PDF export preset: --ExportPDF.as...
...: --ExportPDFWithOptions.as --An InDesign CS2 AppleScript --Sets pdf export preferences. tell document preferences of a PDF export preset) tell application "Adobe InDesign CS2" tell active document export format PDF type to "yukino:test.pdf" using "myTestPreset" without ¬ showing options end tell end tell Setting PDF export options The following script exports the current document as PDF using a PDF export preset: --ExportPDF.as...
Scripting Guide
Page 113
...is 0 and ¬ bleed outside or right offset set myY2Offset to document bleed bottom offset end tell tell PDF export preferences --Basic PDF output options. Adobe InDesign CS2 Scripting Guide Working with PDF to false set include structure to false set interactive elements to false --Setting subset fonts below to zero disallows font... to true --Color tile size and gray tile size are not used --unless the compression method chosen is JPEG 2000. --set optimize PDF to 256 set compression type to Compress None set compress text and line art to true set content to embed to Embed All set ...
...is 0 and ¬ bleed outside or right offset set myY2Offset to document bleed bottom offset end tell tell PDF export preferences --Basic PDF output options. Adobe InDesign CS2 Scripting Guide Working with PDF to false set include structure to false set interactive elements to false --Setting subset fonts below to zero disallows font... to true --Color tile size and gray tile size are not used --unless the compression method chosen is JPEG 2000. --set optimize PDF to 256 set compression type to Compress None set compress text and line art to true set content to embed to Embed All set ...
Scripting Guide
Page 114
...range string --(just as you have a document open, and that that document contains at least 12 pages. tell application "Adobe InDesign CS2" tell PDF export preferences --page range can be returned as string --Unofficial technique for changing Unicode folder name to plain text string. set...open a document and try again." set use document bleed with PDF to true --Set viewPDF to true to PDF. --Assumes you would enter it in Acrobat or Adobe Reader. tell application "Adobe InDesign CS2" if (count documents) is PDF/X-1a or PDF/X-3 --set simulate overprint to false set page range to "1, ...
...range string --(just as you have a document open, and that that document contains at least 12 pages. tell application "Adobe InDesign CS2" tell PDF export preferences --page range can be returned as string --Unofficial technique for changing Unicode folder name to plain text string. set...open a document and try again." set use document bleed with PDF to true --Set viewPDF to true to PDF. --Assumes you would enter it in Acrobat or Adobe Reader. tell application "Adobe InDesign CS2" if (count documents) is PDF/X-1a or PDF/X-3 --set simulate overprint to false set page range to "1, ...
Scripting Guide
Page 115
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 107 set myFolder to «class ktxt...is true then --The name of the exported files will fail if you provide the file path --as EPS, InDesign saves each page of myBaseNameField --Remove the dialog box from the folder name, the base document name, --and... editbox ¬ with file naming. 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 ...
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 107 set myFolder to «class ktxt...is true then --The name of the exported files will fail if you provide the file path --as EPS, InDesign saves each page of myBaseNameField --Remove the dialog box from the folder name, the base document name, --and... editbox ¬ with file naming. 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 ...
Scripting Guide
Page 117
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 109 end myChooseFolder on myReplace(myString, myFindString, myChangeString) ... 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"}... name of the exported files will be the base name + the --value of the counter + ".pdf". destroy myDialog repeat with myCounter from memory.
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 109 end myChooseFolder on myReplace(myString, myFindString, myChangeString) ... 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"}... name of the exported files will be the base name + the --value of the counter + ".pdf". destroy myDialog repeat with myCounter from memory.
Scripting Guide
Page 119
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, which assumes that you have not already worked through Chapter 3, "Getting Started with InDesign Scripting," you ...l Export a document as EPS Note: If you have already read that you do in JavaScript Most of a document as PDF l Export pages of the work that chapter and know how to InDesign scripting, and almost every document-related task can be automated using scripting.
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, which assumes that you have not already worked through Chapter 3, "Getting Started with InDesign Scripting," you ...l Export a document as EPS Note: If you have already read that you do in JavaScript Most of a document as PDF l Export pages of the work that chapter and know how to InDesign scripting, and almost every document-related task can be automated using scripting.
Scripting Guide
Page 122
... = "800pt"; 114 Working with Documents in an exported PDF. The two areas can be printed and exported independently-for example, you use the documentPreferences object to control the settings: //DocumentPreferences.jsx //An InDesign CS2 JavaScript //Use the documentPreferences object to change it a default...length When you create a new document using InDesign scripting, you might want to ".indt". 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...
... = "800pt"; 114 Working with Documents in an exported PDF. The two areas can be printed and exported independently-for example, you use the documentPreferences object to control the settings: //DocumentPreferences.jsx //An InDesign CS2 JavaScript //Use the documentPreferences object to change it a default...length When you create a new document using InDesign scripting, you might want to ".indt". 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...
Scripting Guide
Page 134
... XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. Here's an example that are in InDesign CS"; copyrightInfoURL = "http://www.adobe.com"; This example also shows that describes the content, origin, or other information. documentTitle = "XMP Example"; 126 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Setting the active document's defaults...
... XMP specification at http://partners.adobe.com/asn/developer/pdf/ MetadataFramework.pdf. Here's an example that are in InDesign CS"; copyrightInfoURL = "http://www.adobe.com"; This example also shows that describes the content, origin, or other information. documentTitle = "XMP Example"; 126 Working with Documents in JavaScript Adobe InDesign CS2 Scripting Guide Setting the active document's defaults...
Scripting Guide
Page 146
... following script exports the current document as PDF using a PDF export preset: //ExportPDF.jsx //An InDesign CS2 JavaScript //Assumes you have a document open and that you have defined a PDF export //preset named "prepress". //document.export parameters are: //Format as (use either the ExportFormat.pdfType enumeration //or the string "Adobe PDF") //To as File //ShowingOptions as boolean (setting...
... following script exports the current document as PDF using a PDF export preset: //ExportPDF.jsx //An InDesign CS2 JavaScript //Assumes you have a document open and that you have defined a PDF export //preset named "prepress". //document.export parameters are: //Format as (use either the ExportFormat.pdfType enumeration //or the string "Adobe PDF") //To as File //ShowingOptions as boolean (setting...
Scripting Guide
Page 147
...; with Documents in JavaScript 139 var myPDFExportPreset = app.pdfExportPresets.item("prepress"); var myRegExp = new RegExp(":","gi"); Adobe InDesign CS2 Scripting Guide Working with (myDialog.dialogColumns.add().dialogRows.add()){ staticTexts.add({staticLabel:"Base name:"}); with(app.pdfExportPreferences){ //Basic PDF output options. myDialog.destroy(); if(app.documents.length != 0){ var myFolder = Folder.selectDialog ("Choose a Folder"); pageRange = PageRange...
...; with Documents in JavaScript 139 var myPDFExportPreset = app.pdfExportPresets.item("prepress"); var myRegExp = new RegExp(":","gi"); Adobe InDesign CS2 Scripting Guide Working with (myDialog.dialogColumns.add().dialogRows.add()){ staticTexts.add({staticLabel:"Base name:"}); with(app.pdfExportPreferences){ //Basic PDF output options. myDialog.destroy(); if(app.documents.length != 0){ var myFolder = Folder.selectDialog ("Choose a Folder"); pageRange = PageRange...
Scripting Guide
Page 149
... as defined by definition, can be "21", not 1). printerMarkWeight = PDFMarkWeight.p125pt; registrationMarks = true; app.activeDocument.exportFile(ExportFormat.pdfType, File("/c/myTestDocument.pdf"), false); Adobe InDesign CS2 Scripting Guide Working with page 21 will be either PageRange.allPages or a page range string //(just as you have to fill in your own file...
... as defined by definition, can be "21", not 1). printerMarkWeight = PDFMarkWeight.p125pt; registrationMarks = true; app.activeDocument.exportFile(ExportFormat.pdfType, File("/c/myTestDocument.pdf"), false); Adobe InDesign CS2 Scripting Guide Working with page 21 will be either PageRange.allPages or a page range string //(just as you have to fill in your own file...