Hello all. I’m new to MacScripter.net and new to AppleScript, so be gentle
That being said, what a great resource this place is. Between other AppleScript advice websites and this place, I’ve already learned quite a bit. However, there’s tons I don’t know and am looking for some advice.
Here’s what I’d like to accomplish:
I already have a mail rule set up on a Mac Mini server that takes a message with the words “play jazz” and bam, a jazz channel of my choosing starts blaring out of speakers in my kitchen via an Airport Express. This is accomplished rather simply, by the mail rule executing a script that talks to AirFoil and iTunes. It gets iTunes to start playing the stream once AirFoil is set to have iTunes as its input and “Kitchen Speakers” as its output. (see link)
http://www.rogueamoeba.com/support/knowledgebase/?showArticle=AirfoilAppleScript
But here’s what I’d like to do. I’d like to write a smarter script, likely utilizing the power of “text delimiters” that can interpret varying commands in a single message.
Mail would be set up with a rule to respond to the word “play”, which would run a script. This script, would look for different strings within quotes, like “opera” or “salsa”. In the script, an if / if … / else statement would select a certain stream or track in iTunes, or kick back a “did not understand audio selection” error.
Furthermore, in the original message I’d like to be to write play “jazz” in the bedroom, and the script would automatically search for a string after “in the” and do something similar to above, setting AirFoil to select a certain output speaker.
So, I could send a text message on my way home to this email address saying, ‘Play “classical” in the balcony’ and the script would select the balcony speakers as output in AirFoil, then start streaming a classical radio channel of my choosing in iTunes.
Again, I’m pretty green to all this, so any advice anyone has would be dearly appreciated. Cheers.