Adobe 26001360 Scripting Guide - Page 139
Example 27.2
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 139 highlights
Adobe Illustrator CS Scripting Guide 139 -- Move the 2nd layer to the top of the stacking order tell application "Illustrator CS" if (count layers of current document) > 1 then move layer 2 of document 1 to before layer 1 of document 1 end if end tell Example 27.2 Commands that deal with changes to an object's reference, including the creation of new objects with the make command, return a reference to the new or modified object in their result. This example takes makes use of this situation by storing the reference returned for a newly created layer and then creating a new path item in the layer using the reference. -- Make a new layer at the top of the layer stack -- then create a new path in the layer tell application "Illustrator CS" set layerRef to make layer at document 1 with properties{name: "Our Layer"} make new rectangle at beginning of layerRef end tell Example 27.3 This example demonstrates the power of constructing simple tests (with the whose clause) to selectively delete layers in a document based on their names. In this case, the script deletes all layers in the current document that have names starting with the word "Temporary". -- Delete layers that have a name which begin with a particular string set partialName to "Temp" tell application "Illustrator CS" delete (every layer of document 1 whose name starts with partialName) end tell 12 Aug 03