2 Replies Latest reply on Jul 24, 2011 3:41 PM by JJ0330

    Script Labels in Applescript and InDesign 5.5.

    JJ0330

      I must be missing something because this should be simple.  Just trying to assign label to an object and then refer to that object by label later.

       

      Just put first move to make sure it works and does move when refer to as just rectangle 1 but not when label name later.  Get error "Can't get rectangle "Rectangle1"".  Thanks.

       

      tell application "Adobe InDesign CS5.5"

      tell document 1
        tell rectangle 1
         move to {2, 2}
        end tell
        set label of rectangle 1 to "Rectangle1"

      --Get error here.
        tell rectangle "Rectangle1"
         move to {4, 4}
        end tell
      end tell

      end tell

       


      set myGroup to make group at page 1 of myDocument with properties {group items:{myTextFrameA,

        • 1. Re: Script Labels in Applescript and InDesign 5.5.
          Muppet Mark Level 5

          Im not sure you were able to target items by label strings before… I recall some changes to labels but can't find that post now… Any hows you look like you need to make a variable to the object first and use that…

           

          tell application "Adobe InDesign CS5"

               tell document 1

                    set FirstRect to first rectangle

                    set label of FirstRect to "Rectangle1"

                    tell FirstRect

                         move to {20, 20}

                         delay 1

                         move to {40, 40}

                    end tell

               end tell

          end tell

           

          Labels are just a property so you can get later by using a filter…

           

          tell application "Adobe InDesign CS5"

               tell document 1

                    tell rectangle 1

                         move to {20, 20}

                    end tell

                    set label of rectangle 1 to "Rectangle1"

                    delay 1

                    tell (first rectangle whose label is "Rectangle1")

                         move to {40, 40}

                    end tell

               end tell

          end tell

          • 2. Re: Script Labels in Applescript and InDesign 5.5.
            JJ0330 Level 1

            Thanks again, that will work.