Skip to content

Switch Adium Profiles

zacechola edited this page Apr 6, 2012 · 2 revisions

This script demonstrates how to start an application with a modifier key held down, in this case the option key. You can add any combinations of keys by adding key down statements (do not forget to add key up statements too of course).

In the case of the application Adium, it’ll show a chooser window that lets the user pick a profile to start the app with.

    tell application "System Events"
    	tell process "Adium"
    		key down option
    	end tell
    end tell
    
    tell application "Adium" to activate
    
    tell application "System Events"
    	tell process "Adium"
    		key up option
    	end tell
    end tell

Alternatively, set “profiles” in an Applescript and allow your contexts to determine whether you are logged in or out of accounts.

tell application "ControlPlane"
	if current context is "Work" or current context is "Work/Mouse in" then
		tell application "Adium" to tell the account "myjid@work.com" to go online
		tell application "Adium" to tell the account "myjid@gmail.com" to set the status message to "I am at work."
		tell application "Adium" to set the status type of the account "myjid@gmail.com" to invisible -- or away works, too
		tell application "Adium" to tell every account of service "IRC" to go online
	else if current context is "Home" then
		tell application "Adium" to tell the account "myjid@work.com" to go offline
		tell application "Adium" to tell every account of service "IRC" to go offline
		tell application "Adium" to tell the account "myjid@gmail.com" to go online
	else if current context is "Quiet" then
		tell application "Adium" to tell every account to go offline
	else
		tell application "Adium" to tell the account "myjid@gmail.com" to go online
	end if
end tell

There is tons of options and documentation for Applescripting Adium at the Adium website.