我有一个脚本,而不是登录,询问用户是否想看电影。在大多数情况下,它工作得很好。但是,有时出于我未知的原因,我会收到 AppleEvent 处理程序失败错误。我已经阅读了有关此错误的其他帖子,但它们似乎都是独一无二的。所以,如果可能的话,有人可以看看我的脚本,告诉我为什么偶尔会出现这种情况,如果我能做些什么来阻止它?
可能有助于了解的一件事是,当发生此错误时,脚本中失败的一件事是电影无法播放。它会在 quicktime 中打开,但不会启动。
在此先感谢,这是脚本。
tell application "Welcome" to activate
set question to display dialog "Would you like a welcome video?" buttons {"No, I've seen it", "Yes, please"} default button 2
set answer to button returned of question
if answer is equal to "Yes, please" then tell application "QuickTime Player"
set theMovie to "Macintosh HD:Library:Desktop Pictures:Mac ML Opening Chalkbaord Video.mov"
set openMovie to open theMovie
present openMovie
play openMovie
delay 30
quit
end tell
if answer is equal to "No, I've seen it" then tell application "Welcome"
quit
tell application "System Events"
delete login item "Welcome"
end tell
end tell