Adobe 27510753 Scripting Guide - Page 182
Controlling other export options, In addition to the range
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 182 highlights
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 page you want to export in the following line. Rem Note that the page name is not necessarily the index of the page in the Rem document (e.g., the first page of a document whose page numbering starts Rem with page 21 will be "21", not 1). myInDesign.EPSExportPreferences.PageRange = "1-3, 6, 9" Rem Fill in your own file path. myFile = "c:\myTestFile.eps" myInDesign.ActiveDocument.Export idExportFormat.idEPSType, myFile, False Controlling other export options In addition to the page range, you can control other EPS export options using scripting by setting the properties of the EpsExportPreferences object. Rem ExportEachPageAsEPS.vbs Rem An InDesign CS2 VBScript Rem Exports each page of an InDesign CS document as a separate EPS to Rem a selected folder using the current EPS export settings. Set myInDesign = CreateObject("InDesign.Application.CS2") Set myFileSystemObject = CreateObject("Scripting.FileSystemObject") If myInDesign.Documents.Count 0 Then Set myDocument = myInDesign.ActiveDocument Rem VBScript doesn't have a native "get folder" statement, so we'll use Rem InDesign's JavaScript to display a folder browser. myJavaScript = "myFolder = Folder.selectDialog(""Choose a Folder""); myFolderName = myFolder. fsName;" Rem Run the string "myJavaScript" as a JavaScript myFolderName = myInDesign.DoScript(myJavaScript, idScriptLanguage.idJavascript) If myFileSystemObject.FolderExists(myFolderName) Then myExportEPSPages myInDesign, myDocument, myFolderName End If End If Function myExportEPSPages(myInDesign, myDocument, myFolderName) myDocumentName = myDocument.Name Set myDialog = myInDesign.Dialogs.Add With myDialog .Name = "ExportPages" With .DialogColumns.Add With .DialogRows.Add With .StaticTexts.Add .StaticLabel = "Base Name:" End With Set myBaseNameField = .TextEditboxes.Add myBaseNameField.EditContents = myDocumentName myBaseNameField.MinWidth = 160 End With End With End With myResult = myDialog.Show If myResult = True Then myBaseName = myBaseNameField.EditContents Rem Remove the dialog box from memory. myDialog.Destroy For myCounter = 1 To myDocument.Pages.Count myPageName = myDocument.Pages.Item(myCounter).Name myInDesign.EPSExportPreferences.PageRange = myPageName Rem Generate a file path from the folder name, the base document name, Rem and the page name. Rem Replace the colons in the page name (e.g., "Sec1:1") wtih underscores. myPageName = Replace(myPageName, ":", "_") myFilePath = myFolderName & "\" & myBaseName & "_" & myPageName & ".eps" myDocument.Export idExportFormat.idEPSType, myFilePath, False Next