4 ms·
JavaScript is not AppleScript. JavaScript is only useful with dozens of libraries imported, and they introduce their own quirky syntax (I'm looking at you, JQu
by peterburkimsher 10y ago
JavaScript 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...