You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.
Fixed. For future reference on anyone trying to do this using Node AppleScript, my problem was using execString instead of execFile, and I was able to see my issue mostly in this repo: https://github.com/linclark/omnifocus-github. Here's a quick example for anyone doing a node app.
#!/usr/bin/env node
var applescript = require('applescript');
var sleep = require('sleep');
var temp = require('temp');
var fs = require('fs');
temp.open('your-file-name', function(err, info) {
if (err) {
return;
}
var script = '';
script += 'var of = Application(\'OmniFocus\');';
script += 'var inbox = of.defaultDocument.inboxTasks;';
script += 'var task = of.InboxTask({name: "testing"});';
script += 'inbox.push(task);';
fs.write(info.fd, script);
fs.close(info.fd, function(err) {
applescript.execFile(info.path, ["-lJavaScript"], function(err, rtn) {
if(err) console.log(err);
});
});
});
Having trouble loading the library, consistently getting an error.
Complied script placed here: https://cloudup.com/chgGvgXxRo0
Node app creating script here:
var script = "of = Library('OmniFocus');"
Getting this error:
err { [Error: 0:2: syntax error: A “of” can’t go here. (-2740) ] appleScript: 'of = Library(\'OmniFocus\');', exitCode: 1 }
The text was updated successfully, but these errors were encountered: