• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Object layer visibility - Applescript

New Here ,
Mar 05, 2012 Mar 05, 2012

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

TOPICS
Scripting

Views

4.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2012 Mar 05, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2012 Mar 05, 2012

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2012 Mar 06, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 12, 2013 Sep 12, 2013

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 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 12, 2013 Sep 12, 2013

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 12, 2013 Sep 12, 2013

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2013 Sep 13, 2013

Copy link to clipboard

Copied

Thanks to both of you, my script is now working

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 21, 2019 Jan 21, 2019

Copy link to clipboard

Copied

LATEST

My god - that script is fantastic!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines