1

I had a script under Snow Leopard that would upload a tiny file to my server when I launched iChat to reflect my status on my website. For some reason it doesn't work anymore in Lion.

Is there a way to trigger a shell script on online/offline status change in 10.7 without even launching iChat?

  • Can you clarify what Lion's "on/offline status bubble" is? – Daniel Nov 3 '11 at 0:08
  • Where did you get this script? Did you make it yourself? – macaco Nov 3 '11 at 1:05
1

Option 1: run a script like this every minute or so with cron or launchd:

#!/bin/bash

cd=~/Library/Caches/me.lri.scripts
mkdir -p $cd
cf=$cd/ichatstatuscheck
status=$(osascript -e "tell app \"iChat\" to status")
[[ -f $cf && "$status" != $(cat $cf) ]] && say "$status"
echo "$status" > $cf

(The script activates iChat every time it's run.)


Option 2: save this as a stay open application in AppleScript Editor:

repeat
    tell application "iChat"
        set prev to status
        delay 5
        if status is not prev then do shell script "say " & quoted form of status
    end tell
end repeat

(Also activates iChat every time it gets the status.)


Option 3: use an iChat event handler (thanks Kopischke)

This worked for me on Lion, but only when iChat was active. (Not when it wasn't and I changed the status from iChat's status bar item — which I guess was the actual problem the OP had.)

  • All of these rely on actually launching iChat (via AppleScript, granted, but still) – which OP didn’t want to do. I think OP’s problem is that the status bar item for iChat (aka “iChat status bubble”) does not honor event handler settings – these seem to trigger only with iChat.app running. – kopischke Nov 3 '11 at 13:16
  • Also, the second option doesn’t need to be run as a stay open application – you can bind a script to the login / logout events (which correspond to online / offline status) right inside iChat preferences (see previously linked post). – kopischke Nov 3 '11 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .