4 ms·
All we can do is guess, but maybe they're retiring AppleScript specifically, rather than automation support generally? Yosemite added JavaScript for Automation
by Osmium 10y ago
All we can do is guess, but maybe they're retiring AppleScript specifically, rather than automation support generally?
Yosemite added JavaScript for Automation (JXA)[1]. Very few people actually enjoy writing AppleScript, I think most see it as a noble but failed experiment in human-language syntax. Perhaps this is just a sign that Apple's removing AppleScript altogether in favour of JavaScript?
[1] https://news.ycombinator.com/item?id=7862973 https://news.ycombinator.com/item?id=7862973
- mmastrac 10y agoI'd be very happy to see AppleScript retired in favour of JavaScript. The pseudo-english syntax has always been painful. It might have been reasonable with a good IDE, but I have never found one that can tell me how to write what I want to write.
- peterburkimsher 10y agoJavaScript is not AppleScript. JavaScript is only useful with dozens of libraries imported, and they introduce their own quirky syntax (I'm looking at you, JQuery). JavaScript can't "do shell script" (even PHP can do exec). JavaScript can't read and write files. JavaScript can't read the selection in one program, pull data from another program, and merge it in with something on the clipboard to piece together what you're actually wanting. JavaScript can't handle unicode to my satisfaction. Even escaping strings is a pain. AppleScript's string manipulation is so clean. Regex that would be very complicated to put together without a trip to StackOverflow is translated into something super easy ("every word of last paragraph").
- adrianmalacoda 10y agoJavaScript can do whatever the environment lets it do. Obviously browser based JavaScript is extremely limited but JavaScript running outside of a browser (e.g. on a server, or in a desktop application) can and does do all of those things you say it can't do. It's been a long time since I've ever done any AppleScript so I can't really compare, but it does seem like the JXA environment can do any of those things, since it has an Objective-C bridge[0]. [0] https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-10.html#//apple_ref/doc/uid/TP40014508-CH109-SW1 https://developer.apple.com/library/content/releasenotes/Int...
- vlunkr 10y agoI assume they would leave AppleScript just for legacy purposes, even if they are moving to JS or something else.
- TheAceOfHearts 10y agoHave you tried using JXA? It's horribly undocumented! :( I find it incredibly frustrating, because otherwise I think JXA would be amazing. It's actually incredibly powerful, if you're willing to put in the time to figure it out. You can use JXA-handbook and its linked resources as a reference. But aside from that the only thing you'll find from Apple is the changelog [1] and the library in Script Editor (open it with shift+cmd+L). [0] https://github.com/dtinth/JXA-Cookbook/wiki https://github.com/dtinth/JXA-Cookbook/wiki [1] https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html https://developer.apple.com/library/content/releasenotes/Int...
- CountSessine 10y agoPython has had bindings for AppleEvents too, which is the underlying OS mechanism for AppleScript/Automator. Most of what you can do in AppleScript can be accomplished in python. Or at least that was the case back in the 10.6 days. I wonder if those bindings are still being maintained.