|
初めまして いつも参考にさせていただいております。 200頁程度のドキュメントからページ毎にJpegに書き出すスクリプトを書いています。 200枚のJpegを書き出すところまではたどり着けましたが、ファイル名の設定がどうしてもうまく行きません。どのようにすればうまく行くのか皆様のお知恵を拝借させてください。
具体的には、 ・各ページに1点の画像がリンクされているドキュメントから ・「リンクファイル名.jpg」と書き出しをしたい。
見よう見まねでやってみましたが、ここから先に進めません。 よろしくお願いします。
なお、当方の環境は OS XでCSを利用しています。
以下、スクリプト////////////////////
set EASelection to false -- options (true/false)
set EASpread to false -- options (true/false)
set EAQuality to "maximum" -- options (low/medium/high/maximum)
set EARendering to "baseline" -- options (baseline encoding/progressive encoding)
tell application "InDesign CS_J" set the_container to (file path of document 1 as string) set pagecount to count pages of document 1 tell active document set idLink to links repeat with Myset from 1 to (count idLink) set LinkName to name of item Myset of idLink as string end repeat end tell repeat with x from 1 to pagecount set y to x as string set properties of JPEG export preferences to {Exporting Selection:EASelection, Page String:y, JPEG Quality:EAQuality, JPEG Rendering style:EARendering} tell document 1 set myFile to the_container & ":" & LinkName & ".jpg" as string export format JPG to myFile without showing options end tell end repeat end tell
ここまで////////////////////////////////
|
No.591 2008/01/25(Fri) 16:46:12
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
|
Re: Jpeg書き出しスクリプトについて / せうぞー |
|
|
|
CSはもうすっかり使わないので、CS3ならこんな感じかな。ご参考までに。 #ろくにエラー処理してません^^
to save_jpeg(my_folder, my_name, page_no) tell application "Adobe InDesign CS3" tell JPEG export preference 1 set JPEG Quality to maximum set Exporting Spread to false set JPEG Rendering style to baseline encoding set resolution to 72 set JPEG export range to export range set Page String to page_no end tell export document 1 format JPG to my_folder & my_name & ".jpg" end tell end save_jpeg
tell application "Adobe InDesign CS3" tell document 1 set my_folder to (file path) as Unicode text --ドキュメントのあるフォルダ repeat with page_no from 1 to (count every page) tell page page_no if all graphics is not {} then set my_link to object reference of item link of item 1 of all graphics set my_name to do shell script "echo '" & name of my_link & "' | sed -E -e 's/\\....?.?$//;'" --拡張子2文字〜4文字のみ対応 my save_jpeg(my_folder, my_name, page_no as Unicode text) end if end tell end repeat end tell end tell
|
No.592 2008/01/25(Fri) 19:07:27
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; ja-jp) AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6
|
|
Re: Jpeg書き出しスクリプトについて / 匿名A |
|
|
|
このプログラムは、
ループ1 LinkNameにidLinkリストからリンクファイル名を入れる ループ1終わり
ループ2 1ページずつLinkName+.jpgでJPRG書き出しをする ループ2終わり
ということで、二つのループが独立して行なわれるだけになってますね。 LinkNameをリストで取得したとしても、idLinkがページ順になっている わけではない(ID順に並ぶ)ので、きちんとページ単位で処理するように しないとまずいです。
ループ ページnのリンク画像ファイル名LinkNameを取得 1ページずつLinkName+.jpgでJPRG書き出しをする n++ ループ終わり
おっと、こんなことしてる間に、せうぞーさんが、実物を書いちゃいました(^^
|
No.593 2008/01/25(Fri) 19:21:14
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
|
|
Re: Jpeg書き出しスクリプトについて / なら |
|
|
|
せうぞー様 匿名A様
ありがとうございます。早速、試してみます。 ループ処理がまずいわけですね。 これからはもっと勉強します。
|
No.606 2008/01/28(Mon) 09:35:16
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
|
|
Re: Jpeg書き出しスクリプトについて / なら |
|
|
|
せうぞー様 匿名A様
コメントを参考にスクリプトの修正をしたら、期待通りの動きをしてくれました。 ありがとうございました。
|
No.608 2008/01/28(Mon) 11:13:01
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; ja-JP-mac; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
|
|