2 Replies Latest reply on Jul 16, 2008 10:17 AM by (Micha_Tietz)

    Using CS3-transform instead resize (CS2) (VBScript)

      Hello everybody,

      I have some trouble to convert a script from CS2 to CS3.
      My old (CS2-) Code was:

      myDocument.PageItems.Item(myItemLoopCounter).Images.Item(1).Resize myScaleX, myScaleY, , True, False, False

      I replace this with 2 new lines:

      Set myScaleMatrix = myInDesign.TransformationMatrices.Add(myScaleX / 100, myScaleY / 100)

      myDocument.PageItems.Item(myItemLoopCounter).Images.Item(1).Transform idCoordinateSpaces.idPastboardCoordinates, idAnchorPoint.idCenterAnchor, myScaleMatrix

      But I get the error-message "Run time error 424: Object reqired".
      I am grateful for any notice.
      Micha
        • 1. Re: Using CS3-transform instead resize (CS2) (VBScript)
          Level 1
          Hi Micha,

          My first thought is that there's a typo--"idPastBoardCoordinates" should be "idPasteBoardCoordinates".

          My second thought is that you've run into a page item that does not contain an image. Is that possible?

          Thanks,

          Ole
          • 2. Re: Using CS3-transform instead resize (CS2) (VBScript)
            Level 1
            Hi Ole,

            thank you for the reply. The spelling mistake is now corrected.

            But the error ist the same.
            Before ich use the Transform, I check for a image with

            If myDocument.PageItems.Item(myItemLoopCounter).Images.Count > 0 Then

            myScaleX = 100.42
            myScaleY = 100 / myImageHoehe * 50

            Rem this was my old (CS2) command
            Rem myDocument.PageItems.Item(myItemLoopCounter).Images.Item(1).Resize myScaleX, myScaleY, , True, False, False

            Rem ... and this is my attempt
            Set myScaleMatrix = myInDesign.TransformationMatrices.Add(myScaleX / 100, myScaleY / 100)
            myDocument.PageItems.Item(myItemLoopCounter).Images.Item(1).Transform idCoordinateSpaces.idPasteboardCoordinates, idAnchorPoint.idCenterAnchor, myScaleMatrix

            End If

            I can see in the open document, that a graphikbox with picture is selected.

            Now I have make another test: I delete the picture in thie first box and the script will now select the first (now empty) graficbox and go on to the next (with picture in it). There I get the same error as before.

            Sorry for my english. Can you help me?

            Micha