Also we should note that Javascript is a first - class citizen on Mac now. Which means it’s scope is well sorted to be used in an export script with file system access. Although JXA documentaion is crap you can bridge it to Objective - c which I do all the time. ( And I know , not for the faint hearted )
JXA is available on the Mac. It’s nice. I’m not sure how much Apple will support it though. Aside from the initial launch, has there been much development?
Boy is that slow… just tried the wrapper and previewing feels like on a steam boat. Not looking for anything in particular. We are just exploring the use of Js in exporter scripts as it leverages the knowledge web developer have. Most of these don’t use Python.
Just to follow if your script is running and what is written back to StdOut you can use log stream --style syslog --predicate '(processImagePath contains[c] "hype") && (category != "security_exception")'
That was my logic for using JXA. Ultimately, I ended up building a Swift based application, but the JXA version also works. For some parts I simply had to use shell commands to get things done, but overall it was nice. Hopefully Apple continues to support it.
You get all the arguments in input as an array. Just run over them and if they start with -- they are a new key else they are the current value for the current key. This way you can create an object with named keys from them. You then return modified versions to StdOut as Hype is running all the settings through your script. To peak at the expected formatting just look at the exit_with_result function in the Python sample script (Json and a custom delimiter made of equal signs);
But this is soooo slow compared with Python so… basically dead to me if there isn’t a more performant solution.
I know when I have used JXA with OBjC it can be fast processing files but thats normally for my needs.
Does speed matter here?
When you say slow.. in what sense..?
Well, just hitting the preview button and having the result pop up in the browser of my choice using an export script based on osascript -l JavaScript. That takes 4-5 times longer then usual on my MacBook Pro. You can literally see how slow it is when you follow the log with the method from above.