开发者

Scheme instead of Applescript?

开发者 https://www.devze.com 2023-01-16 18:51 出处:网络
Can I use Scheme instead of Applescript on the Mac t开发者_JAVA技巧o automate apps such as iTunes, iCal, Mail, etc.?There is no fundamental reason that you could not build another language to construc

Can I use Scheme instead of Applescript on the Mac t开发者_JAVA技巧o automate apps such as iTunes, iCal, Mail, etc.?


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.


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.


Silly suggestion(?) but: Douglas Crockford built a scheme interpreter in JavaScript, and you can script the mac (using OSA) using javascript. Could this work?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号