I tried to do some advanced stuff with Apple Shortcuts today, and I was thoroughly defeated.
-
I tried to do some advanced stuff with Apple Shortcuts today, and I was thoroughly defeated. The built-in stuff is easy and pretty useful. But I wanted to create a little custom function using JavaScript for Automation (JXA). It's supposed to have the same capabilities as AppleScript but in a js runtime.
It's the same familiar problem with proprietary platforms. It's just different enough that typical code doesn't work. Plus the documentation sucks, and there's barely any support for debugging.
-
I'm always left asking myself who is this for? Why would you bother building a scripting platform and then not telling anybody how to use it and not providing tools for them to be successful at it?
-
I got momentarily excited about JXA precisely because I have used AppleScript and found it pretty difficult. I was like I know javascript! But it turns out you can't actually do anything useful without diving into the Obj-C bindings.
https://blahaj.zone/notes/9z4phubq28qt016c -
Obj-C actually has decent documentation. But you have to translate those calls into the javascript equivalent. And they do a really poor job explaining the rules there.
-
For anbody who's curious, I wanted to parse a url string and modify it. But the browser built-ins are not available, so I couldn't use the URL class. Instead I have to use NSURLComponents from Obj-C? But I just couldn't get it to work. It's definitely there, I'm just calling it wrong. I spent a half hour trying to figure out the right way to call it and then I gave up.
-
@polotek not an answer but because of this I discovered I can have my iPhone execute a script over SSH via Shortcut, including generating a public key to give to the server.
-
@anderson_jon yeah I saw this too. Seems dicey from a security perspective. But potentially useful!