Skip to main content
Participant
November 13, 2008
Question

(AS) Paste into selection (an anchored object)

  • November 13, 2008
  • 3 replies
  • 519 views
I have a script which sets the object style and size of an anchored object, and then I want to paste the text I have copied into the object. I have 100s of anchored objects to set up in the document I am working on now so I'd appreciate some help.

Here is my script:
tell application "Adobe InDesign CS3"
tell active document
set myObjectstyle to object style "Trident anchor"
set myTextFrames to selection
apply object style myTextFrames using myObjectstyle with clearing overrides
end tell
tell application "Adobe InDesign CS3"
set geometric bounds of selection of document 1 to {20.0, 78.0, 39.0, 39.0}
paste into selection -- this bit does not work.
end tell
end tell
This topic has been closed for replies.

3 replies

Inspiring
November 13, 2008
Try this:<br /><br />tell application "Adobe InDesign CS3"<br />set myTextFrame to item 1 of selection<br />set myObjectstyle to object style "Trident anchor" of document 1<br />apply object style myTextFrame using myObjectstyle with clearing overrides<br />set geometric bounds of myTextFrame to {20.0, 78.0, 39.0, 39.0}<br />set selection to insertion point 1 of parent story of myTextFrame<br />paste <br />end tell<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
Participant
November 13, 2008
Hi Simon

Thx for sending me the script, but unfortunately it does not work.

Ozzie
November 14, 2008
Ozzie, please try Shane's solution. It might help if you post a more descriptive explanation, such as the error message, of the reason something fails other than 'unfortunately it does not work'.
November 13, 2008
Hi Ozzie,

Try this and tell me if it works:

>tell application "Adobe InDesign CS3"
]tell active document
]]set myObjectstyle to object style "Trident anchor"

set myTextFrames to selection

set myTextFramesProperties to properties of selection

set myTextFramesStory to parent story of myTextFramesProperties

apply object style myTextFrames using myObjectstyle with clearing overrides
]end tell
]tell application "Adobe InDesign CS3"
]]set geometric bounds of selection of document 1 to {20.0, 78.0, 39.0, 39.0}

set selection to insertion point 1 of myTextFramesStory

paste
]end tell


end tell