2 ms·
For a while, there was a wonderful third-party alternative to Applescript known as "appscript"[0]. Your example above in Python would've been: app('Mail').
by js2 12y ago
For a while, there was a wonderful third-party alternative to Applescript known as "appscript"[0]. Your example above in Python would've been:
app('Mail').outgoingMessages[its.subject=='JavaScript']
Appscript also had bindings for Ruby and ObjC.
Unfortunately, Apple deprecated the underlying API in 10.6 that made appscript possible and never provided a suitable replacement[1].
As always though, the problem wasn't Applescript, but rather limited support for Apple Events by applications. Unless that problem is fixed, adding Javascript support to the OSA isn't going to help much.
[0] http://appscript.sourceforge.net/index.html http://appscript.sourceforge.net/index.html
[1] http://appscript.sourceforge.net/status.html http://appscript.sourceforge.net/status.html
Edited to add: I see the author of appscript has additional criticism linked to elsewhere from this thread - https://news.ycombinator.com/item?id=8329408 https://news.ycombinator.com/item?id=8329408