(* vlc はどうやら、フルパスに日本語文字等を含む動画ファイルを開けられない。 そこで、再生対象ファイルのフルパスをすべて URI エスケープしたのち開かせてみよーかと。 動画の再生開始後しばらくしたら、フルパスの URI エスケープを元に戻せば OK かなとか。 つかいかた: このスクリプトを「アプリケーション」として保存して、vlc アプリ本体と同じフォルダに置く。 再生したいファイルを(ひとつだけ)そのアプレットにドロップ。 複数ドロップしても、再生されるのはそのうちの一つだけ。 他にひつようなもの: Perl モジュール URI::Escape (http://www.cpan.org/modules/by-module/URI/URI-1.19.tar.gz) URI::Escape をインストールするための Developer Tools とインスト方法の知識 。(うへぇ URI Escape をカンタンに行う OSAX があればいいのにな。 OSX ネイティブの。 *) on open theFiles --- vlc アプリ本体の位置を取得( UNIX 形式フルパス) tell application "Finder" set vlcApp to ((container of (path to me)) as string) & "vlc.app" open file vlcApp end tell set vlcApp to POSIX path of vlcApp --- ドロップされたひとつめのファイルを取得 set targetFile to item 1 of theFiles --- 再生対象ファイルのフルパスを URI エスケープ set pathList to {targetFile} splitPath(targetFile, pathList) escapePath(pathList, "escape") --- ファイルを vlc で開く。 vlc は AppleScript 未対応ゆえ UNIX こまんどにて。 do shell script "open -a \"" & vlcApp & "\" \"" & (POSIX path of targetFile) & "\"" --- しばし処理を待つ(開いてすぐファイル名を元に戻すとうまく再生できない。) delay 1 --- (秒) うまくいかない場合は待つ秒数を伸ばす。 --- 再生対象ファイルのフルパスの URI エスケープを元に戻す set pathList to {targetFile} splitPath(targetFile, pathList) escapePath(pathList, "unescape") end open --- theFile までのパスをひとつづつ昇っていって、その各階層のフルパスを theList に格納 on splitPath(theFile, theList) tell application "Finder" try set theParent to (container of theFile) as alias set end of theList to theParent my splitPath(theParent, theList) end try end tell end splitPath --- theList に格納されている各ファイルフォルダの名前を URI エスケープ / 元に戻す on escapePath(theList, method) set theCmd to "uri_unescape" if method is "escape" then set theCmd to "uri_escape" tell application "Finder" repeat with curItem in theList set fileName to name of (curItem as alias) set newName to do shell script "perl -MURI::Escape -e 'print " & theCmd & "(\"" & fileName & "\")'" if fileName is not newName then set name of curItem to the newName end repeat end tell end escapePath