5 Replies Latest reply on Sep 22, 2011 3:38 AM by Muppet Mark

    Applescript - Set fill color of path?

    JJ0330 Level 1

      Hi, create a path and when working within InDesign, I can select the path and set the fill color but can't figure out how to do within Applescript.  Is this possible?

       

      Thanks,  Joe

        • 1. Re: Applescript - Set fill color of path?
          Muppet Mark Level 5

          With script there is NO need to 'select' objects in order to change their properties… You can just target a page item by reference then change any of the properties that are r/w… You can also create these objects from script… So yes script can do all of this…

          • 2. Re: Applescript - Set fill color of path?
            JJ0330 Level 1

            Sorry, I might have explained it wrong.  I was just saying that if I work directly in InDesign then I can just manually select the path and set the fill color.  My problem is how to reference path in Applescript so I can set fill color.

             

            I do it now with rectangles and so on like below but can't seem to find any help on how to reference the path?

             

            tell first rectangle

                 set fill color to "C=100 M=0 Y=0 K=0"

            end tell

             

            Thanks,

            Joe

            • 3. Re: Applescript - Set fill color of path?
              Muppet Mark Level 5

              Here you reference the first 'rectangle' of what ever your parent tell block is doc/spread/page etc. This is a specific collection of objects… the same as 'ovals' or 'groups' would be… If the page item you already have is a drawn shape then it probably falls under the class of 'polygon' if you look at the super class 'page items' you will see the list of available options…

              • 4. Re: Applescript - Set fill color of path?
                JJ0330 Level 1

                Perfect, didn't think to use polygon so that worked just like doing rectangle which works great!  Thanks again.

                • 5. Re: Applescript - Set fill color of path?
                  Muppet Mark Level 5

                  If you are newish to AppleScript the use something like this (run from Script Editor)… Possibly the quickest and easiest way to see what objects you are working with…

                   

                  tell application "Adobe InDesign CS2"

                    tell the active document

                    get class of every item of selection

                    get properties of every item of selection

                    end tell

                  end tell

                   

                  The first list will be the types, the second their properties, consult either the app dictionary or the script guide to see if they are r/w and what class they expect…