3 ms·
As braindead as the language was, the real problem with AppleScript was the bizarre object model, so the Object help doc was full of nonsense methods that did n
by judk 12y ago
As braindead as the language was, the real problem with AppleScript was the bizarre object model, so the Object help doc was full of nonsense methods that did nothing useful. Finding the one method doExactlyOneSpecificThing that matched what you need was always a low-probability event. The opposite of the UNIX philosophy and modular design.
- rmrfrmrf 12y agoYep. Script Debugger was almost a requirement for doing any serious AppleScript hackery. You can explore an open application's exposed objects and tell Script Debugger to paste the path to it into your current script. Way better than guessing when you need to `tell x` in order to expose its properties or whatever. The most underrated thing to me that made it all worthwhile, though, was Remote Scripting. I think the full potential of it has yet to be realized, and hopefully JavaScript will allow some impressive future developments.
- riffraff 12y agois this going to be solved by writing it in javascript though? Looking at the sample code in this page: Mail.outgoingMessages.whose({subject:'JavaScript'}) is doesn't look much better.
- obituary_latte 12y agoLooks pretty straightforward to me. Do you know what the equivalent AppleScript is? Edit: found a stack overflow question/answer [1]. It's doing a little additional work beyond searching for mails with a particular subject, but even just the searching functionality is much larger and more convoluted that the single line of js you referenced. [1]http://stackoverflow.com/q/8156120 http://stackoverflow.com/q/8156120
- meowface 12y agoI never understood the cutesy naming schemes. What's wrong with .filter or .where.
- erikano 12y agoI agree, but I guess .filter or .where could be more difficult to understand for beginners.
- nilliams 12y agoAgree. Hopefully (?) it's just JS by the point we get to `Mail.outgoingMessages` so it should be fairly straightforward to mix-in underscore's methods into whatever their 'collection' representation is, the same way Backbone does [1] to give you map/filter/which etc. [1] http://backbonejs.org/#Collection-Underscore-Methods http://backbonejs.org/#Collection-Underscore-Methods
- turingcar 12y agoIn fact, you can use either “whose” or “where”, and the AppleScript language guide refers to this as “Filter”: <https://developer.apple.com/library/mac/documentation/applescript/conceptual/applescriptlangguide/reference/ASLR_reference_forms.html#//apple_ref/doc/uid/TP40000983-CH4g-BAJJHEFE> https://developer.apple.com/library/mac/documentation/apples...
- coldtea 12y agoThis is about as simple as an API goes. What did you expect to see exactly? doWhatImThinking();
- riffraff 12y agoIt's not ease of use I'm talking about, I was referring to API discoverability/ease of finding what you need. Since the javascript code looks isomorphic to outgoing messages whose subject is "JavaScript" I'd think that the issue is not mitigated by a different syntax.
- rmrfrmrf 12y agotell application "Mail" set msgs to every outgoing message whose subject is 'JavsScript' end tell So, yes :).
- jimbokun 12y agoLooks very Ruby-esque.
- Camillo 12y agoYou're not actually supposed to have doExactlyOneSpecificThing methods in AppleScript. Instead, you are supposed to have a small number of verbs that can operate on a large number of objects and their properties. It was REST before there was REST. Unfortunately, this design principle was often misunderstood by those writing scripting interfaces for applications. It also didn't help that Apple provided very little support for implementing the language's rich query model, which led to many applications only implementing one or two ways to access objects, often with bugs. That was the source of most of the annoyances with AppleScript.