到目前为止,我的脚本如下:
property timeDelay : 5
on appOpen(appName)
tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
return appNameIsRunning
end appOpen
if appOpen("iChat") then
tell application "iChat"
repeat with theService in services
if connection status of theService = disconnected or connection status of theService = disconnecting then
log in of service (name of theService)
end if
end repeat
end tell
end if基本上,它只检查一次您的iChat/Messages帐户是否已注销。如果是,请将其登录。它起作用了。
然而,我希望这是一个‘保持开放’的应用程序。在过去,我使用了这个模式
on idle
-- do stuff
end idle..but由于某种原因,当我试图编译时,它出错了。

你知道为什么会发生这种事吗?
编辑:
好的--仍然不确定为什么会发生这种情况,但我能够通过简单地创建一个新脚本来解决这个问题。我不知道为什么会出现这个错误,但它现在看起来很好。谢谢你们的帮助。
发布于 2012-09-19 03:03:35
这没道理..。
tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)你想要这个..。
tell application "System Events" to set appNameIsRunning to exists process appName原因是“名称为appName的进程”将返回一个列表(无论它有一个项目还是多个项目,它仍然是一个列表),并且检查列表的"exists“是没有意义的。
我不确定这个错误,但我希望它能解决你的问题。
https://stackoverflow.com/questions/12482883
复制相似问题