codahale.com٭blog

This is my old blog. My current writing is here: codahale.com

Send As IM = Adium + Quicksilver

I am now officially in the process of making everything I do Quicksilver-friendly. This round: Adium. The Adium plugin for Quicksilver has been dead since ß36, which means we have to click on things to send IMs. Until now.

The upshot? Cmd+Space, period, “Contact name: Message”, tab, S, enter.

First, 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"
      send (first contact whose (online is true and (display name starts with im_contact_name or UID starts with im_contact_name))) message im_message
    end tell
    return nothing
  end process text
end using terms from

Second, Installing It

Paste the script into Script Editor and save it in ~/Library/Application Support/Quicksilver/Actions as Send As IM.scpt.

Restart Quicksilver (Cmd+Ctrl+Q).

Third, Using It

Open up Quicksilver (either Ctrl+Space or Cmd+Space), and hit period. Type your message in the following format: “Contact name: message body.” (e.g., “Bob: Hey man, what’s up?”). Hit tab when you’re done. Type out as much of “Send As IM” as you need to select the Send As IM action. Hit enter. Done!

Send As IM finds the first online contact on your buddy list whose display name or screen name starts with what you entered as the contact name. If you’re not already chatting with them, it’ll open up a new chat window and send your message. If you’re already chatting with them, it’ll use the existing window.

Ok… now what else do I use the mouse for?

