-- use QuickTime to convert to various formats without having Pro
set {targetFormatList, targetSufixList} to {{"AIFF", "AVI", "BMP", "DV stream", "Fast Start QTVR Movie", "FLC", "hinted movie", "image sequence", "interframe compressed VR object movie", "iTunes", "MuLaw", "MPEG2", "MPEG4", "picture", "QuickTime media link", "QuickTime movie", "QuickTime TeXML", "standard MIDI", "System 7 sound", "text file", "ThreeGPP", "wave"}, {".aif", ".avi", ".BMP", ".dv", "", ".flc", ".mov", "", "", ".m4v", "", ".mp2", ".mp4", ".pct", ".qtl", ".mov", ".xml", ".mid", "", ".txt", ".3gp", ".wav"}}
set {aFile, deskPath, myTargetFormat, overwrite} to {choose file, path to desktop as Unicode text, choose from list targetFormatList, false}
if false is not myTargetFormat then
set myTargetFormat to myTargetFormat's first item
repeat with formatIndex from 1 to count targetFormatList
if myTargetFormat = targetFormatList's item formatIndex then exit repeat
end repeat
tell application "Finder" to set {prefix, sufix} to {name, name extension} of aFile
set theNewName to (text 1 through -((count sufix) + 2) of prefix) & targetSufixList's item formatIndex
set theNewPathName to deskPath & theNewName
set theNewPathName to (choose file name with prompt "Please enter new name for exported file" default name theNewName default location path to desktop) as Unicode text
set overwrite to true
try
tell application "QuickTime Player"
open aFile
tell front movie
if (run script "tell application \"QuickTime Player\"
tell front movie to can export as " & myTargetFormat & "
end tell") then
export to theNewPathName as myTargetFormat replacing overwrite
else
display dialog "Can't export to that format: " & myTargetFormat buttons {"OK"} default button 1 giving up after 11
end if
close saving no
end tell
end tell
on error eMsg number eNum
if -48 = eNum then
display dialog eMsg & " 00ps, I don't want to / " & eNum giving up after 12
else
display dialog eMsg & " / " & eNum giving up after 12
end if
end try
end if
I’m looking for a way to build the list of available formats (targetFormatList) dynamicaly.