Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set iChat status based on iCal event alarms Apps
I wrote a small script that, using iCalBuddy, will set your iChat status based on the name of whichever iCal event calls the script as an alarm. Here's how it works.

First, save this as a script in AppleScript Editor. I have saved it as iCal Event to iChat:
set theEventName to (do shell script "/usr/local/bin/icalbuddy -ic \"Some\ Calendar\" -eep \"*\" -nc -b \"\" -n -li 1 eventsToday")

if (theEventName is not "") then
  tell application "iChat"
    set status to away
    set status message to "I am attending " & theEventName & "."
  end tell
end if
Then, in iCal, and create a new event (Planning Meeting or whatever) on a calendar. Set the Alarm Type to run your new AppleScript (iCal Event to iChat), and set it to run one minute after the event starts. Then, one minute after the event starts, your iChat status will change to I am attending Planning Meeting. This will also work for repeating events, but it will use the first alphabetical event if more than one event occurs at one time.

The reason that the alarm should be set after the event begins is that the return value from iCalBuddy is the current or next event. Therefore, if two events are immediately sequential, a "before" alarm will set the iChat status as the title of the current event, not the event that is actually calling the script.

If You are using Chax and Snow Leopard, use this code:
set theEventName to (do shell script "/usr/local/bin/icalbuddy -ic \"Some\ Calendar\" -eep \"*\" -nc -b \"\" -n -li 1 eventsToday")

if (theEventName is not "") then
  tell application "Chax" to activate
  delay 2
  tell application "iChat"
    set status to away
    set status message to "I am attending " & theEventName & "."
  end tell
end if
[robg adds: I haven't tested this one.]
    •    
  • Currently 2.06 / 5
  You rated: 1 / 5 (18 votes cast)
 
[5,896 views]  

Set iChat status based on iCal event alarms | 2 comments | Create New Account
Click here to return to the 'Set iChat status based on iCal event alarms' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set iChat status based on iCal event alarms
Authored by: cwanja on Dec 02, '09 01:06:48PM

Any idea if this would work with Adium? Obviously, it would have to change from iChat to Adium, but does Adium handle the away status the same way.

---
 MacBook Pro 15" Aluminum Unibody 2.8
Chris Wanja
chris.wanja@mac.com



[ Reply to This | # ]
Set iChat status based on iCal event alarms
Authored by: Guliavan on Jun 20, '12 01:03:08PM

Thanks a lot for this hint. I modified the script a bit to be able to bundle the script and icalbuddy in the same folder w/o having to change the path all the time. Also, I had to set a delay between status and status message change or else the status message wasn't changing... I use on run and on idle events because I saved the script with option to run as background and check every 60 seconds.

--
property scriptPath : null

on run
set d to text item delimiters
set text item delimiters to "/"
set scriptPath to (POSIX path of (path to me))'s text 1 thru text item -3 & "/"
set text item delimiters to d
end run

on idle
set currentPath to (path to me)
set theEventName to (do shell script scriptPath & "/icalBuddy -ic \"My Calendar\" -eep \"*\" -nc -b \"\" -n -li 1 eventsToday")

if (theEventName is not "") then
tell application "iChat"
set status message to "I'm attending " & theEventName & " and I like it."
delay 2
set status to away
end tell
else
tell application "iChat"
set status message to "I'm available"
delay 2
set status to available
end tell
end if

return 60
end idle



[ Reply to This | # ]