AppleScript NSWorkspaceDidLaunchApplicationNotification不会获取事件

时间:2017-03-22 19:22:36

标签: applescript nsnotificationcenter

我是applecript的新手,这个简单的AppleScript必须等到任何应用程序午餐然后显示测试通知,但什么都没发生!

任何解决方案? 感谢

script Autopilot
property NSWorkspace : class "NSWorkspace"

on run
    tell (NSWorkspace's sharedWorkspace())'s notificationCenter() to ¬
        addObserver:me selector:"notificationDelegate:" |name|:"NSWorkspaceDidLaunchApplicationNotification" object:(missing value)
end run

on notificationDelegate:sender
    display notification "notify"
end notificationDelegate:
end script

1 个答案:

答案 0 :(得分:0)

试试这个

property NSWorkspace : class "NSWorkspace" of current application