Pasting images in InDesign

Hello,

I working on a project that requires barcode generation and placement into InDesign. I’ve got everything running except the pasting into InDesign. The barcode gets generated and placed on the clipboard and I want to paste it into a specific box on a page. Problem is, InDesign complains that it doesn’t understand the “paste into” or “paste” commands. Here’s the snippet:


--UPC image is already on the clipboard at this point
tell application "InDesign CS"
	activate
	set tDoc to active document
	tell tDoc
		tell page 1
			set contents of text frame named "TFupc" to UPC
			set contents of text frame named "TFcard" to CARD
			set contents of text frame named "TFcopyrt" to dispCOPYRT
			set contents of text frame named "TFprice" to dispPRICE
			set contents of text frame named "TFmade" to dispMADEIN
			set contents of text frame named "TFsize" to CSIZE
			set contents of text frame named "TFcode" to CCODE
			set contents of text frame named "TFcode" to CCODE
			--These are the 2 lines in question
			select page item named "upcPic"
			paste into
		end tell
	end tell
end tell

The proper frame (named “upcPic”) does get selected. After the script errors out and exits, I can go to the File menu and choose Paste Into and everything works just fine, so I know the UPC image does get placed on the clipboard.

What am I missing?

Thanks in advance.

Use “paste”, not paste into, and target the command at the app, not a document or page.

– Shane Stanley

Excellent!

I moved the “paste into” command per your suggestion and the barcode is now pasted into the box I needed. I need to use “paste into” because we have a specific design requirement for the placement of the barcode which will vary from product to product.

Thanks much!

New code:


--UPC image is already on the clipboard at this point 
tell application "InDesign CS" 
   activate 
   set tDoc to active document 
   tell tDoc 
      tell page 1 
         set contents of text frame named "TFupc" to UPC 
         set contents of text frame named "TFcard" to CARD 
         set contents of text frame named "TFcopyrt" to dispCOPYRT 
         set contents of text frame named "TFprice" to dispPRICE 
         set contents of text frame named "TFmade" to dispMADEIN 
         set contents of text frame named "TFsize" to CSIZE 
         set contents of text frame named "TFcode" to CCODE 
         set contents of text frame named "TFcode" to CCODE 
         --These are the 2 lines in question 
         select page item named "upcPic" 
      end tell 
   end tell 
   paste into 
end tell