Hello all:
Probably asking incorrectly but any help is appreciated.
Trying to export PDF pages from an InDesign document that has several layers. The issue is I have a static list of needed “Versions” but those letters or group of letters “repeat” within the Layer names. I am trying to turn on all layers that have a certain letter or letter group within them. I have a static version named AB form my know list but I have a unknown layers that contain ABA and ABQ and another that contains AB. How do I select the AB layer only but not the ABA or the ABQ? I am using a “if xxxx contains” instead “if xxxx is” because the layer name may be multiple different sets of letters.
I know how to get the PDF to create just having a problem with the lists.
The script so far:
use AppleScript version “2.4” – Yosemite (10.10) or later
use scripting additions
set myVersionList to {“LC”, “LR”, “BW”, “AC”, “AR”, “ABA”, “SE”, “AB”, “BR”, “S”, “W”, “SY”, “V”, “Q”, “G”, “C”, “MO”, “SA”, “NM”, “AG”, “ABQ”, “DFX”}
set myLayerList to {}
tell application “Adobe InDesign CC 2018”
set user interaction level of script preferences to never interact
set myDoc to active document
set myCommonLayer to “WTX Common All”
set myDefaultLayer to “Layer 1”
tell myDoc
set visible of layers to false
set visible of layer myDefaultLayer to false
–delete layer myDefaultLayer
set visible of layer myCommonLayer to true
set mylayerCount to count of layers
repeat with i from 1 to mylayerCount
set theLayerName to name of layer i
if theLayerName is not “” then
copy theLayerName to end of myLayerList
end if
repeat with a from 1 to length of myLayerList
set theCurrentlayer to item a of myLayerList
repeat with x from 1 to length of myVersionList
set myCurrentVersion to item x of myVersionList
if theCurrentlayer contains myCurrentVersion then
set visible of layer theCurrentlayer to true
end if
end repeat
end repeat
end repeat
end tell
end tell
My layers within InDesign:
-NM,AG,ABQ
-BW,BR,W,SY,V,Q,G
-LC,LR,AC,AR,ABA,SE,AB,S,C,MO,SA
-BW,ABA,AB,BR,S,W,SY,V,Q,G,MO,SA,DFX
-LC,LR,AC,AR,SE,C,NM,AG,ABQ
-WTX Common All
-DFX
-SA,ABQ
-LC,LR,BW,AC,AR,ABA,SE,AB,BR,S,W,SY,V,Q,G,C,MO,NM,AG
Thank you very much for your help.
Model: MacBook Pro
AppleScript: 2.4
Browser: Safari 537.36
Operating System: macOS 10.12