4 Replies Latest reply on Jul 24, 2008 9:58 AM by (Olav_Kvern)

    converting old Quark applescript to InDesign - problems

      Hello

      I'm converting an old Quark applescript to InDesign CS3 finally. I'm having a problem with placing, scaling and adjusting images.

      Here's how it works ... a user fills out a Microsoft Word form, which a designer unlocks and pastes into the layout, and then runs the script. The image frames are all labeled, and that's how I'd like to call them.

      Here's a snippet of the Quark portion that I'm having a problem with ...
      set Todayicon to item (offset from list Dayicons of Todayval) of DayIconEPS
      set Todayiconpath to (OPIpath and Todayicon as string)
      set Todayicon to item 1 of Todayiconpath
      set scale of Todayicon to {"65","65"}
      set offset of Todayicon to {"-1p2","0p5"}

      And here's what I'm thinking I need to do in InDesign CS3 ...
      set Todayicon to item (offset from list Dayicons of Todayval) of DayIconEPS
      set Todayiconpath to (OPIpath and Todayicon as string)
      set Todayicon to item 1 of Todayiconpath
      set TodayiconTransformationMatrix to make transformation matrix with properties {horizontal scale factor:0.65, vertical scale factor:0.65, geometric bounds:[-14,-5]
      transform Todayicon in inner coordinates with matrix TodayiconTransformationMatrix

      Unfortunately, the script errors out when it tries to make the transformation matrix, even though I'm following the examples in the Working with Tranformations in Applescript pdf.

      Any ideas? I guess I can put dummy images in the layout and call a "Place" to override the dummy images, which should keep the scale, but it doesn't help me when I need to offset the images sometimes.
        • 1. Re: converting old Quark applescript to InDesign - problems
          sstanleyau Level 4
          You can always use the slightly slower for less brain-numbing method of<br />avoiding transformation matrices altogether. The the horizontal scale and<br />vertical scale, get the geometric bounds of the frame its in, calculate the<br />new position, then use the move to command.<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
          • 2. Re: converting old Quark applescript to InDesign - problems
            ...Or you can do what I did and place the make transformation and transform statements into their own tell application "Adobe InDesign CS3" block.

            The new scripting model with all of its touted advantaged is really poorly executed.
            • 3. Re: converting old Quark applescript to InDesign - problems
              Level 1
              Hi Gary,

              re: "geometric bounds:[-14,-5]"

              Here's your problem. First, arrays in AppleScript use curly braces. Second, the transformation matrix doesn't have a geometric bounds (note space) property--it has horizontal translate and vertical translate. Something like this:

              set TodayiconTransformationMatrix to make transformation matrix with properties {horizontal scale factor:0.65, vertical scale factor:0.65, horizontal translate: -14, vertical translate: -5
              

              When you translate the object, I'm pretty sure you don't want to use inner coordinates--I expect you want pasteboard coordinates instead.

              Thanks,

              Ole
              • 4. Re: converting old Quark applescript to InDesign - problems
                Level 1
                Philip Regan wrote: "The new scripting model with all of its touted advantaged is really poorly executed."

                While I didn't design the scripting model for transformations, and disagree with some of the decisions made in the design, I understand that InDesign's transformations architecture had to be rewritten for CS3. There were too many cases in CS2 where objects could not be returned to their original coordinates after transformation. The scripting implementation pretty much had to go along with the change in the underlying architecture.

                If you'd rather things work the way they worked in CS2, why not use the set of transform "wrappers" that I wrote and included in the transform tutorial? With those functions, you don't really need to worry about the new model.

                Thanks,

                Ole