毎日モザイク

White Room Layout Works

2012-06-19T17:59:06+09:00 [Tue]

indesignで先端がまんまるの角丸 外側用

今あるものの外側に角丸をくっつけるタイプ。

tell application "Adobe InDesign CS5"
	tell document 1
		try
			set ss to object reference of selection
		on error
			display dialog "選択されていません" buttons {"キャンセル"} default button 1
		end try
		set {button returned:btres} to display dialog "上下or左右" buttons {"上下", "左右", "キャンセル"} default button 3
		repeat with s in ss
			set {y, x, yy, xx} to geometric bounds of s
			set {pr1, pr2, ps} to {{y, x - ((yy - y) / 2), yy, x - ((yy - y) / 2) + (yy - y)}, {y, xx - ((yy - y) / 2), yy, xx - ((yy - y) / 2) + (yy - y)}, {y, x, yy, xx}}
			if btres = "上下" then set {pr1, pr2, ps} to {{y - ((xx - x) / 2), x, y - ((xx - x) / 2) + (xx - x), xx}, {yy - ((xx - x) / 2), x, yy - ((xx - x) / 2) + (xx - x), xx}, {y, x, yy, xx}}
			set r1 to duplicate s
			convert shape r1 given convert to oval
			set geometric bounds of r1 to pr1
			set r2 to duplicate s
			convert shape r2 given convert to oval
			set geometric bounds of r2 to pr2
			add path s with {r1, r2}
		end repeat
	end tell
end tell