Page 1 of 1

Applescript: how to change active chat?

Posted: Fri Oct 02, 2009 1:31 pm
by aristide
I'm writing some little scripts to allow disabled people to command Adium from within my own application.
It's quite easy to send a message to the frontmost chat:

Code: Select all

on run argv
	tell application "Adium" to send active chat message argv
end run
But, how to make active another chat? Is it even possible?
The application's property active chat is read-only, and making a new chat doesn't switch to it if it already exists.
Thanks!

Re: Applescript: how to change active chat?

Posted: Wed Jan 06, 2010 10:05 pm
by silkcom
Is this a difficult thing to do? or is no one looking? :) I'm also wondering this, i've tried this code, but it's not working:

set allchats to every chat
set found to false
repeat with onechat in allchats
if (id of contact of onechat as string) is (id of contact "contact@gmail.com" as string) then
tell chat window of onechat to activate onechat
activate chat window of onechat
display dialog "Tried to activate the window"
set found to true
end if
end repeat

The dialog displays, but for some reason the chat window isn't the one that's active. I'm trying to both get the window that has the contact to be active and also to get the contact to be the active chat of the window.