4 ms·
There used to be Userland Frontier, which was actually earlier and better than AppleScript! https://en.wikipedia.org/wiki/UserLand_Software#Frontier https://en
by DonHopkins 7y ago
There used to be Userland Frontier, which was actually earlier and better than AppleScript!
https://en.wikipedia.org/wiki/UserLand_Software#Frontier https://en.wikipedia.org/wiki/UserLand_Software#Frontier
>UserLand's first product release of April 1989 was UserLand IPC, a developer tool for interprocess communication that was intended to evolve into a cross-platform RPC tool. In January 1992 UserLand released version 1.0 of Frontier, a scripting environment for the Macintosh which included an object database and a scripting language named UserTalk. At the time of its original release, Frontier was the only system-level scripting environment for the Macintosh, but Apple was working on its own scripting language, AppleScript, and started bundling it with the MacOS 7 system software. As a consequence, most Macintosh scripting work came to be done in the less powerful, but free, scripting language provided by Apple.
Both AppleScript and Frontier supported Apple's "Open Scripting Architecture" (kind of like OLE Automation via Apple Events).
https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/HowMacScriptingWorks.html https://developer.apple.com/library/archive/documentation/La...
https://en.wikipedia.org/wiki/AppleScript#Open_Scripting_Architecture https://en.wikipedia.org/wiki/AppleScript#Open_Scripting_Arc...
Now Automator lets you use "JavaScript for Automation" instead of AppleScript.
>Under OS X Yosemite and later versions of macOS, the JavaScript for Automation (JXA) component remains the only serious OSA language alternative to AppleScript, though the Macintosh versions of Perl, Python, Ruby, and Tcl all support native means of working with Apple events without being OSA components.
https://hackernoon.com/javascript-for-automation-in-macos-3b499da40da1 https://hackernoon.com/javascript-for-automation-in-macos-3b...
https://apple-dev.groups.io/g/jxa/wiki/JXA-Resources https://apple-dev.groups.io/g/jxa/wiki/JXA-Resources
https://github.com/JXA-Cookbook/JXA-Cookbook/wiki https://github.com/JXA-Cookbook/JXA-Cookbook/wiki
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. (Probably the world's first JXA script written in Literate CoffeeScript).
https://github.com/JXA-Cookbook/JXA-Cookbook/wiki/Examples#keynote https://github.com/JXA-Cookbook/JXA-Cookbook/wiki/Examples#k...
I wrote more about Frontier and other automation tools:
https://news.ycombinator.com/item?id=20425970 https://news.ycombinator.com/item?id=20425970
>The thing that's missing from "Google Docs" is a decent collaborative outliner called "Google Trees", that does to "NLS" and "Frontier" what "Google Sheets" did to "VisiCalc" and "Excel".
- hhas01 7y agoUnfortunately, 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.