3 Replies Latest reply on Jul 13, 2011 7:19 AM by [Jongware]

    Copying image from one document to another

    VisualBasicUser

      Hello,

       

      It is probably a dumb question, but Macintosh and I are like fire and water. I made an indesign document where all the barcodes of my products are stored and another document with the layout of my catalogue. I would like now to paste the first barcode picture from the first document in the first rectangle of the second document using a script.

       

      This is what i have so far (applescript):

       

      tell application "Adobe InDesign CS4"

       

           set Buffer to rectangle 1 of document "test.indd"

           select Buffer

           copy

           set selected to rectangle 1 of page 1 of document "example.indd"

           paste into selected

       

      end tell

       

      I'm getting the error: Invalid selection status.

       

      Can someone help me?

       

      Thanks

        • 1. Re: Copying image from one document to another
          VisualBasicUser Level 1

          Ok, I managed to get the image on the other page. My last concern is using the paste into statement.

          Is it possible to paste the image in a predefined rectangle on my document page?

          Trying to do so gives the error : does not understand paste into command!

           

          It would be awesome if someone could help me!

          • 2. Re: Copying image from one document to another
            [Jongware] Most Valuable Participant

            VisualBasicUser wrote:

             

            [...] Macintosh and I are like fire and water.

             

            Slightly off-topic, but what if you use Javascript to write your scripts?

             

            Javascript systax looks more like Visual Basic than Applescript does (I don't think there is any other programming language quite like Applescript), and it has the humongous advantage you can develop your scripts in the comfort of your own Windows computer -- and it will run on Macs as well!

             

            (There are only a few -- very minor -- caveat emptors to consider, and IIRC they all have to do with the difference in file systems only.)

            • 3. Re: Copying image from one document to another
              VisualBasicUser Level 1

              You are completely right! Got my copy of Visual Basic not in the building however.

              I just came to the conclusion my questions are quite stupid... It is my first day applescript though!

               

              Here is the solution:

               

              tell application "Adobe InDesign CS4"

               

              set myFrame to item 1 of rectangle 1 of document "test.indd"

              set selection to item 1 of myFrame

              copy

              set myDocument to document "example.indd"

              set active document to myDocument

              set myRectangle to item 1 of rectangle 1 of myDocument

              set selection to item 1 of myRectangle

              paste into

               

              end tell