sgt parent
That is pretty impressive. I spent hours upon hours getting OS X to run on a Linux host in KVM and QEMU. Eventually I did get it to work, but things like Messages.app had no chance of working. That was actually my goal - to create my own little Messages API so that I could send automated messages to myself. 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.
> 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?
I'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 fromI 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.
What'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.
Since there was a bit of interest, I wrote this up in a short blog article: https://www.hackerneue.com/item?id=12563526
Thanks for following up with details! I wasn't aware you could do this with Messages, that's a nice interface to know about.
Pretty 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.