我正在尝试将以下脚本与 QuickTime Player 7 v7.6.6 一起使用,将 AVI 容器文件批量转换为 MOV 容器文件:
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 Player 7 中打开的,这可以解释为什么错误消息指出 QTP7 无法获取文档 1。
有没有办法修复这个脚本,以便它在 QuickTime Player 7 中而不是 QuickTime Player X 中打开 AVI 电影?有没有办法通过命令行控制 QuickTime Player 7?
请注意,我不想使用像 ffmpegX(或类似的)这样的转码器,这会降低 AVI 的质量(并且还会增加文件大小)。我只想使用新的 MOV 容器自动重新保存 AVI,以便 iTunes 可以使用我已经安装的编解码器播放它。谢谢你的建议。