Applescript每5秒运行一次脚本

Applescript每5秒运行一次脚本,applescript,Applescript,我正在尝试将以下代码作为协同程序运行。有没有办法做到这一点 重复 延迟5 记录脚本 结束重复使用空闲时的处理程序并将脚本另存为应用程序 on idle log theScript return 5 end idle 在Apple SpRepButjc应用程序中,您不能使用空闲>代码>处理程序,一个备选方案是“基础框架”的代码> NSTIMER < /代码>。 property timer : missing value on applicationWillFinishLaun

我正在尝试将以下代码作为协同程序运行。有没有办法做到这一点

重复
延迟5
记录脚本

结束重复

使用空闲时的
处理程序
并将脚本另存为应用程序

on idle
    log theScript
    return 5
end idle
在Apple SpRepButjc应用程序中,您不能使用<代码>空闲>代码>处理程序,一个备选方案是“基础框架”的代码> NSTIMER < /代码>。
property timer : missing value

on applicationWillFinishLaunching:aNotification
    set timer to current application's NSTimer's scheduledTimerWithTimeInterval:5.0  target:me selector:"timerFired:" userInfo:(missing value)  repeats:true
end applicationWillFinishLaunching_

on timerFired:aTimer
    log "timerFired"
end timerFired

我试着把它直接放到我的应用程序中,但它不起作用
on idle display通知“worked”返回5 end idle
它应该在任何保存为应用程序的脚本中工作。我只是将它放入xcode中的应用程序代理脚本中并运行了它。您应该提到的是AppleScriptObjC类,而不是脚本。在这种情况下,
idle
处理程序不工作。您需要使用基础<代码> NSTIMER 。其他操作在运行时可以运行吗?