This would be a nice script. I always have 2 messengers open. The work around I have been using for quite sometime is by using a program called PS Tray Factory (
http://www.pssoftlab.com/). It costs money unless you want to crack it (can I say that stuff here
).
It can change the tooltip, the icon, position in the systray, almost everything, and more. It's really great. Give it a go if no one can make/help with this script or if it just isn't possible
.