Skip navigation
Currently Being Moderated

Object layer visibility - Applescript

Mar 5, 2012 11:27 AM

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

 
Replies
  • Currently Being Moderated
    Mar 5, 2012 2:10 PM   in reply to Evilia_77

    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-an d-plug-ins/object-layer-options-scripting

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2013 6:09 AM   in reply to [Jongware]

    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 :(

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2013 7:02 AM   in reply to Afreesh
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2013 9:13 AM   in reply to Evilia_77
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2013 12:54 AM   in reply to Sergey Anosov

    Thanks to both of you, my script is now working

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points