Adobe 26001360 Scripting Guide - Page 66
Example 1.1, commands, which act on the current selection. The clipboard can be used effectively
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 66 highlights
66 AppleScript Reference Illustrator does not support the select command to change the application's current selection. Use set the selection to in place of select. -- Select the first object in the document tell application "Adobe Illustrator CS" -- Make sure there is a page item to select if (document 1 exists) and (page item 1 of document 1 exists) then set the selection to page item 1 of document 1 end if end tell Example 1.1 You don't need to make objects part of the selection to act on them. The selection is most useful for moving objects to and from the clipboard using the cut, copy and paste commands, which act on the current selection. The clipboard can be used effectively for moving data between applications that do not share common object classes. Note that Illustrator must be the frontmost application when executing any command that deals with the clipboard. We bring Illustrator to the front in the example below by using AppleScript's activate command. -- Copy the current selection to the clipboard then paste it into a new document tell application "Illustrator CS" -- If Illustrator is not the frontmost application, activate it. if not frontmost then activate -- Make sure there is a document to copy from if (count documents) > 0 then -- and a selection to work with set selectedItems to selection of current document if selectedItems is not {} then copy set colorSpace to color space of current document make new document with properties {color space:colorSpace} paste end if end if end tell 12 Aug 03