Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Use Javascript

You can use Javascript for automating tasks on OSX/MacOS, like you used to be able to do with AppleScript.

Here is a basic example:

#!/usr/bin/osascript -l JavaScript

console.log("hello world");

If you do chmod 755 helloworld.js, where helloworld.js is a file with the above script as contents you can the do the following:

$ ./helloworld.js

This does however not really demonstrate the integration with OSX/MacOS.

#!/usr/bin/osascript -l JavaScript

currentApp = Application("Reminders");
currentApp.includeStandardAdditions = true;


var list = currentApp.defaultList();
var str = '';

for (i = 0; i < list.reminders.length; i++)
    var r = list.reminders[i];
    if (r.completed() === false) {
        str = str + ' ' + r.name() + "\n";


This script list all unfinished reminders from the default list.

Do note that this script is incredibly slow, I have no idea, whether this is my implementation, since I am a Javascript n00b, or whether it is the integration.