January 12, 2008

Adium + Quicksilver Script

For whatever reason (perhaps it’s the slowness of Twitterific, or the lack of any other application to satisfy my Twitter-craving) I wanted to be able to Tweet from Quicksilver. A quick Google led me to an AppleScript to Tweet from Quicksilver, but alas…it was a year old and not functional.

So, two hours later - allow me to present an updated version of the script:

using terms from application "Quicksilver"
	on process text im_text
		repeat with im_delimiter_position from 1 to (length of im_text)
			if character im_delimiter_position of im_text = ":" then exit repeat
		end repeat
		set im_contact_name to characters 1 thru (im_delimiter_position - 1) of im_text as string
		set im_message to characters (im_delimiter_position + 2) thru (length of im_text) of im_text as string
		tell application "Adium"

			set user to first contact whose (status type is available and (display name starts with im_contact_name or title starts with im_contact_name))

			if not (exists (chats whose contacts contains user)) then
				tell account of user to (make new chat with contacts {user} with new chat window)
			end if

			send (first chat whose contacts contains user) message im_message
		end tell
		return nothing
	end process text
end using terms from

The procedures for installation and usage are the same.

  • Paste the script into Script Editor and save it in ~/Library/Application Support/Quicksilver/Actions as Send As IM.scpt.
  • Cmd+Space, period, “Contact name: Message”, tab, S, enter.

I now return you to your regular Twedule.

9 Comments so far
Leave a comment

Damon, Works like a DREAM as we have tested on twitter [michaelramm]. Thanks for the work to make QS an even bigger part of my Mac usage.

Apparently, after trying both, when compiling the script, it shows a syntax error, where in this line
“set user to first contact whose (status type is available and (display name starts with im_contact_name or title starts with im_contact_name))”
contacts is not a valid class.
is there any way of rectifying this?

it says, “Expected class name but found identifier”

@Victor What version of Adium and OS X are you on? I currently am on Leopard and Adium 1.2.

Great. I have been struggling with the adium applescript documentation to get the old script working with the new adium 1.2.x.. this does the trick. Thanks!

one thing I would add:
instead of:
send (first chat whose contacts contains user) message im_message
I used:
set im_chat to first chat whose contacts contains user
tell im_chat to activate
send im_chat message im_message

that way if the chat already exists, but a window for it is not open, it will open the window

Very handy script, thanks. I noticed after using it to send an IM, the focus goes to the chat window.

But I’d rather have the focus remain on my current active window so I can continue with whatever I was doing. Is that possible?

Thanks again.

Hey, thanks for making this. I was having problems with outdated versions, but with Adium 1.2.5 and Quicksilver B54 (is it B?)

I think the next level would be to get a list of matching screen names out of Adium, display a drop down, and show which user will actually receive the message. Any thoughts on how this could be done?

[...] I’ve had a MacBook Pro for about 3 days now, and I’m loving it. One really sweet program is Quicksilver, which is like the Windows Run dialog on steroids. There’s a great script I’ve just started using that lets you send Adium IMs from Quicksilver [...]



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>