我正试着全屏播放一部电影,然后可编程地关闭播放器。我尝试过使用QTMovieView、命令行和AppleScript,发现Applescript是最简单的方法。
但是,因为我真的不知道Applescript,所以我不能让QuickTime在电影播放后自动关闭。
一切正常,但重复行中的"done“未被识别。以下是包含此错误的脚本:
错误"QuickTime Player出现错误:无法将文档%1转换为类型说明符。“编号-1700,从文档1的done到说明符
tell application "QuickTime Player"
activate
open "/Users/...real path of the movie.mov"
present document 1
play document 1
repeat until (get done of document 1)
end repeat
delay 2
close document 1
end tell最后,我改成这样,这样可以吗?
tell application "QuickTime Player"
quit
end tell
tell application "QuickTime Player"
activate
open "/Users/.../...mov"
tell document 1
present
play
repeat until playing is false
end repeat
delay 2
close
end tell
quit
end tell 新问题:应用程序在视频结束前挂起。
发布于 2012-05-24 06:51:47
这对我来说很有效,但是它看起来不是很健壮。既然current time和duration都是真实的,那么是否可以保证它们最终总是相等的呢?您可能希望在repeat条件中加入一些“在epsilon内”的逻辑。
tell application "QuickTime Player"
play document 1
repeat until (current time of document 1 = duration of document 1)
end repeat
delay 2
close document 1
end tell发布于 2012-05-24 09:33:05
尝试:
tell application "QuickTime Player"
tell document 1
present
play
repeat until playing is false
delay 1
end repeat
end tell
quit
end tellhttps://stackoverflow.com/questions/10728854
复制相似问题