Devonian Times Masthead

The DEVONtechnologies Blog

How to Use JavaScript for Automation

October 5, 2021 — Eric Böhnisch-Volkmann
Example JavaScript code automating DEVONthink.

For most of us, automation on the Mac means AppleScript. It’s the scripting language that Script Editor uses when you create a new script and what most Mac apps accept when they offer scripting capabilities.

What few people know is that it’s also possible to automate applications with JavaScript. JavaScript for Automation (JXA), introduced in OS X Yosemite, is a JavaScript interface for the automation architecture on which also AppleScript is built. It makes almost all functionality that is accessible through AppleScript also available to JavaScript.

So if you already now how to write JavaScript or AppleScript’s unusual syntax scares you off, JXA might be for you. To get you started, our community user @chrillek has created a great web page about JXA and how to use it: Introduction to JXA. Of course he also has a extra chapter about how to automate DEVONthink from JavaScript.

Thank you, @chrillek, for this great ressource!