on open dropitems tell application "QuickTime Player" activate close every movie saving ask set exportSettingsFile to choose file with prompt "QT Export Settings File" set destinationDir to choose folder with prompt "Destination Folder" repeat with inputFile in dropitems set outputFileUtxt to (destinationDir as Unicode text) & my getBasename(inputFile) & ".mov" (* 上の拡張子 ".mov" は書き出すフォーマットに応じて書き換えること。*) (* 続く *)
try open inputFile with timeout of (timeoutHours * hours) seconds export movie 1 to file outputFileUtxt as QuickTime movie using settings exportSettingsFile (* 上の as QuickTime movie も書き出すフォーマットに応じて書き換える。 例:as MPEG4, as AIFF, as wave, ..., etc.『用語説明』の「export」を参照。*) end timeout close movie 1 saving no on error errMsg number errNum activate beep display dialog errMsg & " (" & errNum & ")" try close movie 1 saving no end try end try end repeat end tell say "finished" end open (* 続く *)
-- ファイル名から拡張子を取り除くサブルーチン on getBasename(theFile) tell application "Finder" to set thisName to name of theFile set thisList to string2list(thisName, ".") if (count of thisList) > 1 then return list2string(items 1 thru -2 of thisList, ".") as Unicode text else return thisName end if end getBasename
-- 文字列をリストに変換するサブルーチン on string2list(theString, theDelim) set lastDelim to AppleScript's text item delimiters set AppleScript's text item delimiters to theDelim set theList to every text item of theString set AppleScript's text item delimiters to lastDelim return theList end string2list (* 続く *)
-- リストを文字列に変換するサブルーチン on list2string(theList, theDelim) set lastDelim to AppleScript's text item delimiters set AppleScript's text item delimiters to theDelim set theString to theList as string set AppleScript's text item delimiters to lastDelim return theString end list2string
(* エスケープ文字の入力が問題なければ、下の方が簡単。 on getBasename(theFile) return do shell script "x=\"$(basename " & quoted form of POSIX path of theFile & ")\"; echo \"${x%.*}\"" end getBasename *)
tell application "QuickTime Player" activate if not (exists movie 1) then error "No movie is open." stop every movie set exportSettingsFile to choose file name with prompt "QT Export Settings File - MOV" save export settings movie 1 for QuickTime movie to exportSettingsFile (* 上の for QuickTime movie は書き出すフォーマットに応じて書き換える。 例:for MPEG4, for AIFF, for wave, ..., etc.『用語説明』の「save export settings」を参照。*) say "finished" end tell