配置された画像がフレームより大きかったらフレームに3mmの線をつけるAppleScript。
使用用途としてはスクリプトでざっくり画像を配置した後に、このAppleScriptを起動して確認するといった感じ。
大量に画像を配置するサムネイル作成用のJavaScriptの補助として書きました。
判定が雑なのでフレームにぴったりサイズでも大きいと判断したりします。
あとドキュメントに「枠」というスウォッチがないとダメです。
動画はこちら。
コードはこちら。
tell application "Adobe InDesign CS4"
set targetRef1 to a reference to every rectangle of active document --ドキュメント中のすべてのrectangle
repeat with i in targetRef1
tell i
try
set frameBounds to geometric bounds
set frameWidth to (item 4 of frameBounds) - (item 2 of frameBounds)
set frameHight to (item 3 of frameBounds) - (item 1 of frameBounds)
tell graphic 1
set EPSBounds to geometric bounds
set EPSWidth to (item 4 of EPSBounds) - (item 2 of EPSBounds)
set EPSHight to (item 3 of EPSBounds) - (item 1 of EPSBounds)
end tell
if (EPSWidth > frameWidth) or (EPSHight > frameHight) then
set stroke weight to "3mm"
set stroke color to "枠"
end if
end try
end tell
end repeat
display dialog "終了"
end tell