大阪DTPの勉強会
大阪DTPの勉強会に参加してきました…!
今回の勉強会「Scriptをテーマにしたディスカッション」で、たけうちさん、せうぞーさん、そしてなぜか私の3人でScriptに関するいろいろをディスカッションしてみましょうという企画。
ディスカッションしましょうといわれても、このお二人を相手に私が何を話せるというのだ。
事前にメールで「何を話すか」について、打ち合わせなどをしたのですが、正直私では大した話題も提供できそうになかったので「それでは私は初心者向けの部分担当ということで」と「初心者さんでもわかるような簡単なScriptを一つ書いて、それをお二人に解説してもらう」という企画に。
あらかじめ書いたScriptをお二人に見せて「こんなのでやりますよ」とメールした時はお二人とも「いいんじゃないですか」「それほど、つっこむとこないですよ」みたいな反応だったので、これでいいやーと気楽にしていたのですが…。
甘かった……!!!!
もう、もう、めっっっっっちゃつっこまれたよ!本番でめった打ちだよ!!!!!!サンドバッグだよ!!
ディスカッションが始まって、横にならんだせうぞーさんのディスプレイが目に入ったときは、目が点になりました。すごい突っ込み添削用意してんの…(泣)
自他ともに認めるどエスの私をここまでいじめるなんて…!!!!
ぼろぼろになった1時間でした。終わったら灰になってた。燃え尽きちまったよ。真っ白にな!
ちなみに当日、ディスカッション前にも打ち合わせして色々面白い話もでてたのですが、その話はディスカッション内では全然話さなかった(笑)何のためのうち合わせだったのか(笑)
と、いうわけで当日ぼろくそに突っ込まれたScriptを公開します。
ここまでくるといじめられるのも快感になってきました。新たな世界が開けそうです(笑)
--シンプルな流し込みスクリプトのデモ --2010/9/25用 on open Drop_Files tell application "Finder" set Application_Path to (path to me) --スクリプトのパス --set Application_Path to (choose file with prompt "スクリプトを指定") --スクリプトのパス デバッグ用--ドロップレット時はオフ set Application_Folder to container of Application_Path --スクリプトのあるフォルダーのパス set Application_Path to Application_Path as Unicode text set Application_Folder to Application_Folder as Unicode text set Daishi_File to Application_Folder & "台紙.indd" --InDesignの台紙ファイルを設定 set Picture_File_Folder to choose folder with prompt "画像ファイルの入ったフォルダを選択してください" set Picture_File_Folder to Picture_File_Folder as Unicode text set Save_Folder to choose folder with prompt "ドキュメントの保存先を選択してください" set Save_Folder to Save_Folder as Unicode text end tell (*--デバッグ用--ドロップレット時はオフ tell application "Finder" activate set Drop_Files to (choose file with prompt "テキストファイルを選択してください") as list ---テスト用テキストファイルを指定 end tell *) activate repeat with Drop_File in Drop_Files --ドロップされたファイルに繰り返し set Open_Txt_File to open for access Drop_File --ファイルにアクセス set Read_Txt to read Open_Txt_File --ファイルを読み込む close access Open_Txt_File --ファイルをクローズ --テキストからリストを作成 set DLMT to AppleScript's text item delimiters --現在のデリミタを保存する set AppleScript's text item delimiters to {return} --デリミタを改行に set Documenttext_List to (every text item of Read_Txt) --テキストからリストを作る repeat with Documenttext in Documenttext_List set Documenttext to Documenttext as Unicode text set AppleScript's text item delimiters to {tab} --デリミタをタブに set Item_List to (every text item of Documenttext) --テキストからリストを作る --流しこみ項目とラベルのリストを作成 set Syohin_no to {(item 1 of Item_List), "商品番号"} set Syohin_Name to {(item 2 of Item_List), "商品名"} set Syohin_Kakaku to {(item 3 of Item_List), "価格"} set Syomi_Kigen to {(item 4 of Item_List), "賞味期限"} set Syohin_Naiyou to {(item 5 of Item_List), "商品内容"} set Syohin_Photo to {(item 1 of Item_List), "画像"} ---項目に対する処理 --価格に"円"をつける if (item 1 of Syohin_Kakaku) is not equal to "" then set (item 1 of Syohin_Kakaku) to ((item 1 of Syohin_Kakaku) & "円") end if --画像ファイルのパスを作成する if (item 1 of Syohin_Photo) is not equal to "" then tell application "Finder" set (item 1 of Syohin_Photo) to (Picture_File_Folder & (item 1 of Syohin_Photo) & ".eps") end tell end if --賞味期限に"賞味期限"を付ける if (item 1 of Syomi_Kigen) is not equal to "" then set (item 1 of Syomi_Kigen) to ("賞味期限:" & (item 1 of Syohin_Kakaku)) end if --マスターページの指定 set Master_page to 1 --ドキュメント保存先の指定 set Save_Path to (Save_Folder & (item 1 of Syohin_no) & ".indd") ---InDesignでの処理 tell application "Adobe InDesign CS4" activate --台紙ドキュメントを開く set InDes_Doc to open file Daishi_File --台紙ファイルを開く set InDes_Doc to (a reference to active document) tell InDes_Doc save InDes_Doc to Save_Path --ドキュメントを別名で保存 set applied master of page 1 to master spread Master_page --マスターページを適用する override master page items of page 1 destination page page 1 --masterページアイテムを上書きする--編集可能にする tell page 1 --テキストフレームと内容のリストに繰り返し処理 repeat with Flame_Txt in {Syohin_no, Syohin_Name, Syohin_Kakaku, Syomi_Kigen, Syohin_Naiyou} set Flame_Txt to Flame_Txt as list set Text_contents to item 1 of Flame_Txt as Unicode text set Frame_Name to item 2 of Flame_Txt as string --ラベルのついたテキストフレームを探す set Text_Frame_list to (every text frame whose label is equal to Frame_Name) set Text_Frame to item 1 of Text_Frame_list tell Text_Frame set contents to Text_contents --テキストフレームにテキストを入れる end tell end repeat --グラフィックフレームと画像ファイルパスのリストに繰り返し処理 repeat with Flame_Pict in {Syohin_Photo} set Flame_Pict to Flame_Pict as list set Frame_Name to item 2 of Flame_Pict as string set Pict_path to item 1 of Flame_Pict as Unicode text --ラベルのついたグラフィックフレームを探す set Pict_Frame_list to (every rectangle whose label is equal to Frame_Name) set Pict_Frame to item 1 of Pict_Frame_list tell Pict_Frame place Pict_path --グラフィックフレームに画像を入れる fit given proportionally --画像を短辺合わせでフレームにおさめる fit given center content --画像をセンターに end tell end repeat end tell save --保存 close --ドキュメントを閉じる end tell end tell end repeat set AppleScript's text item delimiters to {DLMT} --デリミタを元に戻す end repeat activate display dialog "終了しました" as Unicode text end open