Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created January 3, 2011 12:55
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save lantrix/763430 to your computer and use it in GitHub Desktop.
Save lantrix/763430 to your computer and use it in GitHub Desktop.
Applescript to tell Adium, Skype and iChat to change their status simultaneously
-- IMStatus
-- version 2.0, Lantrix (http://techdebug.com)
-- idea conceived from script by Jason Kenison "theWebGuy" Blog at:
-- http://www.jasonkenison.com/blog.html?id=22
(*
Copyright (c) 2008, TechDebug.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
-- Display Dialog
set imState to {"Available", "Away", "Meeting", "Do not Disturb"}
choose from list imState with prompt "Choose the Status..." default items "Available" OK button name "Set" cancel button name "Cancel"
set imState to result as string
--Check App Status, to only act on apps if running
tell application "System Events" to set AdiumIsRunning to (count of (every process whose name is "Adium")) > 0
tell application "System Events" to set iChatIsRunning to (count of (every process whose name is "iChat")) > 0
tell application "System Events" to set SkypeIsRunning to (count of (every process whose name is "Skype")) > 0
if imState is "Do not Disturb" then
-- DND
-- Adium (works with 1.2+ as per http://trac.adiumx.com/wiki/AppleScript_Support_1.2 documentation)
if AdiumIsRunning then
tell application "Adium" to go away with message "Do Not Disturb"
end if
-- iChat
if iChatIsRunning then
tell application "iChat"
set status to away
set status message to "Do Not Disturb"
end tell
end if
-- Skype
if SkypeIsRunning then
tell application "Skype"
send command "SET USERSTATUS DND" script name "IMStatus"
send command "SET PROFILE MOOD_TEXT Do Not Disturb - Can't take your call - Maybe Chat?" script name "IMStatus"
end tell
end if
else if imState is "Meeting" then
-- Meeting
-- Adium (works with 1.2+ as per http://trac.adiumx.com/wiki/AppleScript_Support_1.2 documentation)
if AdiumIsRunning then
tell application "Adium" to go away with message "In Meeting"
end if
-- iChat
if iChatIsRunning then
tell application "iChat"
set status to away
set status message to "In Meeting"
end tell
end if
-- Skype
if SkypeIsRunning then
tell application "Skype"
send command "SET USERSTATUS DND" script name "IMStatus"
send command "SET PROFILE MOOD_TEXT In Meeting" script name "IMStatus"
end tell
end if
else if imState is "Away" then
-- Away
-- Adium (works with 1.2+ as per http://trac.adiumx.com/wiki/AppleScript_Support_1.2 documentation)
if AdiumIsRunning then
tell application "Adium" to go away
end if
-- iChat
if iChatIsRunning then
tell application "iChat"
set status to away
end tell
end if
-- Skype
if SkypeIsRunning then
tell application "Skype"
send command "SET USERSTATUS AWAY" script name "My Script"
end tell
end if
else if imState is "Available" then
-- Available
-- Adium (works with 1.2+ as per http://trac.adiumx.com/wiki/AppleScript_Support_1.2 documentation)
if AdiumIsRunning then
tell application "Adium" to go available
end if
-- iChat
if iChatIsRunning then
tell application "iChat"
set status to available
set status message to ""
end tell
end if
-- Skype
if SkypeIsRunning then
tell application "Skype"
send command "SET USERSTATUS ONLINE" script name "My Script"
send command "SET PROFILE MOOD_TEXT" script name "IMStatus"
end tell
end if
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment