Applescript &引用;“之后放弃”;命令在Mavericks中不能完全工作
我在AppleScript和OSX 10.9.1中遇到了一个神秘的错误 这段代码在AppleScript编辑器中工作,但当我将其保存为应用程序时,“放弃后”不起作用。不过,它在我的另一台10.6.8(雪豹)电脑上也能工作。有人知道问题出在哪里吗?谢谢Applescript &引用;“之后放弃”;命令在Mavericks中不能完全工作,applescript,osx-mavericks,Applescript,Osx Mavericks,我在AppleScript和OSX 10.9.1中遇到了一个神秘的错误 这段代码在AppleScript编辑器中工作,但当我将其保存为应用程序时,“放弃后”不起作用。不过,它在我的另一台10.6.8(雪豹)电脑上也能工作。有人知道问题出在哪里吗?谢谢 global fullTime global chosenTime set pickFromList to {1, 2} choose from list the pickFromList with prompt "Next message wil
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
我会这样写:
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
嗯,这确实解决了“放弃后”的问题,但也产生了另一个问题。现在已经使用了:
tell application "SystemUIServer" to display dialog "Works! But now this should disappear after " & fullTime & " seconds" giving up after fullTime
首先,对话框不再“连接”到正在运行的应用程序,因此我无法通过单击dock中的应用程序图标将其激活。其次,如果“放弃后”超过2分钟,则会出现默认超时。更新到OSX 10.9.2解决了此问题。谢谢,这实际上让我了解了处理程序的正确使用,但不幸的是,它不会改变行为。当我将其作为应用程序运行时,最后一个对话框不会消失。