Largely inspired by Beau’s equivalent setup, I rolled out a small Applescript to set my miscellaneous IM/IRC/Skype statues as away or available in one click.
[sourcecode]
set myStatus to display dialog "Select your IM Status:" buttons {"Away", "Available"} default button 1
— Adium: Multiple IM and single IRC account statuses
if appIsRunning("Adium") then
tell application "Adium"
if the button returned of myStatus is "Away" then
send the first chat of the first chat window message "/nick stephdau|away"
go away
else
send the first chat of the first chat window message "/nick stephdau"
go available
end if
end tell
end if
— Skype status
if appIsRunning("Skype") then
tell application "Skype"
if the button returned of myStatus is "Away" then
send command "SET USERSTATUS AWAY" script name "My Script"
else
send command "SET USERSTATUS ONLINE" script name "My Script"
end if
end tell
end if
— iTunes
if appIsRunning("iTunes") then
tell application "iTunes"
if the button returned of myStatus is "Away" then
pause
else
play
end if
end tell
end if
— Helper
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
[/sourcecode]
Note on Adium handling: because of my account order and the fact that I connect to IRC via ZNC, the first chat of the first chat window is always an IRC room in my context.
I haven’t yet, but I could adapt this script to also take parameters to get the button status equivalent, then couple it with SleepWatcher or ScriptSaver to have the script triggered on sleep/wake on my MacBook Pro or when the screensaver activates/deactivates on my iMac.
Leave a Reply