Re: InDesign CS2: Test graphics for item layer
Re: InDesign CS2: Test graphics for item layer
- Subject: Re: InDesign CS2: Test graphics for item layer
- From: David Wolfe <email@hidden>
- Date: Fri, 5 Sep 2008 18:43:25 -0400
I've now gotten past the delete part with
delete graphic 1 of theWarning
Now the problem seems to be this: my test document has three images.
One on the "base" layer, one on the "art" layer, and one on the "Text"
layer. It seems that the repeat loop is setting a counter up for three
iterations, but it's duplicating the one item that's on "Text" once
for each of the three repeats, instead of testing each one for the
layer.
Does that make sense? Anyone have any pointers?
Thanks,
David
On Sep 5, 2008, at 6:27 PM, David Wolfe wrote:
I got past this challenge by adding "as page item"
set myGraphics to all graphics of active document as page item
if (count myGraphics) > 0 then
tell active document
repeat with i from 1 to count of myGraphics
if name of item layer of page item i is "Text" then
set theWarning to duplicate page item i
set item layer of theWarning to "On Text"
delete image of theWarning
set content type of theWarning to unassigned
My next challenge is figuring out how to delete the content of the
duplicated graphic. You can't set the content type to unassigned
unless it doesn't have any content, but I can't figure out how to
delete the image within the frame.
Anyone?
Thanks,
David
On Sep 5, 2008, at 5:25 PM, Stockly, Ed wrote:
David>I've put together the code below. When the script reaches
"if name of item layer of i is. . ."
it errors, stating, "Can't get item layer of 1."
repeat with i from 1 to count of myGraphics
The error your getting is due to the construct of your repeat loop.
In this loop:
repeat with i from 1 to count of myGraphics
The variable i has a value of 1 then 2 then 3 etc. each time the
loop is
executed.
You literally asking for the layer of the integer 1, which trips
the error.
"if name of item layer of graphic i is. . ."
Is closer to what you want, but in CS2, item layer is not a
property of
graphic, so that probably won't work.
You may need to try something like this:
(totally untested)
repeat with thisGraphic in myGraphics
repeat with x from 1 to count of item layers
if thisGraphic is in item layer x then
set LayerName to name of item layer x
exit repeat
end if
end repeat
HTH,
ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden
)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden