31 ms·
> I ended up just scripting Messages.app on a real Mac and that works really well, even 2 years after. I remote control my house that way. That sounds pretty n
by mattwg 10y ago
> I ended up just scripting Messages.app on a real Mac and that works really well, even 2 years after. I remote control my house that way.
That sounds pretty neat, do you have more details written down anywhere?
- tambourine_man 10y agoPretty neat indeed. It's sad though that one has to virtualize an entire OS just because a messaging system doesn't offer an open API.
- JustSomeNobody 10y agoThe world is getting more proprietary ... sadly.
- tambourine_man 10y agoIn some ways, yes. On the other hand, free software is also everywhere. Linux, Webkit/Blink/Firefox, Apache/nginx, LLVM/GCC, Emacs/Vim… it's a pretty big list. Instant messaging and Pro Photo/Video apps are a particularly sore point.
- sgt 10y agoI've installed an AppleScript handler from within Messages.app. The script below is called ReceiveMessage.script and is located in ~/Library/Application Scripts/com.apple.iChat and basically accepts messages. That's how I handle inbound messages, and for outbound I basically also have a separate script for sending out messages. I do the actual work in separate python scripts called by the shell scripts though. -- snip snip -- using terms from application "Messages" on message received theText from theBuddy for theChat set quoted_message to quoted form of theText set quoted_id to quoted form of (id of theBuddy as text) do shell script "echo " & quoted_message & " | ~/bin/MessageReceive.sh " & quoted_id & " > /dev/null 2>&1 &" # make messages happy return true end message received on message sent theMessage for theChat end message sent on active chat message received end active chat message received on chat room message received theMessage from theBuddy for theChat end chat room message received on addressed chat room message received theMessage from theBuddy for theChat end addressed chat room message received on addressed message received theMessage from theBuddy for theChat end addressed message received on av chat started end av chat started on av chat ended end av chat ended on login finished for theService end login finished on logout finished for theService end logout finished on buddy became available theBuddy end buddy became available on buddy became unavailable theBuddy end buddy became unavailable on completed file transfer end completed file transfer end using terms from
- DigitalJack 10y agoI like the project, but I really don't like applescript. In programming languages, it seems there is a tension between easy-to-write and easy-to-read. And I suppose a fork in the continuum with easy-to-read-for-novices and easy-to-read-for-programmers. applescript went overboard on the easy-to-read-for-novices at severe cost to easy-to-write.
- pmarreck 10y agoWhat's hard to read about it? Obviously (to me), those are all event handlers. Not sure why (or if?) you have to define the ones that don't actually do anything, though.
- saghm 10y agoI'm pretty sure he's saying that they made it too easy to read, at the expense of being easy to write (with the premise that these are opposite ends of a spectrum stated above)
- josh64 10y agoFWIW you can use JavaScript now instead of AppleScript.
- brennebeck 10y agoThe formatting got borked, but this is very cool. Could I contact you to get additional details? Edit: my email is in my profile
- mattwg 10y agoThanks for following up with details! I wasn't aware you could do this with Messages, that's a nice interface to know about.
- sgt 10y agoSince there was a bit of interest, I wrote this up in a short blog article: https://news.ycombinator.com/item?id=12563526 https://news.ycombinator.com/item?id=12563526