3 ms·
AppleScript’s dialects trick was clever, but many app developers didn’t have budget to localize their GUIs, never mind their scripting interfaces as well. Nowad
by hhas 4y ago
AppleScript’s dialects trick was clever, but many app developers didn’t have budget to localize their GUIs, never mind their scripting interfaces as well. Nowadays, with automated translation tools fast improving, localizable scripting languages should be, if not the norm, then at least the next-generation ground breakers.
Anyway, once OS X came along, a programmer dialect for AS would’ve been unnecessary as Mac OS X included the massively popular Perl, Python, Ruby languages as standard. Apple’s priority then should’ve been to put AppleScript-quality app scripting support[1] into those languages too, but as I noted upthread the Mac Automation team utterly wrecked that.
…
Here’s a working, testable example of your query:
tell application "TextEdit"
tell document 1
get first character of every word whose font is "Helvetica-Bold"
end tell
end tell
And here’s your filtering example, done right, in Node.js[2]:
#!/usr/bin/env node
const {app, its} = require('nodeautomation');
const textedit = app('TextEdit');
let doc = textedit.documents[0];
let ref = doc.words.where(its.font.eq('Helvetica-Bold')).characters.first;
console.log(ref.get());
// => [ 'b', 'b', 'k' ]
…
Cook’s paper is a terrific read, btw: a true lightbulb moment. ’90s Apple management were ranking idiots for driving Cook and Harris off. Here a video of them discussing their work and its goals back in happier days:
https://www.youtube.com/watch?v=1MaHJ_mzrTU https://www.youtube.com/watch?v=1MaHJ_mzrTU
Both authors tragically passed in recent years too, still young. It is a shame that their amazing if imperfect work is probably not far behind now. They deserved far better.
--
[1] https://appscript.sourceforge.io https://appscript.sourceforge.io
[2] https://www.npmjs.com/package/nodeautomation https://www.npmjs.com/package/nodeautomation