3 ms·
iMessage from Terminal
Tired of getting off your terminal screen to answer that dickheads friends of yours?
Now you can curse them right on the terminal!
- niklasber 13y agoWould be nice if the Usage section was a bit beefed out. Now one either have to look at code or install it to find out how to specify a contact to send message to. Seems like good stuff though.
- jzig 13y agoAgreed. Although if you follow the documentation as is, it gives you a list of contacts to send the message to. Just tried it out. Not too shabby.
- chrisfsampaio 13y agoI'll improve the Usage section, thanks for your feedback! (:
- aktau 13y agoCool. I immediately wanted to check out how it works to find out it works by sending some bits to Messages.app through applescript. The most relevant portion seems to be: if is_i response puts "Sending \'#{str}\' to chat number #{response}" `osascript -e 'tell application "Messages" to send \"#{str}\" to item #{response.to_i} of text chats'` else puts "Sending \'#{str}\' to buddy \'#{response}\'" `osascript -e 'tell application "Messages" to send \"#{str}\" to buddy \"#{response}\"'` end Though I must say I kinda like the way they've done it in OS X 10.9, where I can respond inline even when I'm on another desktop. The best thing about this is probably that you can send messages when you're logged in to your OSX box remotely. Though for that to be handy it misses a real "chat" feature, in which the app can also playback the messages you've received.
- chrisfsampaio 13y agoHandling received messages is on my to do list. (: Thanks for your feedback!
- aktau 13y agoI immediately thought it would be cool to make some of my cronscripts send some messages to myself when something interesting happens. Sadly, the form used in this utility does not lend itself to sending to self, Messages.app returns an error when you try. Turns out it's quite easy to get around, here's a gist that allows to you make a nice mini-commandline app: https://gist.github.com/aktau/8958054 https://gist.github.com/aktau/8958054 (reproduced here): #!/bin/sh exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit -- taken from: -- http://stackoverflow.com/questions/11812184/how-to-send-an-imessage-text-with-applescript-only-in-provided-service -- thanks to users @Senseful and @DigiLord on run {targetBuddyPhone, targetMessage} tell application "Messages" set targetService to 1st service whose service type = iMessage set targetBuddy to buddy targetBuddyPhone of targetService send targetMessage to targetBuddy end tell end run Now I can do: $ imessage XXXXXXXXXX "gofinance: stock AAPL went up, possibly because of imessage..." Where XXXXXXXXXX is my own number. There are some other cool hacks with this, among others is a Lisp REPL with iMessage: https://46b.it/2012/hacking-with-imessage https://46b.it/2012/hacking-with-imessage.
- salgernon 13y agoAh, Applescript. Almost, but not quite entirely unlike English. Boggling syntax since 1991: http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
- mikemoka 13y ago:-) a lot of people hoped that this was an opensource implementation of the protocol that could easily be ported to Android I bet...
- chrisfsampaio 13y agohahahhahah I didn't think of that
- yincrash 13y agoI definitely did until I was sadly disappointed looking at the source.
- sneak 13y agoThe iMessage/APNS initial registration protocol sends the hardware serial number of the device it runs on to Apple as part of getting its client certificate. They're formulaic, so you can come up with valid ones that aren't your own, but good luck doing that in a way that scales well and doesn't run your app afoul of the DMCA.
- twrkit 13y agoWas naively hopeful that someone had finally reversed the iMessage protocol. Much to my chagrin, it's 'just' an Applescript wrapper. Nice work, nonetheless!
- skierscott 13y agoThe user interface is shoddy. It took me a while to figure that you have to type "imsg This is my message" then choose where to send it when prompted. I included two issues to increase the usage docs as well as the ordering of the conversation list.
- __david__ 13y agoBackticks, really? Don't ever use backticks if you have"#{}" in the string. It should at least be doing something like this: http://porkrind.org/missives/calling-applescript-from-ruby/ http://porkrind.org/missives/calling-applescript-from-ruby/