Re: Illustrator Scripting
Re: Illustrator Scripting
- Subject: Re: Illustrator Scripting
- From: Simon Topliss <email@hidden>
- Date: Fri, 11 Mar 2005 19:10:26 +0000
On 11 Mar 2005, at 6:51 pm, I wrote:
I'm trying to grab a compound path item with a spot color of "Pantone
871 C" and move this item to the back. How can I write this so it will
only move the compound path that has this color fill property?
Compound path items don't have a fill color, only path items do. So
you need to find path items of compound path items whose spot color is
"Pantone 871 C", like this.
tell application "Illustrator CS"
set x to path items of compound path items of layer 1 of document 1
whose name of spot of fill color of it is "PANTONE 871 C"
repeat with i from 1 to x's length
move (container of item i of x) to end of layer 1 of document 1
end repeat
end tell
This version is more robust and won't try to move compound path items
that have already been moved.
tell application "Illustrator CS"
set x to path items of compound path items of layer 1 of document 1
whose name of spot of fill color of it is "PANTONE 871 C"
set movedItems to {}
repeat with i from 1 to x's length
set c to container of item i of x
try -- nasty workaround to store a unique reference to the compound
path item in the list of compound path items already moved (movedItems)
c as string -- will always error
on error m -- "Can't make «class caCP» 1 of «class caLY» 1 of
document 1 of application "Illustrator CS" into a string."
set cStr to m -- «class caGP» 1 of «class caLY» 2 of document 1
end try
if cStr is not in movedItems then -- we haven't already moved the
compound path item
move c to end of layer 1 of document 1
set end of movedItems to cStr
end if
end repeat
end tell
Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden