node-osascript icon indicating copy to clipboard operation
node-osascript copied to clipboard

Error after Electron packager

Open kcampion opened this issue 7 years ago • 2 comments

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

kcampion avatar Sep 06 '16 19:09 kcampion

Sorry I have no idea what is happening there. Maybe there is some sandboxing involved?

FWeinb avatar Oct 19 '16 18:10 FWeinb

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

alexrus avatar Jan 06 '17 12:01 alexrus