tell application "InDesign 2.0.1J" tell document 1 set mySelection to selection if (count mySelection) > 0 then ----選択した物の大きさを求める。 repeat with myCounter from 1 to (count mySelection) set myPageItem to item myCounter of mySelection --Get the bounds of the item. set myBounds to geometric bounds of myPageItem if myCounter = 1 then set Y1 to (item 1 of myBounds) set X1 to (item 2 of myBounds) set Y2 to (item 3 of myBounds) set X2 to (item 4 of myBounds) else if item 1 of myBounds < Y1 then set Y1 to (item 1 of myBounds) end if if item 2 of myBounds < X1 then set X1 to (item 2 of myBounds) end if if item 3 of myBounds > Y2 then set Y2 to (item 3 of myBounds) end if if item 4 of myBounds > X2 then set X2 to (item 4 of myBounds) end if end if end repeat -- -- -- -- --初期設定 set myRegColor to color "Registration" set myStrokeWeight to 0.3 set mySelection to selection set ML to 15 set MO to 3 set MM to ML + MO set W to X2 - X1 set H to Y2 - Y1 set CW to X1 + (W / 2) set CH to Y1 + (H / 2) set CC to ML / 2 --tell application "Finder" --display dialog "幅" & (CW as text) & "高さ" & CH as text --end tell --トンボの描画 --左上 make graphic line with properties {geometric bounds:{Y1 - MO, X1, Y1 - MM, X1}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO, X1 - MO, Y1 - MM, X1 - MO}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1, X1 - MO, Y1, X1 - MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO, X1 - MO, Y1 - MO, X1 - MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} --左下 make graphic line with properties {geometric bounds:{Y2 + MO, X1, Y2 + MM, X1}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO, X1 - MO, Y2 + MM, X1 - MO}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2, X1 - MO, Y2, X1 - MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO, X1 - MO, Y2 + MO, X1 - MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} --右上 make graphic line with properties {geometric bounds:{Y1 - MO, X2, Y1 - MM, X2}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO, X2 + MO, Y1 - MM, X2 + MO}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1, X2 + MO, Y1, X2 + MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO, X2 + MO, Y1 - MO, X2 + MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} --右下 make graphic line with properties {geometric bounds:{Y2 + MO, X2, Y2 + MM, X2}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO, X2 + MO, Y2 + MM, X2 + MO}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2, X2 + MO, Y2, X2 + MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO, X2 + MO, Y2 + MO, X2 + MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} --センター make graphic line with properties {geometric bounds:{CH, X1 - MO, CH, X1 - MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{CH - CC, X1 - MO - CC, CH + CC, X1 - MO - CC}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{CH, X2 + MO, CH, X2 + MM}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{CH - CC, X2 + MO + CC, CH + CC, X2 + MO + CC}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO, CW, Y1 - MM, CW}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y1 - MO - CC, CW - CC, Y1 - MO - CC, CW + CC}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO, CW, Y2 + MM, CW}, stroke weight:myStrokeWeight, stroke color:myRegColor} make graphic line with properties {geometric bounds:{Y2 + MO + CC, CW - CC, Y2 + MO + CC, CW + CC}, stroke weight:myStrokeWeight, stroke color:myRegColor} else display dialog "何かを選択してから実行して下さい。" end if end tell end tell