4 ms·
is this going to be solved by writing it in javascript though? Looking at the sample code in this page: Mail.outgoingMessages.whose({subject:'JavaScript'})
by riffraff 12y ago
is 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.