在AppleScript中关闭窗口后退出应用程序

Wil*_*lin 3 xcode applescript

我在Xcode中创建了一个AppleScript应用程序,我想知道如何在窗口关闭后让应用程序退出.

小智 7

在AppDelegate中添加applicationShouldTerminateAfterLastWindowClosed:方法,例如:

on applicationShouldTerminateAfterLastWindowClosed_(sender)
    return true
end applicationShouldTerminateAfterLastWindowClosed_
Run Code Online (Sandbox Code Playgroud)