我试图使用使用QuickTime Player 7 v7.6.6下面的脚本AVI容器文件批量转换为MOV容器文件:如何让AppleScript使用正确版本的QuickTime Player打开电影?
tell application "Finder"
try
set myFolder to (the folder of the front window) as alias
on error
beep
end try
-- get list of .avi files
set aviFiles to files of myFolder whose name contains ".avi"
end tell
tell application "QuickTime Player 7" to activate
repeat with aviFile in aviFiles
set aviName to name of aviFile as text
set dispName to (text 1 thru ((length of aviName) - 4)) of aviName
set movName to dispName & ".mov"
set movPath to (POSIX path of myFolder & movName)
tell application "QuickTime Player 7"
open aviFile
save front document in movPath
close front document
end tell
end repeat
当我选择在Finder中的文件夹,然后运行该脚本,我收到以下错误:
QuickTime Player 7 got an error: Can’t get document 1. Invalid index.
当我运行脚本时,QuickTime Player X和QuickTime Player 7都被激活(打开)。
它看起来像电影文件aviFile
实际上在QuickTime Player X,不是QuickTime播放器7,打开这可以解释为什么该错误消息指出,QTP7不能得到文件1.
有没有一种办法修复此脚本,以便在QuickTime Player 7中打开AVI电影,而不是QuickTime Player X?有没有办法通过命令行来控制QuickTime Player 7?
请注意,我不想使用像ffmpegX(或类似的)这样的代码转换器,它会降低AVI的质量(并且还会扩大文件大小)。我只想用一个新的MOV容器自动保存AVI,以便iTunes可以使用我已安装的编解码器播放它。谢谢你的建议。