Use Applescript to copy Layer Objects between documents
I am trying to script the following with AppleScript:
1. User chooses reference and target files
2. open the reference file
3. Select and copy the objects on a specific layer to the clipboard
4. Paste clipboard contents into specific layer in target file
The InDesign CS3 dictionary has a copy command, but I encounter an error every which way I try to use it
copy v : Copies the selection in the active document window to the clipboard.
My script so far:
-- prompt user for reference and target files
set the reference_file to choose file with prompt "Select the InDesign reference file:" without invisibles
--set the target_file to choose file with prompt "Select the target file:"
tell application "Adobe InDesign CS3"
activate
set myLayer to "Layer 1"
open reference_file
tell active document
set reference_layer to object reference of (layer myLayer)
select every page item of reference_layer
copy selection
--close reference_file saving no
end tell
end tell
ERROR MESSAGE:
"Adobe InDesign CS3 got an error: selection of active document doesn’t understand the copy message."
Any one know how to use the copy verb correctly?
