When using Application.currentApplication()
in an OSA script, it issues the following warning when running it from the command line:
warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
Why is this happening and what can be done about it?
Example
app.js:
#!/usr/bin/env osascript -l JavaScript
var app = Application.currentApplication();
app.includeStandardAdditions = true;
console.log('Hello, I’m ' + app.pathTo(this));
Shell Output:
❯❯❯ ./app.js
2015-03-01 12:39:29.611 app.js[65539:6266286] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
Hello, I’m /Users/aaron/Desktop/app.js