Copy link to clipboard
Copied
Hi,
I am trying to write a script to change the object layer visibility in my documents. I get an error -1708. Does anyone can help me please.
this is my script
tell application "Adobe InDesign CS5.5"
activate
if active book exists then
else
set GetParentPath to ((choose file with prompt "Kies een Indesignbook:" of type "IDb5.5"))
open GetParentPath
delay 1
end if
end tell
tell application "Adobe InDesign CS5.5"
tell active book
set fileList to full name of book contents
end tell
--general
set CountryArray to {"BE", "FR", "NL", "EX", "DE", "NO"}
set CountryID to choose from list CountryArray with prompt "Selecteer de juiste catalogus prijzen." OK button name "Update book" without multiple selections allowed
--make all layers visible
repeat with aFile in fileList
set theDoc to open aFile
set myDocument to active document
tell myDocument
set layers's visible to true
set var_linkcount to count of links
repeat with j from 1 to var_linkcount
tell graphic layer options of parent of link j
try
set graphic layers's visible to true
if CountryID is false then return
set Country to characters 1 thru 2 of item 1 of CountryID as string
set ActiveLayerOption to (Country & " prices")
set DeactivateLayerOption to {}
repeat with x from 1 to count of CountryArray
set i to item x of CountryArray as string
if i is Country then
else
set thisLayer to (i & " prices")
try
set visible of graphic layer thisLayer to false
end try
end if
end repeat
end try
end tell
end repeat
end tell
close theDoc saving yes
end repeat
display dialog "Layers zijn aangepast"
end tell
Copy link to clipboard
Copied
I worked a little bit on the script.. I could resolve the error but now I am wondering how I can put the visiblility of all graphic layers to true..
tell application "Adobe InDesign CS5.5"
activate
if active book exists then
else
set GetParentPath to ((choose file with prompt "Kies een Indesignbook:" of type "IDb5.5"))
open GetParentPath
delay 1
end if
end tell
tell application "Adobe InDesign CS5.5"
tell active book
set fileList to full name of book contents
end tell
--general
set CountryArray to {"BE", "FR", "NL", "EX", "DE", "NO"}
set CountryID to choose from list CountryArray with prompt "Selecteer de juiste catalogus prijzen." OK button name "Update book" without multiple selections allowed
if CountryID is false then return
set Country to characters 1 thru 2 of item 1 of CountryID as string
--make all layers visible
repeat with aFile in fileList
set theDoc to open aFile
set myDocument to active document
tell myDocument
set layers's visible to true
set var_linkcount to count of links
repeat with j from 1 to var_linkcount
tell graphic layer options of parent of link j
set ActiveLayerOption to (Country & " prices")
set DeactivateLayerOption to {}
repeat with x from 1 to count of CountryArray
set i to item x of CountryArray as string
if i is Country then
set thisLayer to (i & " prices")
try
set current visibility of graphic layer thisLayer to true
end try
else
set thisLayer to (i & " prices")
try
set current visibility of graphic layer thisLayer to false
end try
end if
end repeat
end tell
end repeat
end tell
close theDoc saving yes
end repeat
display dialog "Layers zijn aangepast"
end tell
Copy link to clipboard
Copied
Hoi Evilia,
(continuing in English 😉 I've had some problems in Javascript doing the same thing. It seems to me changing a layer of an image invalidates the original reference to that image, so you have to "refresh" any pointers to it. See my Javascript near the bottom of this post: http://indesignsecrets.com/forum/indesign-add-ons-scripts-scripting-and-plug-ins/object-layer-option...
Copy link to clipboard
Copied
Hi,
I already arranged to change layers visibility of documents, thanks.
To make interactive documents I 've placed the original documents in a new indesign document as a image. Above this layer I put some interactivity. All the layers of the new documents are visibile. The only problem is the layers of the original document. I want to change them in the new document with object layer options (without changing the orignal document). My script changedse visibility of the language layers of the placed document, but I want to check that all layers of the placed document are visibile (before hiding the languages I don't want to use)
I hope you can understand my problem.. maybe you can help me with it..
thanks
Copy link to clipboard
Copied
Hi everyone, does anybody have the magic script to avoid the problem of invalidated images still on his computer ? The link is not available anymore and I can't find it anywhere else 😞
Copy link to clipboard
Copied
Here's the updated link
http://indesignsecrets.com/topic/object-layer-options-scripting
Copy link to clipboard
Copied
Hi!
This script can change links layers visibility:
https://sites.google.com/site/dtpscripting/indesign-scripts/linklayersvisibility-jsx
Copy link to clipboard
Copied
Thanks to both of you, my script is now working
Copy link to clipboard
Copied
My god - that script is fantastic!