Bring adium to front

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
Tiburon
Harmless
Posts: 7
Joined: Thu Feb 14, 2008 6:01 pm

Bring adium to front

Post by Tiburon »

We want to use Adium merely for internal messaging not for chatting (to replace Quickconference, which is not supporting Leopard)

How can I make Adium to come to the front when a message came in?
mtimmsj
Frappa
Posts: 144
Joined: Wed Jun 08, 2005 6:55 pm
Location: Olympia, WA

Post by mtimmsj »

You can open Adium preferences and click on the Events tab. You can add an applescript to the list of actions for the message received events. Just create an applescript that does the following and add it as an action:

Code: Select all

tell application "Adium" to activate
I would recommend against doing this though because it will annoy the hell out of the person using the computer. Every time a message comes in the work they are doing will be interrupted. It's probably far better to simply produce growl messages that are sticky.
Tiburon
Harmless
Posts: 7
Joined: Thu Feb 14, 2008 6:01 pm

Post by Tiburon »

Thanks for your hint and your recommendation. in our case its not so critical. We would use Adium as said as internal messenger, and there are not so many to become annoying. But the idea with the sticky growl is interesting as well. How can this be done?


Thanks

Urs

PS: Any hints how to stop the status messages of a contact to avoid cluttering the window? I simply want messages, nothing else
mtimmsj
Frappa
Posts: 144
Joined: Wed Jun 08, 2005 6:55 pm
Location: Olympia, WA

Post by mtimmsj »

To produce a sticky growl notification you can go to the same area of the adium preferences for events and instead of adding an AppleScript you would simply make sure an action for Display a Growl notification is in there. If one exists already you can click on the edit button to make it sticky or if you need to add one, you can simply make sure the check box for the sticky option is set when you add the action.

I haven't found a way to disable the contact status info messages from showing up in the chat window.
Tiburon
Harmless
Posts: 7
Joined: Thu Feb 14, 2008 6:01 pm

New: Option to turn off status info! Was: bring adium to fro

Post by Tiburon »

Thanks for continued help.
mtimmsj wrote: I haven't found a way to disable the contact status info messages from showing up in the chat window.
I guess this is one of the most annoying feature of Adium. An option with turns this cluttering off will be the most appreciated update of this programm!
Kentor
Harmless
Posts: 1
Joined: Sun Sep 07, 2008 8:49 pm

Re: Bring adium to front

Post by Kentor »

The applescript method is nice, but it makes all the windows to the front. What if I just wanted the window that I got an IM from to go to the front, especially if I don't use tabs?

I am really missing this feature...
mtimmsj
Frappa
Posts: 144
Joined: Wed Jun 08, 2005 6:55 pm
Location: Olympia, WA

Re: Bring adium to front

Post by mtimmsj »

I'm pretty sure what you want to do is possible with a different applescript. The applescript would need to find the most recent message and manipulate the window for that chat. Unfortunately I can't seem to find a way to bring a window to the front, so the best way I can see to accomplish it is to hide every window and then make the one you want to look at visible. Applying something like the following AppleScript to an event for a newly received message will show just the window for that chat:

Code: Select all

on simple_sort(my_list)
	set the index_list to {}
	set the sorted_list to {}
	repeat (the number of items in my_list) times
		set the low_item to ""
		repeat with i from 1 to (number of items in my_list)
			if i is not in the index_list then
				set this_item to item i of my_list
				if the low_item is "" then
					set the low_item to this_item
					set the low_item_index to i
				else if this_item is less than low_item then
					set the low_item to this_item
					set the low_item_index to i
				end if
			end if
		end repeat
		set the end of sorted_list to the low_item
		set the end of the index_list to the low_item_index
	end repeat
	return the sorted_list
end simple_sort

on list_position(this_item, this_list)
	repeat with i from 1 to the count of this_list
		if (item i of this_list as string) is (this_item as string) then return i
	end repeat
	return 0
end list_position

try
	tell application "Adium"
		set theDates to the date opened of every chat
		-- Now figure out which chat is the most recent
		-- Sort the date to get the most recent one at the last place of the list
		set theSortedDates to me's simple_sort(theDates)
		-- Find the location in the original list the last item of the sorted list is at
		set myItem to me's list_position((the last item of theSortedDates), theDates)
		-- So no myItem is an index into the chats for the chat that is the one we want
		set theChat to the chat myItem
		-- And theChat now contains the most recent chat that was opened
		set visible of every window to false
		set visible of every window whose name is name of theChat to true
		activate
	end tell
on error
	-- print debug message here
end try
Post Reply