obb 2023-07-17

Hi šŸ™‚ I’ve been mucking about with obb a bit and hit something odd, it seems prn goes to std error (my unix-fu is not very strong so I might not be doing the redirection correctly):

āÆ obb -e '(prn "goes to error")' > out 2> error

āÆ cat error
"goes to error"

āÆ cat out
nil

āÆ obb --version
obb v0.0.3

Ah, I faintly remember this.

I think the thing to do would be to check if JavaScript has the same behavior.

quick off the mark!

will do…

Might be a weird quirk of OSA.

Hope you’re having fun with obb!

You’re right, JS does indeed end up in std errro… šŸ™€

yeah, that is certainly a… strange design decision

OSA is this weird, mostly forgotten corner of macOS.

Can I ask what you’re thinking of using obb for?

Sure, it’s a bit roundabout: I’m using it to really explore available options in plain JXA. Once I’ve got it down with obb I’m translating to JXA as it executes faster than the whole of Clojurescript + obb. In terms of why… I’m mucking about with turning Emacs into a Spotlight/Alfred/Raycast like tool, for e.g., I can hit a key in Safari which copies the title and URL and opens up a floating Emacs frame with Org capture for taking notes

That sounds rad.

I’m between jobs šŸ˜„

Funemployed!

šŸ˜‚ 1

I’ve got all the bits and pieces working and a few example commands… now I’m trying to nail down the best way to script MacOS… you’re right, Apple really have seemed to abandoned MacOS scripting… Interestingly you can script in Swift with just a shebang but it’s not as user friendly as JXA or AppleScript

> I’m translating to JXA as it executes faster than the whole of Clojurescript + obb. Do you mean in terms of startup time of performance?

yeah, obb is about 200ms for something simple my side (I can get the numbers I’m just pulling off the top of my head)

you still didn't say which

oh right, did you mean ā€œstartup time or performanceā€?

I’m guessing it has to compile the whole of CLJS per execution?

well, obb uses SCI and SCI yields about 1mb of JS. The OSAscript thing isn't the most optimized one I guess. With nbb (Node.js) I have about 100ms of startup time

yeah, sorry meant SCI + clojure.core

I wonder if #cherry or #squint would work for OSAScript. They are compiled and smaller (squint yields the smallest)

I don't know if osascript supports es6 though

mmm, I’ll probably just go back to JXA for these little bridge scripts

I even prefer Emacs Lisp to JS though!

BTW during benchmarking simple scripts nothing I can find beats bb šŸ˜‰

šŸ’Ŗ 1

not even compiled (second+ run) Swift scripts