Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a service that grabs the URL of some link, then create a blank iMessage with that URL in the body. Basically, I want to recreate that Message share feature in Safari in Mountain Lion, but with, specifically. "Copy Link" from the context menu doesn't always work, esp. when sending to a iphone, the URL drops, and all you get is the alias.

I've set up an Automator with Applescript, and I can definitely send a message to a buddy, if those things are specified. I'd prefer to populate that in iMessage, since I won't always be sending to the same person.

Below works, using set input as a proxy for automator's url grabbing at the moment.

set input to ""
tell application "Messages"
          set theBuddy to buddy "" of service "iCloud"
          send input to theBuddy
end tell

Also tried

tell application "Messages"
    set theBuddy to buddy "*" of service "iCloud"
    set input to invitation message of text chat of service "iCloud"
end tell

Both from

share|improve this question
Interestingly, in a workaround, using the two buddies will almost always use with 'send input to ""', i get a working service. it is available in Safari for a URL, but it is not available in as a service for anything. It doesn't show in the context menu, it doesn't show up in Reeder > Services. Odd. Is this a Reeder issue? I noticed that my service is in "Internet" category in Services Manager...I would still rather have a blank iMessage with a URL in the text, so that I can amend if I want. – greenwar Sep 3 '12 at 9:19

You have to do it with UI scripting :

tell application "System Events" to tell process "Messages"
    set input to "" as text
    click button 1 of group 1 of splitter group 1 of window 1
    delay 1
    keystroke "" -- type the reciever
    keystroke return -- validate the previous input
    keystroke tab -- move to message input
    keystroke input -- type the message
end tell
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.