Helpful Article. OSA is one more area where Apple's documentation is woefully lacking by now. For using JavaScript instead of AppleScript I don't find any docs at apple.com but on GitHub: https://github.com/JXA-Cookbook/JXA-Cookbook/wiki#table-of-c....
I use AppleScript nearly every day, mostly to grab little bits of info from one app & tell another app to do something with it. For example, I have one that grabs the URL & page title of the foremost Chrome tab, switches to Terminal, and starts a youtube-dl process with the Chrome URL. It's just a little shortcut to download whatever I'm currently watching.
It's wonderful because it's so much simpler than building a real integration or application, but it's also terrible because of (A) how tedious it is to actually write AppleScript and (B) how flaky/racy UI automation can be unless you're using great tools.
AppleScript is a terrible yet reasonably well documented language. At the other end of the spectrum is JavaScript for automation (JXA), which exposes all the same APIs AppleScript does (modulo the spelling of function names), is a much more sane language, and is barely documented. I find that AppleScript is like bash and JXA is like python in terms of how complicated a script can be before you swift from the former to the latter.
Used AppleScript as recently as 2018 - for a small commercial project even. It works great and I don't think anything else comes close, aside from proper programming/scripting which isn't a fair comparison for the typical AppleScript use-cases.
Can you talk a bit more about this? The only experience I have with AppleScripts, is attaching it to a folder so that any PDFs that were dropped in it were OCRed using Azure, and then converted to a blog post
Yeah my thought too, that's a pretty cool use of AppleScript. Working with PDF's one generally wants to do from your own machine anyway, so it's ideal. You could even send documents or photos through to Azure's facial recognition API and order based on people/faces. Just an idea.
Only AppleScript has worse semantics than bash. It’s like working with a language that was designed by someone who read about other programming languages but never actually used one. I’m glad it’s there but I wish Apple would modernize it and give it some TLC. It’s obviously their last priority.
This is very helpful. I’ve needed to search AppleScript-related questions occasionally and I’m usually disappointed. Nice to have more resources like this!