3 ms·
Unfortunately, JXA’s Apple event support is buggy and broken, and not a competent replacement for AS. AppleScript may suck as a language but at least it speaks
by hhas01 7y ago
Unfortunately, JXA’s Apple event support is buggy and broken, and not a competent replacement for AS. AppleScript may suck as a language but at least it speaks Apple events right. JXA could’ve been Apple’s answer to Node.js, but it failed so hard that Apple scrapped the Mac Automation team and fired the PM responsible. The whole stack’s in maintenance mode now.
“As an example task similar to what the article discusses, whose source code is actually readable, here's a script to change the font of all text in all master slides in Keynote.”
That’s a good example of how not to use Apple events, which are notoriously high latency. Here’s the simpler, efficient canonical solution:
Application('Keynote').documents[0].masterSlides.textItems.objectText.font = TARGET_FONT
Apple event IPC is not OOP/DOM, it’s RPC plus queries. Sending lots of simple messages manipulating one object at a time is far slower than sending a more complex message that manipulates all objects at once.
..
As to Userland, yeah, Frontier was first and, crucially, knew how to speak Apple events right. But Dave got huffy that Apple didn’t take it and flounced for the nascent Web dev market where they promptly got eaten by PHP.
A pity: ol’ Dave could’ve taken a lesson from Napoleon (“never interrupt your enemy when he is making a mistake”). Mac Automation should be pure geek catnip, but AppleScript is so hideously programmer-unfriendly and unscalable, programmers’ instant loathing of it is the major reason Mac Automation has failed to thrive. Userland could’ve stayed where it was and easily won a robust audience of professional users and developers begging for a non-atrocious alternative. Ah, hindsight’s a wonderful thing.