155 points · by shawndumas · 8y ago · 77 comments
But the whole experience also left me sad about the Macintosh platform. Applescript is a hot mess of a language; it can be done in Javascript now, but that's largely undocumented. Thanks to poor accessibility of the technology, the support for scripting in apps is waning.
Automator, goodness, what a wild tool… but again, the documentation is horrible. Apple made two phenomenal technologies and then completely fumbled on the last mile.
The future of initiatives like Siri needs robust inter-app scripting. My only wish for the future of MacOS and iOS is a renewed push for this.
(okay, that and lock screen "complications")
There are also many idiosyncrasies due to how scripts are run by the AppleScript component manager and state may or may not be maintained between execution depending on whether the script has been compiled on the local machine, is run inside AppleScript Editor, is run in a particular version of AppleScript Editor, which version of AppleScript is on the local machine, etc. etc. [0]
Apple's official documentation is helpful, but the real documentation for AppleScript developers (I feel AS is feature complete enough that its practitioners can be regarded as developers) is Matt Neuburg's AppleScript: The Definitive Guide (from which the earlier citation comes). [1]
If you've puzzled over how to get something working properly in AppleScript and have been amazed at how indispensable AppleScript can be to generate a custom workflow using macOS applications, the command line, and your favorite programming language behind the scenes (Perl, JavaScript, Objective-C, etc.), you really cannot do yourself a bigger favor than getting a hold of Neuburg's book.
[0] https://books.google.com/books?id=x5AE8cxocdAC&pg=PA76&lpg=P...
[1] https://www.amazon.com/AppleScript-Definitive-Guide-Matt-Neu...
EDIT: remove extraneous word. Add period. Change “Applescript” to “for Applescript developers”
Basically made it work well enough for a few things that ship on a default OS X install and stopped.
npm integration was an absolute must-have to ensure popular adoption; even I could see this straightaway. Alas, as last Apple bastion of Not Invented Here, the Mac Automation team insisted on rolling everything themselves.
All problems I told Sal about before JXA ever shipped. Told him about lots and lots of problems, which he pretty much ignored. Even wrote and sent him a quick-n-dirty JavaScript OSA implementation (https://sourceforge.net/projects/appscript/files/), by which time the man didn’t even have the common manners to say “thanks but no thanks”. A charming chap who talks great game, but a thin-skinned martinet.
There was no technical reason JXA could not have been 99.9% as good as AppleScript at application automation, and a million times better at everything else. 100% PEBKAC.
That's a really good point. Siri would have enormously benefited from a robust, powerful automation ecosystem. Even if they don't use it directly it could have been the base for all Siri actions and the distance from automation to Siri would be much smaller than going all the way to Siri from where we are now. Apple missed a big opportunity.
The great irony is that unlike painfully tedious low-level object-oriented API/IPC systems like DOM, CORBA, and SOAP, the Apple Event Object Model (the IPC architecture used in “AppleScriptable” applications) is driven via RPC using simple, high-level relational QUERIES. VERY powerful, amazingly (when it works right) elegant.
Apple event IPC has its issues—inconsistent implementations, notoriously inadequate interface descriptions, and a security model rocking it like it’s 1995—but it’s still remarkably close to being Siri-drivable, and has the massive benefit that it’s already implemented in hundreds of apps and is free for the taking.
(Or would be, if Apple hadn’t left Sal to run it into the ground.)
..
Not coincidentally, I put together a proof of concept for a hybrid Logo/AppleScript replacement a couple years back, designed from the start not just to enable traditional text entry, but also to be skinnable in a Workflow-like GUI or even driven by voice. Other commitments got in the way, but POC files are here:
https://bitbucket.org/hhas/entoli/src/master/README.txt
Key USP: true whitespace support in command names, making them very easy for non-programmers to read and write, particularly with modern autosuggest+correct+complete assistance (command interfaces are fully introspectable too).
Add Apple event capabilities (https://bitbucket.org/hhas/swiftae/src/master/) and wrap some friendly end-user tools around it, it’d be very powerful indeed.
Classic turtle example:
Turn right 135°, pen down, move forward 2.5mm, turn left 90°, move forward 20cm, pen up.
Named “entoli” (phonetic Greek for “instruct” or “command”) in HT to Seymour’s Logo, but also nicknamed “SiriScript” for fairly obvious reasons. :)It’d be an awesome way to contribute to the community and I’m sure it would look great on a resume
The JXA that shipped in 10.10 was a defective half-baked POS that was immediately abandoned to rot. Even if contributors knew enough about JXA and application scripting to produce quality documentation, who’s going to read all these new JXA docs when it’s already failed to win any users after 4 years on the market?
I lead-authored Apress’s Learn AppleScript 3rd ed, so know just what a Hell it is to get right. And I desperately wanted to do THE book on Automating your Mac with JavaScript—cos I knew JXA’s success or failure would decide the future of Mac Automation. (Also, MILLIONS of JavaScript users == 100,000s of book sales!:) But I simply couldn’t write a usable book about unusable shit.
So don’t waste your time.
Mac Automation as we know it is already dead; it just hasn’t stopped twitching yet.
He was obviously a brilliant guy, so I find it strange he couldn't have had a good fit anywhere in the company.
In recent years they've added JavaScript bindings which solves the syntax and editor problem. But most documentation is still presented for AppleScript coders so you have to mentally translate what you want to the AS first and then to JS, so it's still basically useless without extreme mental energy. And good luck debugging.
But, Applescript was always just an implementation detail. The underlying Open Scripting Architecture has always worked with multiple languages.
Although in this case I think the rot started much earlier with the abandonment of HyperCard under Jobs 2.0. I remember in the 90s many small business built their own HyperCard stacks to run the business and it made a lot of people Mac owners even in the dark days of 92-97. Imaging having the same system today available across the platform, especially on the iPad. You can see the shoots of the idea there in the form of Playgrounds, Workflow etc but they need to think much bigger.
William Cook and Warren Harris were the Apple programmers who created AppleScript:
www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
Sal Soghoian was the Product Manager hired years after they left who ran AppleScript into the ground.
Great man.
Happens at 9:55
AppleScript has always been powerful at the great expense of being a pain to implement. And it has a sort of Visual BASIC kind of dependency among longtime Apple customers (probably why it never dies entirely).
When I abandoned AppleScript and switched to Python bindings, one of my reasons was that I wanted a more standard language with access to useful libraries. Swift could be that now...
Swift is rubberized C++; an Apple engineer’s vanity project made good; a second-rate development language for Cocoa development, and a pedagogical joke as far as kids are concerned. If Tim thinks SP is going to save Apple’s ed markets from being eaten by Chromebooks, he’s even less fit as a CEO than Stephen Elop.
..
As to AppleScript, the pain for App developers was always in how to design and implement a robust, powerful, and user-friendly query-driven UI on top of their app, without Apple even telling them it was query-driven (not OO); never mind giving them a robust, powerful, and developer-friendly framework in which to build it.
Still a non-trivial technical challenge, mind (just ask SQL/RDBMS engineers), but Apple could’ve still made it a lot less painful (i.e. better docs and support) and a lot more worthwhile (i.e. tons more users). Make it worth programmers time financially and/or personally, and they’ll crawl over broken glass to do it. But Apple mismanaged AppleScript almost from the start: pissing off its key designers so they walked out, taking all their knowledge with them, and then downhill from there.
And as for all the popular languages that Sal _could_ have won over to Mac Automation, along with their millions of users for whom it should’ve been 100% pure Catnip for Geeks:
* Python (appscript, 2005—hey! have we met?)
* Ruby (rb-appscript, 2006)
* Objective-C (objc-appscript, 2007)
* JavaScript (“JavaScript OSA”, 2014; NodeAutomation, 2017)
* Swift (SwiftAutomation, 2015)
I wrote production-quality Apple event bridges for every one of the above, and tested, used, and supported most of them too. (We still use Python3+appscript ourselves—the stuff it can do is phenomenal.) And in the end I buried them all too, after Sal’s team, thinking they knew everything, stuck their own broken-ass garbage in Mac OS X and stunk those markets out. Part of which is my bad for being an utterly useless salesman; but mostly it’s on Sal for being such an arrogant ignorant and/or downright incompetent Product Manager for 20 years; and on Apple for not sacking his ass years sooner, before he ran Mac Automation into the ground for good.
Good times.
Since corporations are people, this one is a cold hearted bitch.
Corporations expect unwavering loyalty from employees to the point of sacrificing their personal lives, only to be cut off from the company, with perhaps a 'fat severance' check.
To me that seems unfair. If the company has the right to abruptly cut off the worker, the worker should have the right to abruptly cut off his work at the end of the workday.
Somehow, in the US, such workers demanding fairness from companies are ostracized.
It no longer alarms anyone, no longer seems wrong to anyone that worker rights, which are the bedrock of a fair and just society, are being eroded right before our own eyes.
I don't advocate for socialism, but unchecked capitalism will lead to a fragile society, rife with periodic revolutions and collapses.
Lack of empathy for workers and the masses is the true cancer of democracy.
> Lack of empathy for workers and the masses is the true cancer of democracy.
...what? This is such a incredible weird statement - like, dictators are more empathetic for the workers? You kinda propose socialism (while sounding like nobody should touch it with a ten foot pole) but not in a democratic manner? Might I point towards the EU, where the problem we're talking about is non-existent and also it's a democracy with socialist elements...?
------------------------------------------
Evening Wired,
Well, that story was a bit of a hot mess. Wrong title, buried lede (Workflow! WWDC!), unfocused and confusing. At least until compared to one of my screeds—enjoy!
has
--
1. Who’s the “One Apple Programmer [who] Got Apps Talking to Each Other” of your title? ’Cos it’s definitely not Sal Soghoian. Sal’s not, and never was, an “Apple Programmer”. He was an amateur AppleScript user and early evangelist, who lucked his way into his management job at Apple several years after Apple broke up the original AppleScript team. (More about Sal later.)
The Apple programmers who led the creation of AppleScript were William Cook and Warren Harris, who in turn were building on the HyperTalk language Bill Atkinson previously created for HyperCard and the Apple event IAC (Inter-Application, or Inter-Process, Communication) architecture then being developed for Apple’s first true multitasking Mac OS, System 7. Conceived around 1989, development started in ’91 and shipped in ’93, initially as a Pro extra, then as a standard feature from 7.1 on. Then Apple management gutted their department, reassigning half the team “to get OpenDoc ready to throw away” [as one internet wag drolly put it], and Cook and Harris quit in response. That the suddenly-orphaned infant AppleScript survived at all is a testament to its remarkable virtues; that using it causes as much hair-pulling as joy may be largely due to the subsequent lack of toilet training.
Dr Cook documented the full early history of AppleScript’s creation in the following paper:
www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
Invaluable insights for anyone who wants to understand why Applescript was created and how it interacts with Mac desktop applications. (Hint: Unlike traditional object-oriented messaging systems—CORBA, DCOM, Distributed Objects, SOAP, etc—Apple event IPC uses RPC plus simple relational queries, more akin to SQL. VERY powerful, very user-oriented. Ubiquitously misunderstood.)
..
2. I’m going to speculate here that Apple will announce a new cross-platform automation strategy at WWDC next week, built on the Workflow app and team they bought in a couple years ago; hence the timing of this article. In which case, you really should’ve made the hot new Workflow App and its ambitious team of indie creators the centerpiece of your article; not some old failed automation product manager whose old failed automation products are about to be ousted.
As to Workflow itself, if/when it ships, no doubt there will be much fanfare and many claims that it’s the greatest innovation since sliced bread, but the truth is: it’s weak sauce at best; a gilded cell at worst. There is a vast history of end-user computing and computer education for explorers and innovators to draw on; far too long to get into here, but TL;DR: Papert was Right. Workflow, Automator, Scratch, Windows Workflow Foundation, et al are works of evangelical techies who think the way to evangelize their idea of “programming” to #OrdinaryPeople is to slather some lickable lipstick on their beloved pig and present it as “Programming for the Rest of [You]”. Whereas ordinary people would think, “WTF would I ever want to lick a pig?”, and work from there.
Papert demonstrated decades ago(!) that the right way to make computing accessible is to shape the language to fit its users; and the right way to do that is to give users the power to grow and shape that language by and for themselves, by growing its basic vocabulary with their own words and phrases for expressing the ideas and behaviors that interest them.
In other words: don’t hand the user a predetermined set of tools to use, but rather give her the tools she needs to make her own tools to use. Workflow, Scratch, &co don’t merely fail to empower users this way; they don’t even try at all. The resulting software may be a glitzy, seductive App that provides a lower barrier to entry than “Real Programmer” languages, but with an extremely low, immovable ceiling too. Papert’s Logo derived from Lisp/Forth for a reason: that stuff scales. Today’s mainstream programming world knows and thinks in “C”, which does not.
..
[cont…]
3. And now back to good old Sal, cos after 20 years I still absolutely adore Mac Automation—and absolutely fume at what that twit’s done to it:
“In October of 2016, he was let go from Apple after a nearly twenty-year stint at the company. No warning, no early signs. Apple just said his position didn't exist anymore. It's been thirteen years since Automator debuted on the Mac, and Soghoian's biggest champion at Apple, Steve Jobs, is gone.”
Oh Man, where to start?!
Obvious point: Having Steve Jobs one time say to you “that’s a great idea” does not him your “biggest supporter” make (as many an ex-Apple employee will attest). Yeah, Mac Automation caught Steve’s eye once or twice (as it should—there’s some incredible power in that mess), but Sal failed to parlay it into anything more.
.
“No warning, no early signs”? That’s funny. I warned Sal in 2015 that he was running Mac Automation into the ground. After years of watching his department ship badly designed, largely untested, poorly documented software, then promptly ignoring it once it was the door, it was obvious as hell to me. The man was—and still is—a charming end-user evangelist, but he couldn’t manage a pissup in a brewery; and I’m quite sure even Apple could see this. As with any large organization, 2000s Apple had little need to prune the deadwood that inevitably amasses while business is good. But once growth slowed and stuttered, it was only a matter of time till the surplus/underperforming employees were shown the door.
Sal was hardly the only employee purged; and had he being doing his job right he’d still be there! Create successful products that win new users and build new markets? Not a hard job description to understand, but Sal’s 2005-2011 tenure was mostly punctuated by mediocre-to-poor product releases that almost no-one subsequently ever heard about or used. Ironic that someone who made his reputation as a talented evangelist would, once promoted, lose the ability to promote or support his own products, or (even better) encourage his user communities to do the promotion for him. His title may have been “product manager”, but I don’t think he was ever a strategic planner or natural delegator, and I know from firsthand experience that he doesn’t take critical feedback well. Peter Principle much?
By 2012, with Automator having failed to grow market or mindshare and the the aging AppleScript market gone stagnant, I was publicly estimating the end of the AppleScript platform in another 5-10 years. When Apple presented JavaScriptCore at WWDC13 as a developer-friendly alternative to AppleScript/OSA for cross-platform embedded App scripting support, I could already hear the nails going in its coffin. Then, TOTAL SURPRISE: Sal’s team somehow managed to steal JSCore from the WebCore folks, and turned it into JavaScript for Automation (JXA), a full peer to AppleScript with just one difference: several MILLION existing JavaScript users already out there, ripe for the taking.
Just one problem: when Sal &co. unveiled JavaScript for Automation at WWDC14, it wasn’t close to finished, never mind working right. Having a decade’s experience in designing, building, using, and supporting AppleScript-quality scripting bridges out in the real world, so immediately offered Sal every assistance to get JXA ready to ship. I took six weeks out from my day job to test and critique the tar out of JXA while they were rushing to add all the missing bits, and even quickly made them a reference JavaScript OSA implementation to learn from (or steal). All I asked up-front of Sal was that he cover the cost of the developer account so I could download prerelease builds, and that he not waste my time. Knowing JXA’s success or failure would make or break Mac Automation, I was absolutely happy to give it, and he sounded absolutely delighted to accept it. What’s more, having lead-written the last edition of Apress’ “Learn AppleScript” book a few years earlier, I was also in the perfect position to get a “Learn JavaScript for Automation” out the door inside the year, and win him his market of JavaScript Automation users without him even having to lift a finger.
And Sal took this fantastic market opportunity that his employer entrusted him with, and cratered it. After the first few weeks sending him detailed descriptions of JXA’s numerous design and implementation defects, he simply stopped responding to me—presumably cos I kept telling him what he needed to hear instead of what he wanted to hear. When JXA shipped in Mac OS 10.10, it was flawed, buggy, unfinished software that simply wasn’t fit for purpose. Worse, as soon as it was out the door, Sal promptly abandoned it too. No bug or missing feature fixes, no community support; no proper user manual for existing JavaScripters to learn how to use it; and sod all marketing and evangelization, of course. Not even a public reassurance to early adopters that these issues would all be addressed for 10.11. Nothing.
One Million New Users.
That’s my blind estimate of what Sal Soghoian’s mismanagement cost Mac Automation, and thus his employer. So, no, I’m not surprised they sacked his ass. Only wish they’d done it years sooner, when AppleScript and its remarkable end-user Automation ecosystem was still healthy enough to save.
.
Ironic too, as Apple’s Siri continues to flail around looking for something useful to do (other than selling Amazon Alexa and Google Assistant instead), that Apple should all this time be sitting on the largest and most capable and mature user-query powered automation infrastructure in the personal computing world, and still can’t figure how to put 1 and 1 together.
“It used to be easy when we were 100 times better than Windows. But now that we're not, you don't know what to do.”
I miss those Jobs years too. Amazing times, many incredible lessons. Sadly, increasingly unlearnt.
In addition to creating high-end AE-driven automation systems for current and previous employers, I’m also responsible for:
- appscript.sourceforge.net (Apple event support for Python, Ruby, ObjC; plus JavaScript OSA component); Apple even considered Python and Ruby appscript for Mac OS 10.5
- bitbucket.org/hhas/swiftae (Apple event support for Swift)
- bitbucket.org/hhas/nodeautomation (Apple event support for Node JS; wrote it in a week just to prove a point)
- www.apress.com/gb/book/9781430223610 (tech editor on 2nd edition; lead author on major update for 3rd)
A cross platform, OS, processor agnostic equivalent of Apple script should do well in today's world
The technology behind it was (and still is) amazing. I'm not aware of anything in any other major operating system that even comes close.
> who then went on to "invent" callback URLs
No, that was Greg Pierce. Soghoian was still at Apple at that point.
ARexx on AmigaOS was pretty similar and shipped first (1990).