Is it possible in InDesign CS to totally ingore any and all hidden layers and everything on them that the applescript may encounter, and concern the script entirely with visible layers, without deleting the hidden layer(s)? The InDesign document may or may not make use of master pages, so I would have to assume it does not. There may be text and images on the hidden layers and I don’t want the script retrieving information from these, nor performing any actions upon them, I want it to disregard anything thats hidden, as if the layers had been deleted.
One solution is to copy the InDesign doc, delete any layers that aren’t visible and go from there. I’m looking to explore any alternatives before going this route.
Skip, I"m sure this could be done you would have to get all the visible layers then itterate through the items of the those layers. However if you are just making a making a eps or pdf you can turn of layers and make them the visible layers are what will be exported.
mm
I have created my script that identifies all the players on an InDesign page by class, name, color, fill color or font, and draws an arrow to each. Now I am in the process of fine tuning it. It will identify items on hidden layers as well, and I don’t need that.
I am having some luck by grouping every item on a hidden page together, and then ungrouping them when the script finishes. If items are grouped, they tend to become invisible to AS.
A couple thoughts that may help…
You could try to filter out items on layers “whose visible is false” to bypass processing them.
About grouped items being ‘stealthy’ to AS, once items are grouped in InDesign, their class changes. They are no longer page items, etc. they belong to a group item. And unless you are specifically tagteting group items, they’ll be passed over.
I’d try filtering out the hidden layers over grouping, but that’s just me.
Mark
mleslie,
isn’t that what I said ?
mm
Thanks, you’ve given me some options to explore. I am prone to overlooking the obvious, and I just wanted to make sure there wasn’t some cute little command somewhere that says, “ignore hidden layers”. I’ve searched through InDesign scripting and scoured this web site, and I hadn’t run across anything so simple.
tell application "Adobe InDesign CS3"
tell document 1
set visibleLayers to every layer whose visible is true
set hiddenLayers to every layer whose visible is false
repeat with alayer in visibleLayers
repeat with anItems in page items of alayer
--do stuff
end repeat
end repeat
end tell
end tell
I think this givss the idea
mm
You could do this:
tell application "Adobe InDesign CS2"
tell document 1
set hiddenLayers to every layer whose visible is false
tell page 1
set TheItems to every page item whose item layer is not item 1 of hiddenLayers
end tell
end tell
end tell
and should be able to do this:
tell application "Adobe InDesign CS2"
tell document 1
set hiddenLayers to every layer whose visible is false
tell page 1
set TheItems to every page item whose item layer is not in hiddenLayers
end tell
end tell
end tell
However I must have the syntax off slightly or ID does not support “is in/not in” using lists.
ok so lets take it a step further
tell application "Adobe InDesign CS3"
tell document 1
set TheItems to every page item of every page whose item layer is not visible
repeat with anItems in TheItems
--do stuff
end repeat
end tell
end tell
Thanks mcgrailm, I knew I was missing something simple there to make it work.