フォルダ内のEPSファイルを次々にページに配置していきます。InDesignでrectangleを作る場合、座標をスプレッドで指定するため、(横組で右ページX座標が0ならX=210で指定する。)まずページ自体の座標を調べその座標を基準にrectangleを作成しています。
set myPer to 100
set NURI to 3 --塗り足し(0にすると塗り足しなし)
tell application "Adobe InDesign CS2_J"
set myVersion to version
if "4.0." is not in myVersion then
--InDesignのバーション確認
display dialog "Adobe InDesign CS2で使用してください。¬
InDesign2.0が起動している場合は一旦終了し、スクリプトも¬
再起動してください。"
return
end if
end tell
set myFol to choose folder with prompt "フォルダを選択"
set myFol to myFol as string
set myPage to 1--変数myPageを1にしておく。
repeat with myFile in list folder myFol without invisibles
--フォルダ内のアイテム分繰り返す
--以降のif文までは選択ファイル配置&保存を参照
set this_item to (myFol & myFile) as alias
set FType to file type of (info for this_item)
set Fkind to kind of (info for this_item)
if FType is "EPSF" or FType is "EPSP" or FType is "PDF " or ¬
FType is "8BPS" or FType is "TEXT" or ¬
Fkind is "Adobe Photoshop ファイル" or FType is "TIFF" or ¬
Fkind is "TIFF 書類" or Fkind is "EPS ファイル" then
my setEPS(myPage, myFol & myFile, NURI, myPer)
--オリジナル関数setEPSを呼び出す
set myPage to myPage + 1
--変数myPageに1をプラスする。
end if
end repeat
on setEPS(myPage, inputFile, NURI, myPer)
try
tell application "Adobe InDesign CS2_J"
tell active document
if not (exists of page myPage) then
make page at end
end if
set myB to bounds of page myPage
set Y to (item 1 of myB) - NURI
set X to (item 2 of myB) - NURI
set H to (item 3 of myB) - (item 1 of myB) + NURI * 2
set W to (item 4 of myB) - (item 2 of myB) + NURI * 2
tell page (myPage)
set myRect to make rectangle at beginning with properties ¬
{geometric bounds:{Y, X, Y + H, X + W}, stroke weight:0, ¬
fill color:"None", stroke color:"None"}
set EPSobj to place inputFile on myRect
tell EPSobj
set properties to ¬
{vertical scale:myPer, horizontal scale:myPer}
end tell
fit myRect given center content
end tell
end tell
end tell
end try
end setEPS
コメントする