Skip to content

Instantly share code, notes, and snippets.

@carlosefonseca
Created September 26, 2012 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosefonseca/3790415 to your computer and use it in GitHub Desktop.
Save carlosefonseca/3790415 to your computer and use it in GitHub Desktop.
Connects/Disconnects a certain IM account (like for work) on both Adium and Messages. A context-aware app runs the scripts automatically when I arrive at home/work
tell application "System Events"
if (name of processes) contains "Adium" then
tell application "Adium"
set acc to (some account whose name is "#####")
tell acc
set enabled to true
go online
end tell
end tell
end if
if (name of processes) contains "Messages" then
tell application "Messages"
log in (first service whose name is "#####")
end tell
end if
end tell
tell application "System Events"
if (name of processes) contains "Adium" then
tell application "Adium"
set acc to (some account whose name is "#####")
tell acc
go offline
end tell
end tell
end if
if (name of processes) contains "Messages" then
tell application "Messages"
log out (first service whose name is "#####")
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment