Adobe 27510753 Scripting Guide - Page 85
Closing a document, This example closes all open documents without saving them
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 85 highlights
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 77 --At this point, your script could change or get information --from the hidden document. tell myDocument to make window end tell Closing a document The close command closes a document: --CloseDocument.as --An InDesign CS2 AppleScript --Closes a document. tell application "Adobe InDesign CS2" close document 1 --document 1 always refers to the front-most document. --Note that you can also use: --close active document end tell The close command can take up to two optional parameters: --CloseWithParameters.as --An InDesign CS2 AppleScript --Use SaveOptions.yes to save the document,SaveOptions.no to close the document --without saving, or SaveOptions.ask to display a prompt. If you use --SaveOptions.yes, --you'll 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 of active document is not equal to true then close active document saving ask --Or, to save to a specific file name (you'll have to fill in the file path): --set myFile to "yukino:myTestDocument.indd" --close active document saving yes saving in myFile else --If the file has already been saved to a file, save it. close active document saving yes end if end tell This example closes all open documents without saving them: --CloseAll.as --An InDesign CS2 AppleScript --Closes all documents without saving. tell application "Adobe InDesign CS2" tell documents to close without saving end tell Saving a document In the InDesign user interface, you save a file by choosing Save from the File menu, and you save a file to another file name by choosing Save As. In InDesign scripting, the save command can do either operation: --SaveDocument.as --An InDesign CS2 AppleScript --Saves the active document. --If the active document has been changed since it was last saved, save it. tell application "Adobe InDesign CS2" if modified of active document is true then tell active document to save end if end tell