Appscript is a technology that bridges Applescript’s best feature with Python, Ruby, and Objective-C. It brings Apple Events to these languages and allows them to interact with applications similar to Applescript. There’s been a bit of press on MacDevCenter about using Appscript in Ruby. That’s all well and good but I don’t particularly care for Ruby. I’ve wanted to see some tutorial about using appscript with Python. I’ve also wanted to see how to interact with everyone’s favorite scriptable application, iTunes. I haven’t seen either so I spent part of today working something up.
Appscript is interesting and somewhat exciting. Its biggest hassle is the marriage between two different language styles. Applescript tries to be verbose and English-like. Python, Ruby, and Objective-C all have to do some peculiar things to approximate this readability. They don’t mesh particularly well, although appscript does a reasonably admirable job. If you are already an applescripter, you have a hurdle to get around. The different syntax makes you think in a different way than you normally would. Of course, if you are used to “normal” languages, you also have to reorient yourself to think a bit like an applescripter.
I wrote a quick little script that renames tracks for a particular artist to that it follows normal title format considering common prepositions and whatnot. The script and some comments are in the extended entry.
(more…)