3 Replies Latest reply on Feb 10, 2009 10:33 PM by sstanleyau

    How to insert page item into text frame?

    Bertus Bolknak
      Applescript, InDesign CS3

      Hello,

      On my page I am talking to a text frame.
      I could easily enter text with the command set last insertion point to "a text". No problem, but:

      Somewhere on my page I have also a page item (which is a small rectangle). I would like to insert (cut and paste or whatever) that small rectangle at the end of my text into my text frame (so that the small rectangle becomes part of the text just as if it was a character).

      How can this be done with Applescript?

      Hoping very much that someone can help me with example code.

      Kind regards,
      Bertus Bolknak.
        • 1. Re: How to insert page item into text frame?
          sstanleyau Level 4
          You will have to cut and paste: set the selection to the frame, tell the app<br />to copy, set the selection to the insertion point where you want it to go,<br />and then tell the app to paste.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
          • 2. Re: How to insert page item into text frame?
            Level 1
            Hi Bertus,

            Thanks Shane! You could also re-create the object at the insertion point--something like this:

            --Given an insertion point "myInsertionPoint" and an existing
            
            --rectangle myRectangle...
            set myProperties to properties of myRectangle
            tell myInsertionPoint
            set myNewRectangle to make rectangle with properties myProperties
            end tell

            Ole
            • 3. Re: How to insert page item into text frame?
              sstanleyau Level 4
              On 11/2/09 5:08 PM, "Olav Kvern" <member@adobeforums.com> wrote:<br /><br />> You could also re-create the object at the insertion point--something like<br />> this: <br /><br />That's true. The problem, though, is that it only replicates the direct<br />properties of the frame. All the properties that reference other settings<br />objects get ignored, so in practise it's either a risky procedure or<br />complicated, especially with text frames and properties like text frame<br />preferences.<br /><br />Like you, I'm no fan of copy and paste for scripting, but until you can<br />convince someone to implement a suitable move command, it's probably the<br />easiest option here. On the plus side, on Macs at least it seems<br />surprisingly stable, and doesn't require InDesign to be frontmost.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>