How to place image to selected rectangle on indesign
<p>I created an applescript to tell another program to take a certain image link and place that particular image into a new rectangle that was also created through the applescript onto an opened indesign document. It works great! Now I want to take that same applescript and instead of creating a new rectangle object, i want it to be placed on a selected rectangle instead. </p>

<p>Here is my script:</p>

<p>FileMaker Pro Script Step:</p>

<pre><code>set upclink to cell "itemupc" of current record
</code></pre>

<p>InDesign AppleScript:</p>

<pre><code>tell application "Adobe InDesign CS6"
    activate
    set itemlink to "Volumes:ImageByUPC:" &amp; upclink &amp; ".eps" --Creates ImageByUPC image link to place   
    set myDocument to active document --User's active document becomes document to place image  
    tell myDocument
        set noColor to swatch "None" --same as transparent          
        set myRectangle to make rectangle with properties {fill color:noColor, stroke color:noColor, geometric bounds:{0, 0, 3, 3}} --creates new rec at top of doc     
        place alias (itemlink) on myRectangle --InDesign's place function       
        fit myRectangle given proportionally --scales image
        fit myRectangle given center content --scales image     
    end tell
end tell
</code></pre>

<p>I know I need to set myRectangle to the current rectangle (somehow) instead of a new rectangle being made. But can't get it to properly work. </p>

<p>Thanks!</p>