Skip to main content

Away and Back scripts

01/03/2007 - Adium, Colloquy, applescript, iChat
238
Away and Back scripts
I usually have Colloquy (IRC) and IM (Adium and/or iChat) running on my machine, and I've always wanted a convenient way to set me as away and back on all at once. This is a script that when run, asks for the reason why I'm away and then sets Adium, iChat and Colloquy away with that reason, if they're running.
tell application "System Events" set aApps to name of every application process end tell tell application "Finder" activate set utter to display dialog "Away reason" default answer "Gör något annat" set theText to text returned of utter end tell if "Adium" is in aApps then tell application "Adium" set my status type to away set my status message to theText end tell end if if "iChat" is in aApps then tell application "iChat" set status to away set status message to theText end tell end if if "Colloquy" is in aApps then tell application "Colloquy" set aC to every connection repeat with c in aC set aR to (every chat room of c) repeat with r in aR send message "is away: " & theText to r with action tense set away message of c to theText end repeat end repeat end tell end if
I use Finder for the display dialog part, since if I execute that within the "System Events" part, the dialog is unfocused. I obviously use QuickSilver to launch the script. cmd-space and then just "AW" which expands to Away. The script is saved as a script in my home Application folder, which QuickSilver is set to index.
And to set me back when I return, I run this script:
tell application "System Events" set aApps to name of every application process end tell if "Adium" is in aApps then tell application "Adium" set my status type to available set my status message to "" end tell end if if "iChat" is in aApps then tell application "iChat" set status to available set status message to "" end tell end if if "Colloquy" is in aApps then tell application "Colloquy" set aC to every connection repeat with c in aC set aR to (every chat room of c) repeat with r in aR send message "is back" to r with action tense set away message of c to "" end repeat end repeat end tell end if
Which pretty much does the same thing as the first, only the other way around. This one doesn't ask for a reason, though.
You are free to use the images in this blog as icons for the scripts (looks nicer in QuickSilver). Just click on each, which will magnify it in a new window, right-click on that and choose "copy image", and then paste it on the icon in the "get info" panel on each script.