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;
currentApp.activate();
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";
}
}
console.log(str);
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.