3 Replies Latest reply on Feb 25, 2013 11:52 AM by david_k

    IDCS5 Applescript

    JADarnell Level 1

      Hi All:

       

      I have this snippet in my Image Box Library:

       

      set mygraphic to make rectangle
      tell mygraphic
        --  Removed a bunch of "sets" to make snippet simpler.
      my DebugMsg("applying rotation--creating rotation matrix; RuleAngle is " & RuleAngle as string)
      --  Crashes at this statement.
      set myRotateMatrix to make transformation matrix with properties {counterclockwise rotation angle:29}
      my DebugMsg("Just made matrix.  About to apply transform.")
      transform in pasteboard coordinates from center anchor with matrix myRotateMatrix

       

      When I attempt to make the transformation matrix, the script crashes.  I know this because the DebugMsg handler throws up a display dialog with the message contained as an argument.  I see the "applying rotation..." dialog, but I never see the "Just made matrix..." dialog.

       

      The above code is modeled after a snippet I found in the InDesign CS5 Scripting Guide_AS on pages 69 and 70:

       

      --Rotate a rectangle "myRectangle" around its center point.

      set myRotateMatrix to make transformation matrix with properties {counterclockwise rotation angle:27}

      transform myRectangle in pasteboard coordinates from center anchor with matrix myRotateMatrix

       

      So I am at a loss to explain why my code does not work.

       

      Can anyone help here?

       

      R,

      John

        • 1. Re: IDCS5 Applescript
          Muppet Mark Level 5

          Do you really need to use the matrix transformations? That is the red pill… on the other hand the blue pill…

           

          tell application "Adobe InDesign CS5"

            activate

                    tell the active document

                              set myrectangle to make new rectangle

                              set absolute rotation angle of myrectangle to 29

                    end tell

          end tell

          • 2. Re: IDCS5 Applescript
            -hans- Level 4

            hi,

             

             

            parent (specifier, r/o) : The parent of the transformation matrix (a application).

            so remove

             

            set myRotateMatrix to make transformation matrix with properties {counterclockwise rotation angle:29}

            from the myGraphic-tell-block.

             

            Example:

             

            tell application "Adobe InDesign CS5.5"

                set myRotateMatrix to make transformation matrix with properties {counterclockwise rotation angle:27}

               

                tell (item 1 of selection)

                   

                    transform in pasteboard coordinates from center anchor with matrix myRotateMatrix

                end tell

            end tell

             

            Hope it'll be of some help

             

             

            Hans-Gerd Claßen

            • 3. Re: IDCS5 Applescript
              david_k

              Maybe I can get a response to this....

               

              on your rotation here, using the

               

              set absolute rotation angle of myrectangle to 29

               

              how do you specify around what anchor point you want that rotation to occur.

               

              david