looking to switch from AppleScript to Python (or Ruby)

It’s that time of the week when I get fed up with AppleScript and start thinking about switching to a different, i.e., better, language. I’m very inclined to try fulfilling my DT scripting needs with Python, but I am also open to using Ruby. I don’t know either language currently. My understanding is that neither can be used as a replacement for AppleScript in scripting an application without some additional set up work.

My question for people currently using Python or Ruby to script DT is what did you need to do to get it working?

I’m not interested in a general argument of the merits of Python vs. Ruby (I’ve found stuff online already), but if you feel one has a specific advantage when it comes to scripting DT, I’d love to hear it.


All you need to do is install appscript via a Ruby gem or Python egg.

I use Python, but I’d suggest trying Ruby for three reasons:

  1. rb-appscript mailing list
  2. Matt Neuberg’s web site (and work) devoted to rb-appscript
  3. Apple’s support for Ruby

HTH, Charles

Apple is apparently betting on Ruby. MacRuby is getting more integrated with the system for each version, and is announced to soon have direct support for AppleEvents, something that will make scripting easier and more robust.

The problem today with using Ruby (and Python) is to figure out the syntax for the commands, since the documentation is weak or nonexistent. You can send applescript commands, but that would just make Ruby a more complex way to write AppleScript. Instead I recommend learning some rudimentary F-script, since F-scripts “sys browse:” command will bring up a list of all available commands for an object. Also, you can often guess the syntax if you know the corresponding AppleScript command.

I’ve posted some example on how Ruby can be used to control DevonThink here: