我遇到了AppleScript和OSX 10.9.1的神秘错误。
此代码在AppleScript编辑器中有效,但当我将其保存为应用程序时,“放弃后”不起作用。它可以在我的另一台计算机上使用10.6.8(Snow Leopard)。有谁知道这是什么问题?谢谢!
global fullTime
global chosenTime
set pickFromList to {1, 2}
choose from list the pickFromList with prompt "Next message will dissapear after 1 + x seconds. Choose x!"
set chosenTime to result as text
add1sec()
display dialog "Click OK and the next dialog box will appear in " & fullTime & " seconds"
delay fullTime
display dialog "Works! But now this should dissapear after " & fullTime & " seconds" giving up after fullTime
on add1sec()
set fullTime to chosenTime + 1
end add1sec
答案 0 :(得分:0)
我会这样写:
set pickFromList to {1, 2}
set chosenTime to (choose from list the pickFromList with prompt "Next message will dissapear after 1 + x seconds. Choose x!") as number
set fullTime to add1sec(chosenTime)
display dialog "Click OK and the next dialog box will appear in " & fullTime & " seconds"
delay fullTime
tell application "SystemUIServer" to display dialog "Works! But now this should dissapear after " & fullTime & " seconds" giving up after fullTime
on add1sec(startTime)
return startTime + 1
end add1sec
答案 1 :(得分:0)
tell application "SystemUIServer" to display dialog "Works! But now this should disappear after " & fullTime & " seconds" giving up after fullTime
首先,对话框不再“连接”到正在运行的应用程序,因此我无法通过单击Dock中的应用程序图标使其处于活动状态。其次,如果“放弃后”超过2分钟,则会发生默认超时。
答案 2 :(得分:0)
更新到OSX 10.9.2解决了这个问题。