JavaScript for Automation Cookbook
JavaScript for Automation is a new thing in Mac OS X Yosemite. It allows you to control applications using JavaScript language. How awesome!
However, its documentation covers the basics of using JavaScript to interact with the Open Scripting Architecture. For many tasks in scripting, there's a lot to figure out, and many different documentations to refer to.
So I created this JavaScript for Automation cookbook that features a lot of examples, such as:
- How to display alert, prompt and confirm dialogs.
- How to run shell scripts.
- How to create a command-line script (shebang script) and read
argv
arguments, how to create a Mac OS X service, or how to invoke the REPL. - How to use Browserify to be able to require npm modules in JXA.
Where it makes sense, I try to link to the official documentation as much as possible so you can dive deeper.
For ease of editing and contribution, the cookbook's contents are on the wiki.