by hhas · 4y ago · 0 comments
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
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.
--
No comments yet.