如何将图像放置到选定的矩形上的indesign

如何将图像放置到选定的矩形上的indesign

问题描述:

我创建了一个applescript来告诉另一个程序采取特定的图像链接,并将该特定图像放入一个新的矩形,该矩形也是通过applescript创建到打开的indesign文档上的。它很棒!现在我想采用同一个applescript,而不是创建一个新的矩形对象,而是希望将它放在选定的矩形上。如何将图像放置到选定的矩形上的indesign

这里是我的脚本:

的FileMaker Pro脚本步骤:

set upclink to cell "itemupc" of current record 

InDesign中的AppleScript:

tell application "Adobe InDesign CS6" 
    activate 
    set itemlink to "Volumes:ImageByUPC:" & upclink & ".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 

我知道我需要myRectangle设置为当前矩形(在某种程度上)代替正在制作一个新的矩形。但无法让它正常工作。

谢谢!

+0

尝试在 地方文件(itemlink)“文件”,而不是“别名” – user1754036

+0

你确定这是正确的:试试这个? “Volumes:ImageByUPC:”&upclink&“.eps” 我会尝试没有卷: – user1754036

+0

你能确保你的代码格式正确吗?这种方式很难阅读。 – usr2564301

使用选择的活动文档引用所选矩形。在myRectangle --InDesign的地方功能

tell application "Adobe InDesign CS6" 
    activate 
    set itemlink to "Volumes:ImageByUPC:" & upclink & ".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 item 1 of selection of myDocument -- reference selected rectangle 
     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