2 Replies Latest reply on Feb 26, 2010 2:00 AM by Cooroo

    [AS,CS3/4] Can I Automate Object Layer Options?

    Cooroo Level 1

      We are placing images of jewellery, in PSD format. The PSD files have 2 layers, one for the actual jewellery, one for the shadow.

       

      The operators have to place the image, turn off the background layer in Object Layer Options, duplicate the image, turn background on and layer 1 off, and group the 2 images. This is tedious and time-consuming and  I've been asked if I can script something. I've done a lot of Quark and Filemaker scripting, but am pretty new to ID.

       

      Can this process BE scripted? I've examined the CS4 dictionary and can't find any reference to it. I was wondering if there's any sort of UI scripting that could be made to work?

       

      If your answer includes JS, I must confess I don't even know how to run it, but am happy to find out if it will help!

       

      Many thanks, even if the answer is 'No you can't'. In which case I might need to find something like QuickKeys?

        • 1. Re: [AS,CS3/4] Can I Automate Object Layer Options?
          sstanleyau Level 4

          Yes, it's scriptable. Assuming the operator has placed the image, you'd duplicate the frame. Then in each you'd use the "graphic layer options" property of the image to get a reference to the graphic layer option, which has graphic layers as elements. You can then change the "current visibility" property of the layers.

           

          So something like this (untested):

           

          tell application "Adobe InDesign CS4"

          set theFrame to item 1 of selection

          set newFrame to duplicate theFrame

          set glOptions to graphic layer options of image 1 of theFrame

          set current visibility of graphic layer 2 of glOptions to false

          set glOptions to graphic layer options of image 1 of newFrame

          set current visibility of graphic layer 1 of glOptions to false

          end tell

          --

          Shane Stanley <sstanley@myriad-com.com.au>

          AppleScript Pro, April 2010, Florida <http://www.applescriptpro.com>

          • 2. Re: [AS,CS3/4] Can I Automate Object Layer Options?
            Cooroo Level 1

            Shane, you are a total star! I was unable to translate anything in the InDesign Scripting library into script that would run, and gave up and spent most of yesterday struggling to put it all together in QuickKeys, with limited success...

             

            Your script works perfectly. I have a couple of extra bits to add (back image must be set to blend mode multiply) but I've worked that out by myself and the script is going to start changing lives today.

             

            Several large, cold lagers are yours if our paths ever cross!