下記でトンボのカラーや線幅をカスタマイズすることができます。
global lineW, C, M, Y, K, pt set lineW to 0.05 --色を入力単位% set C to 100 set M to 100 set Y to 100 set K to 100 set pt to 2.83466796875 tell application "Adobe Illustrator" tell document 1 set selectedItems to selection if selectedItems is {} then display dialog "四角をを選択ツールで選択してください。" return end if repeat with selItem in selectedItems set myB to geometric bounds of selItem my makeTombo(myB) end repeat end tell end tell on makeTombo(myB) set X1 to (item 1 of myB) / pt set Y1 to (item 2 of myB) / pt set X2 to (item 3 of myB) / pt set y2 to (item 4 of myB) / pt set myGroup to my makeGroup() my makeLine(X1 - 13, Y1, X1 - 3, Y1, myGroup) --横罫左上 my makeLine(X1 - 13, Y1 + 3, X1, Y1 + 3, myGroup) --横罫左上 my makeLine(X1, Y1 + 13, X1, Y1 + 3, myGroup) --縦罫左上 my makeLine(X1 - 3, Y1 + 13, X1 - 3, Y1, myGroup) --縦罫左上 my makeLine(X1 - 13, y2, X1 - 3, y2, myGroup) --横罫左下 my makeLine(X1 - 13, y2 - 3, X1, y2 - 3, myGroup) --横罫左下 my makeLine(X1, y2 - 13, X1, y2 - 3, myGroup) --縦罫左下 my makeLine(X1 - 3, y2 - 13, X1 - 3, y2, myGroup) --縦罫左下 my makeLine(X2 + 13, Y1, X2 + 3, Y1, myGroup) --横罫右上 my makeLine(X2 + 13, Y1 + 3, X2, Y1 + 3, myGroup) --横罫右上 my makeLine(X2, Y1 + 13, X2, Y1 + 3, myGroup) --縦罫右上 my makeLine(X2 + 3, Y1 + 13, X2 + 3, Y1, myGroup) --縦罫右上 my makeLine(X2 + 13, y2, X2 + 3, y2, myGroup) --横罫右下 my makeLine(X2 + 13, y2 - 3, X2, y2 - 3, myGroup) --横罫右下 my makeLine(X2, y2 - 13, X2, y2 - 3, myGroup) --縦罫右下 my makeLine(X2 + 3, y2 - 13, X2 + 3, y2, myGroup) --縦罫右下 my makeLine(X1 - 13, Y1 + (y2 - Y1) / 2, X1 - 3, Y1 + (y2 - Y1) / 2, myGroup) --横罫左中 my makeLine(X1 - 8, Y1 + (y2 - Y1) / 2 - 5, X1 - 8, Y1 + (y2 - Y1) / 2 + 5, myGroup) --縦罫左中 my makeEllipse(X1 - 8 - 1.5, (Y1 + (y2 - Y1) / 2) + 1.5, 3, 3, myGroup) --○丸左中 my makeLine(X2 + 13, Y1 + (y2 - Y1) / 2, X2 + 3, Y1 + (y2 - Y1) / 2, myGroup) --横罫左中 my makeLine(X2 + 8, Y1 + (y2 - Y1) / 2 - 5, X2 + 8, Y1 + (y2 - Y1) / 2 + 5, myGroup) --縦罫左中 my makeEllipse(X2 + 8 - 1.5, (Y1 + (y2 - Y1) / 2) + 1.5, 3, 3, myGroup) --○丸右中 my makeLine(X1 + (X2 - X1) / 2, Y1 + 13, X1 + (X2 - X1) / 2, Y1 + 3, myGroup) --縦罫中上 my makeLine(X1 + (X2 - X1) / 2 - 5, Y1 + 8, X1 + (X2 - X1) / 2 + 5, Y1 + 8, myGroup) --横罫中上 my makeEllipse(X1 + (X2 - X1) / 2 - 1.5, Y1 + 8 + 1.5, 3, 3, myGroup) --○丸中上 my makeLine(X1 + (X2 - X1) / 2, y2 - 13, X1 + (X2 - X1) / 2, y2 - 3, myGroup) --縦罫中下 my makeLine(X1 + (X2 - X1) / 2 - 5, y2 - 8, X1 + (X2 - X1) / 2 + 5, y2 - 8, myGroup) --横罫中下 my makeEllipse(X1 + (X2 - X1) / 2 - 1.5, y2 - 8 + 1.5, 3, 3, myGroup) --○丸中下 end makeTombo on makeLine(X1, Y1, X2, y2, myGroup) set X1 to X1 * pt set Y1 to Y1 * pt set X2 to X2 * pt set y2 to y2 * pt set W to lineW * pt tell application "Adobe Illustrator" tell document 1 make new path item at end of myGroup with properties ¬ {stroke color:{cyan:C, magenta:M, yellow:Y, black:K}, ¬ stroke width:W, entire path:{{class:path point info, ¬ anchor:{X1, Y1}}, {class:path point info, anchor:{X2, y2}}}} end tell end tell end makeLine on makeEllipse(X1, Y1, W, H, myGroup) tell application "Adobe Illustrator" tell document 1 set X1 to X1 * pt set Y1 to Y1 * pt set myW to W * pt set myH to H * pt set W to lineW * pt make new ellipse at end of myGroup with properties ¬ {filled:false, stroked:true, ¬ stroke color:{cyan:C, magenta:M, yellow:Y, black:K}, ¬ width:myW, height:myH, position:{X1, Y1}, stroke width:W} end tell end tell end makeEllipse on makeGroup() tell application "Adobe Illustrator" tell document 1 if exists group item "TOMBO" then set myGroup to group item "TOMBO" else set myGroup to make group item at beginning ¬ with properties {name:"TOMBO"} end if end tell end tell return myGroup end makeGroup
コメントする