[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(DTPtechNote:1454) [AS Indesign CS2]余白を設定してフィット



set yohaku to 1 * 2 --余白値

tell application "Adobe InDesign CS2_J"
	tell document 1
		set my_every_selection to object reference of selection
		repeat with my_selection in my_every_selection
			tell my_selection
				set tmp_bounds to geometric bounds
				set x1 to item 2 of tmp_bounds
				set x2 to item 4 of tmp_bounds
				set y1 to item 1 of tmp_bounds
				set y2 to item 3 of tmp_bounds
				set geometric bounds to {y1, x1, (y2 - yohaku), (x2 - yohaku)} --大きさを変更
				set frame_x to (item 4 of tmp_bounds) - (item 2 of tmp_bounds) - yohaku
				set frame_y to (item 3 of tmp_bounds) - (item 1 of tmp_bounds) - yohaku
			end tell
			set my_image to object reference of item 1 of all graphics of my_selection
			tell my_image
				set image_bounds to geometric bounds
				set image_x to ((item 4 of image_bounds) - (item 2 of image_bounds)) * (100 / horizontal scale)
				set image_y to ((item 3 of image_bounds) - (item 1 of image_bounds)) * (100 / vertical scale)
			end tell
			fit my_selection given proportionally --内容をフレーム内におさめる
			set geometric bounds of my_selection to {y1, x1, y2, x2} --大きさを戻す
			fit my_selection given center content --内容をセンターに
		end repeat
	end tell
end tell