43 Responses to “Send As IM = Adium + Quicksilver”

  1. Martin S Says:

    Awesome!

  2. alutii Says:

    Bloody brilliant - I’ve been wanting this since I got my laptop and never took the time to figure it out. So nice to see how simple this is, well done

  3. Einstein Puppies » Blog Archive » My mac life is complete now Says:

    [...] Send im’s via quicksilver [...]

  4. Campfire Hacks: Uploading Screenshots with Quicksilver and Pyro | footle Says:

    [...] screenshots to Campfire with only a few keystrokes (riffing of my colleague Coda Hale’s desire to eliminate the need for a mouse). Note that this is for Mac users only, so if you’re one of the poor [...]

  5. gabe Says:

    YOU ROCK!!!! thank you thank you thank you

  6. links for 2007-02-08 (Leapfroglog) Says:

    [...] Send As IM = Adium + Quicksilver | Archives | codablog | Coda Hale Handy script that allows you to start IMing through Adium using Quicksilver. (tags: apple mac osx quicksilver scripts adium im) [...]

  7. Elliott Says:

    Having a little trouble getting this working…any suggestions on what i might be doing wrong? Do I save the file as “Actions as Send As IM.scpt.” and place that into directory:

    /Library/Application Support/Quicksilver/

    Or am I supposed to put it into the “action.plist” document? Thanks

  8. Coda Says:

    Elliot: Create a folder named “Actions” in /Users/(your username)/Library/Application Support/Quicksilver. Put the script in there.

  9. Robert Says:

    yeaha… :D that rocks (:

  10. tim Says:

    man! you rock :)

  11. morganusvitus Says:

    The site looks great ! Thanks for all your help ( past, present and future !)

  12. Rubin Says:

    Pretty cool… But it’d be even cooler if you could send someone an IM by looking up their contact info first, like it’s done with iChat…

  13. Coda Says:

    I agree, Rubin, but that’d require a full-on Quicksilver plugin, which is way more complicated than a simple Applescript.

  14. ZipperSeven Says:

    Dude, I can’t tell you how awesome this is.

    Thanks for the code. Works like a charm.

  15. noneck Says:

    thank you!

  16. rainmanbk Says:

    quick question.. anyone to have a tabbed window in the background come to the front after this is performed? It works great, but say for example you had an open im to someone else. Doing this opens a new tab, but in the background. Any additions the script we can do?

  17. majc Says:

    Firstly - Script is great so a big thankyou!

    Rainman’s got a really good point there - I’d Love to bring the window/tab to the front as well.. but I’d like to have it as a duplicate script with the setfocus bit on the end - so I’d have a separate script “Send and setFocus” as well as the original becuase I think sending it in the background is actually really useful!

    Thanks again

  18. Quicksilver tutorial and screencast roundup - Simplehelp Says:

    [...] Send as IM = Adium + Quicksilver (tutorial) [...]

  19. David Alan Says:

    You might be interested in contributing to the Quicksilver plugin, as it’s perpetually under development, under supported and, well, breaking.

  20. K Says:

    This doesn’t work at all for me, I have no idea why. When I hit “execute” the window just goes away, there’s no IM that’s sent. I made an actions folder, put the script in it, and I can select the script after I type my message, but it doesn’t work. Maybe I’m doing something wrong when identifying contacts? I’ve tried both the contact list name and the account name, nothing. Any suggestions?

  21. J Says:

    Did not work for me either. I get the same thing described above by K.

  22. Niklas Says:

    Great initiative Coda!
    Looks like this does not work with more recent versions of Adium. Just lik K and J I am unable to get this to work at all.

  23. doniv Says:

    Doesn’t work for me either :(

    Adium 1.0.4 connected to 2 jabber accounts.

  24. htiawe Says:

    AWESOME!
    You rock!

  25. hackerjoe Says:

    I have Adium 1.1.1 and quicksilver ß51 and this doesn’t appear to work, did Adium change and break the script?

  26. stefan Says:

    @hackerjoe: script works fine wiht 1.1.2

    -stef

  27. Henrik N Says:

    Thanks, works well.

    I removed online is true and since I mainly want this to message offline users.

  28. Ben D Says:

    I can’t get this to work with Adium 1.1.2 / QS β51 (3800)

    Send As IM.scpt shows up in my action list but nothing happens upon execution. I even tried chmod 777 in case it was a permissions issue, but no go. Any suggestions?

  29. Ben D Says:

    Okay, problem solved and BOY is it embarassing:

    I put the code into a text editor and saved it as Send As IM.scpt, not realizing that script files are actually binary objects and have to be edited in the Apple Script Editor–not in a regular text editor.

    Once I did that and then restarted Quicksilver (another important step, I found) it worked like a charm.

    Thanks for the code and for forcing me to learn something about Applescript today.

  30. Ben D Says:

    For those who want the window to be brought into focus, just add “activate” before the send command, like this:

    tell application “Adium”
    activate
    send (first contact whose (online is true and (display name starts with im_contact_name or UID starts with im_contact_name))) message im_message
    end tell

  31. Dan Parsons Says:

    This doesn’t seem to work using Quicksilver B52 (3813) and adium 1.1.3 .. any suggestions?

  32. dacc Says:

    Cheers, thanks. =)

  33. Eric Litman Says:

    Coda, many thanks. My fingers are almost as wired to QuickSilver as they are to vi, and this just helps to feed my growing addiction.

  34. Dexter Arver Says:

    Hmmm. I am using quicksilver B54 and Adium 1.2 and this isn’t working :(

    I followed the direction and am able to see the script in quicksilver, but when I press enter (after I put in the message), it just won’t send any IMs. :(

  35. Dexter Arver Says:

    Awww lame. Looked more into it and found this bug:

    http://trac.adiumx.com/ticket/8864

    Even if someone changed Coda’s code for 1.2 (which has a totally rewritten applescript support), it won’t work until that bug is fixed.

  36. RomDeathknight Says:

    Hi,
    I’m using QS Beta54
    Adium 1.2.1

    This site has a working plugin:
    http://adiumx.com/pipermail/adium-devl_adiumx.com/2007-April/002591.html

  37. RomDeathknight Says:

    oops forgot to mention. If the installation was successful, it will tell you to restart Adium. Adium will ask about disabling an external plugin -Don’t disable otherwise the purpose of using QS-Adium chat is defeated.

    When you install this plugin, you have to >> QS Preferences >>Handlers
    and change from ichat to adium.

    When that’s done:
    1) invoke QS
    2) press period and type the text you want to IM
    3) press Tab and type as much as you need to get “IM to account”
    4) search the contact and press enter

    Adium must be on before you can use this chat option.

  38. Nick Says:

    wooo hoooooo! i just started using quicksilver yesterday, and looks like I joined the band wagon at the right time!!!

    This is awesome. Thanks RomDeathknight!

  39. Jack Says:

    RomDeathknight, for some reason when i tab to the third column, it doesn’t register any search attempts. It doesn’t even show the letters being typed to be searched. Any idea why this could be?

  40. Owen Says:

    I’m running B53 Quicksilver with Adium 1.2.3 and got the plugin posted by RomDeathknight working.

    My first attempt yesterday was the same result as Jack’s. This morning Adium prompted to load an external plugin, which I didn’t get before. I was pretty sure I restarted Adium as well as Quicksilver, but perhaps not. After a full restart I can now use QS to send IM’s :-)

  41. Daniel Cohen Says:

    Hi.
    I’ve owned a Mac for a week, Quicksilver for 2 days and an hour ago was my first foray into Applescript. I am, however, extremely obsessive, so I refused to go to sleep until I got your script working in Adium 1.2. They definitely changed the object model considerably, but I managed to hack together something that works for me (at least in the most basic of cases; I don’t know how to handle errors yet :) ).
    Hope it helps someone out there…


    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"
    activate
    set destContact to (first contact whose (status type is not offline and (display name starts with im_contact_name)))
    set destAccount to (account of destContact)
    tell destAccount to set destChat to make new chat with contacts {destContact} with new chat window
    tell destChat to send message im_message
    end tell
    return
    end process text
    end using terms from

  42. Daniel Cohen Says:

    Err, OK, so that obviously didn’t work (you could really use a preview feature here!). So, just in case, I pasted it here:

    http://moestaverne.com/nopaste/?691

  43. Daniel Cohen Says:

    I just realized, the next hit in Google was someone who fixed it several months ago (and, unlike me, obviously knows what he’s doing). Figures. Anyway, it was a fun waste of time!