0

これまでの私のスクリプトは次のとおりです。

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 アカウントのいずれかがログアウトされているかどうかを 1 回チェックします。そうであれば、ログインしてください。

ただし、これを「Stay Open」アプリにしたいと思います。過去に私はパターンを使用しました

on idle
    -- do stuff
end idle

..しかし、何らかの理由でコンパイルしようとするとエラーになります。

私が得ているエラー なぜこれが起こっているのでしょうか?

編集:

わかりました-なぜこれが発生したのかはまだわかりませんが、新しいスクリプトを作成するだけで問題を解決できました. このエラーが発生した理由はわかりませんが、今は問題ないようです。助けてくれてありがとう。

4

2 に答える 2

0

これは意味がありません...

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であるプロセス」はリストを返し(アイテムが1つでも多数でも、まだリストである)、リストの「存在」をチェックする意味がないためです。

エラーについてはよくわかりませんが、問題が解決することを願っています。

于 2012-09-18T19:03:34.993 に答える
0

これは10.6.8で機能します

property timeDelay : 5

on appOpen(appName)
    tell application "System Events" to set appNameIsRunning to exists process appName
    return appNameIsRunning
end appOpen

on idle
    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
                    tell service (name of theService) to log in
                end if
            end repeat
        end tell
    end if
    return timeDelay
end idle
于 2012-09-18T20:28:38.963 に答える