node-osascript
node-osascript copied to clipboard
Error after Electron packager
Hi,
The module "node-osascript" works perfectly under dev mode into an Electron project (with the command line #electron .
), but after build it with electron-packager (with the command line electron-packager . MyProject --platform=darwin --arch=x64 --version=1.3.5 --overwrite
), the module fails. Any idea why?
This is the source code I use (works under dev, fails after packager):
var node_osascript = require('node-osascript');
var script = 'tell application \"Terminal\"'+"\n"+
' set newTab to do script'+"\n"+
'end tell';
node_osascript.execute(script, function(err, result, raw){
console.log('node_osascript result:');
console.log(result);
console.log(raw);
if (err) {
console.log('node_osascript error:');
console.log(err);
}
});
Console displays this:
node_osascript result:
null
Object {buffers: Array[0], length: 0}
node_osascript error:
Object {}
The same source code works after packager if the script variable is equal to:
var script = 'get volume settings';
My node version: v4.5.0 My electron version: v1.3.5
Sorry I have no idea what is happening there. Maybe there is some sandboxing involved?
After I run the electron-packager I have some issues with node-osascipt myself. I'm running a command that will return all existing calendars: "tell application "Calendar" \n set theCalendars to title of every calendar \n end tell" This is executed instant in dev mode, but after I packaged the app it takes like 30 seconds to run