views:

94

answers:

2

Can I use Scheme instead of Applescript on the Mac to automate apps such as iTunes, iCal, Mail, etc.?

+1  A: 

There is no fundamental reason that you could not build another language to construct the messages (Apple Events) that are passed through the OS to other processes. Back in the days of Classic, the MPW shell had constructs for doing exactly that.

Apple provides Open Scripting Architecture to support this kind of thing.

But...

  • Wikipedia reports that there are Javascript, Perl, Python, Ruby, and Tcl tools that can generate Apple Events with the Javascript OSA component being best integrated and a better MacRuby interface coming.
  • The result might not feel very scheme-like.
dmckee
Yes, already found the Scripting Bridge. I figured as long as Scheme has been around someone had already done the heavy lifting.
Kawili-wili
+1  A: 

If it’s just that scheme is awesome, you are probably out of luck. But there are other options. appscript currently supports Ruby, Python, and Objective-C.

Combined with the ASTranslate application also linked on the appscript page, you should be able to do anything using appscript that you can do using AppleScript. I’ve used it to import FileMaker databases into MySQL, both directly and using Django, and also to control iTunes.

If you’re inclined that way, it might be possible to port appscript to scheme.

Jerry Stratton
+1 Appscript FTW!
Ned Deily
Yes, I'm familiar with appscript, but thanks for the reference. There's the objc egg for Chicken scheme and there is do-applescript for Emacs. I was wondering about an applescript bridge for Scheme.
Kawili-wili