Skip to main content
Participant
July 13, 2011
Question

Copying image from one document to another

  • July 13, 2011
  • 2 replies
  • 395 views

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

This topic has been closed for replies.

2 replies

Jongware
Community Expert
Community Expert
July 13, 2011

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.)

Participant
July 13, 2011

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

Participant
July 13, 2011

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!