9 Replies Latest reply on Dec 7, 2009 9:31 AM by BSAphex

    CS3: Enable "Print Layer" checkbox?

    BSAphex

      Hello,

      In the each layer dialog box there is a checkbox for "Print Layer". I'm trying to write a line of applescript that will enable that option for all layers in a document.

      I'm new to scripting. Does anyone know what that command would be? Or know of another similar script that I might look at for guidance?

      Thanks,
      Dennis

        • 1. Re: CS3: Enable "Print Layer" checkbox?
          Dirk Becker  Level 4

          Hi Dennis,

           

          Please make yourself familiar with the example programs and documentation ( both installed and separate downloads ), to catch a general understanding. There is also plenty independent documentation on AppleScript itself.

          Then you'd open your favorite object model browser such as AppleScript's dictionary, and search for the keyword "Layer".

          That would show you layers live straight in documents, and have a "printable" property.

           

           

          tell application "Adobe InDesign CS4"

          set printable of every layer of active document to true

          end tell

           

          Btw, AppleScript is a nice language, but at the beginning its near natural, verbose expressions make working programs look really simple and obvious, whereas beyond copy-paste jobs in my opinion it requires more learning than for most other languages I've seen - concepts such as multi level addressing ( of .. of ), complicated restrictions ( whose ... ) and implicit loops ( every ... ) come to mind.

          Dirk
          • 2. Re: CS3: Enable "Print Layer" checkbox?
            BSAphex Level 1

            Hi Dirk,

            Thanks for your help. That line works perfectly. I've looked at the dictionary for InDesign to reverse look up that script.

            I've found several areas for layers when searching "layers". I was able to find the property for "printable", but wondering how you would know to use that property? I guess its something you figure as you go?

             

            I'll spend some time reading up on the stuff you've suggested. I don't plan on scripting anything too complicated yet, but I guess anything could happen.

            Thanks again!

            -D

            • 3. Re: CS3: Enable "Print Layer" checkbox?
              Dirk Becker  Level 4

              > wondering how you would know to use that

               

              You can guess by name. If you are not sure, the AppleScript editor has an output area "Result" for the last evaluated item.

              Run the following single line and see yourself:

               

              tell application "Adobe InDesign CS4" to get properties of first layer of active document

               

              Then modify the printable property in the UI, and run the script again.

               

              The not obvious trick here is the use of the "properties" property which effectively turns an object reference into a loose structure "record" of key-value pairs.

               

              Tools like Script Debugger also allow live inspection of objects, even while single stepping. I have not used it though beyond the demo tryout period, probably because I learned AppleScript before the tool existed, and now use different environments. The ExtendScript Toolkit ESTK which comes with InDesign has the same features.

               

              Dirk

              • 4. Re: CS3: Enable "Print Layer" checkbox?
                Dirk Becker  Level 4

                For the direct way to address a layer, see the "Class" entry. The important part is "contained by" in the elements area, equivalent to the "parent" property. Both point to the document.

                 

                Dirk

                • 5. Re: CS3: Enable "Print Layer" checkbox?
                  sstanleyau Level 4

                  > Tools like Script Debugger also allow live inspection of objects, even while single stepping. I have not used it though beyond the demo tryout period, probably because I learned AppleScript before the tool existed, and now use different environments. The ExtendScript Toolkit ESTK which comes with InDesign has the same features.

                   

                  Languages aside, even mentioning ESTK and SD in the same paragraph is a bit rich. Same features? In your dreams...

                  • 6. Re: CS3: Enable "Print Layer" checkbox?
                    Dirk Becker  Level 4

                    Shane, I was referring to the two described features and tried to make it clear that I do not know more about the commercial product SD. ESTK definitely supports these two features (most of the time, when it is not broken). Besides it is available for free, assuming an existing InDesign installation.

                     

                    Let's try to keep this thread at the level where it started, a beginner's questions regarding AppleScript. I think more pointers to currently recommended resources on AppleScript would be welcome - I can only talk about a book that has been collecting dust in my shelf for more than ten years so I did not even mention it.

                     

                    Dirk

                    • 7. Re: CS3: Enable "Print Layer" checkbox?
                      sstanleyau Level 4

                      Dirk,

                       

                      I meant to include a smiley in there -- in fact, it's in my dreams that ESTK would have similar features.

                      • 8. Re: CS3: Enable "Print Layer" checkbox?
                        Dirk Becker  Level 4

                        Shane, don't worry, actually I also like the language so I appreciate your taking the AppleScript side where I overly advertise ESTK.

                         

                        Dirk

                        • 9. Re: CS3: Enable "Print Layer" checkbox?
                          BSAphex Level 1

                          Hi Dirk,

                          Sorry for the delayed response, I was away from the computer for a few days. Thanks for answering that question.

                          It makes a lot of sense and will hopefully guide me in creating new scripts in the future.

                          I really appreciate you taking the time to explain it all to a newbie.

                          Cheers,

                          Dennis