Fork me on GitHub
#obb
<
2023-07-17
>
donavan20:07:40

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

zane20:07:08

Ah, I faintly remember this.

zane20:07:17

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

donavan20:07:20

quick off the mark!

donavan20:07:27

will do…

zane20:07:35

Might be a weird quirk of OSA.

zane20:07:50

Hope you’re having fun with obb!

donavan20:07:15

You’re right, JS does indeed end up in std errro… 🙀

donavan20:07:37

yeah, that is certainly a… strange design decision

zane20:07:16

OSA is this weird, mostly forgotten corner of macOS.

zane20:07:47

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

donavan20:07:54

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

zane20:07:50

That sounds rad.

donavan20:07:59

I’m between jobs 😄

zane20:07:07

Funemployed!

😂 2
donavan20:07:57

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

borkdude20:07:36

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

donavan20:07:23

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)

borkdude20:07:35

you still didn't say which

donavan20:07:10

oh right, did you mean “startup time or performance”?

donavan20:07:36

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

borkdude20:07:06

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

donavan20:07:47

yeah, sorry meant SCI + clojure.core

borkdude20:07:56

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

borkdude20:07:20

I don't know if osascript supports es6 though

donavan20:07:59

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

donavan20:07:12

I even prefer Emacs Lisp to JS though!

donavan20:07:56

BTW during benchmarking simple scripts nothing I can find beats bb 😉

💪 2
donavan20:07:18

not even compiled (second+ run) Swift scripts