防止对话框阻止用户注销?

我们有一个简单的.app用applescript编辑器制作,当用户登录时会弹出一个显示对话框。问题是许多用户忽略了这个框而没有按“确定”关闭它。如果它处于打开状态,它将阻止用户注销计算机。 有没有办法阻止对话框阻止注销过程?     
已邀请:
我能想到的两件事:1)你可以在对话框上放一个“放弃后”命令,这样它会在一段时间后自动解除,例如5秒......
display dialog "Hello" giving up after 5
或者您可以自己编写一个注销脚本。用户注销时将运行此脚本。像这样的东西会起作用。
tell application "System Events"
    if exists process "ApplicationName" then
        set itExists to true
    else
        set itExists to false
    end if
end tell

if itExists then
    tell application "ApplicationName" to activate
    tell application "System Events" to keystroke return
end if
谷歌为“注销挂钩”找到如何在注销时运行脚本。     
我是否可以问,为什么你不只是修改AppleScript代码以自动关闭对话框,比方说,5分钟?这肯定比“黑客”硬注销到系统更容易。
display dialog "Hello World" buttons "Ok" giving up after (5 * 60)
例如,此对话框将在5分钟后自动关闭。足够长的时间让用户阅读它,如果他们真的关心它而其他人无视它,正如你在问题中指出的那样。     
不幸的是,显示对话框总是需要用户采取行动才能离开,除非你通过“放弃后”自己消失,而不必阅读它。 假设您需要它们来阅读它,并且如果您可以控制它将要打开的计算机,您可以使用Growl来显示您的通知。 我发现你可以把显示对话框放在一个空闲的处理程序中,如果他们实际点击“确定”,则让脚本退出;如果他们没有单击“确定”,请按照其他答案中的描述使用“放弃后”,使其在您想要的许多秒后消失,然后在下一次空闲时再次弹回。这可能非常烦人,如果在对话框启动时碰巧注销,仍然存在阻止注销的风险。
on idle
    --display the alert for 7 seconds
    display alert "Very Important Message" giving up after 7
    if the button returned of the result is "ok" then
        quit
    end if

    --idle for 90 seconds
    return 90
end idle
    
这项工作对我来说,强制用户注销。在Mac OS X中完全禁用“重新登录时重新打开Windows”并注销确认
tell application "System Events"
    keystroke "Q" using {command down, option down, shift down}
    quit
end tell
    

要回复问题请先登录注册