Hacker News new | past | comments | ask | show | jobs | submit login
Inline AppleScript Documentation (indiestack.com)
64 points by zdw on Jan 4, 2023 | hide | past | favorite | 15 comments



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....


Yeah, they never released any documentation for it. They used to point people to the release notes as docs, but then archived all of it: https://developer.apple.com/library/archive/documentation/La...

Yet another example of Apple archiving docs with no replacements.


It's not so so bad, they give JS examples alongside AS examples, e.g., https://developer.apple.com/library/archive/documentation/La...

In general though you don't really need separate JXA docs; you just need to know how to translate AS to JS and you're fine.


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.


Ha. I run a shortcut on my phone to send the url to metube on my server.


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


It was actually for remote control via iMessage. Rendered less useful nowadays due to Apple releasing an API for business (https://register.apple.com/resources/messages/msp-rest-api/)


That’s pretty cool!

I use AppleScript in my business for doing image conversion and sorting.

It’s a pretty stealth feature built into the os that’s been there for years.


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.


I think the main problem AS has is you can accomplish a whole lot with Automator, and now Shortcuts.


I use AS inside my Automator actions along with shell scripts. It all works together!


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!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: