FWeinb / node-osascript

Use AppleScript from node
68 stars 9 forks source link

Error getting reply from applescript? #3

Closed rborn closed 9 years ago

rborn commented 9 years ago

Hi, I'm trying to open a file dialog, but when I choose the file I get an error

var osascript = require('node-osascript');

osascript.execute('set new_file to choose file', function(err, result, raw){
  if (err) return console.error(err)
  console.log(result, raw)
});

Result:

{ [SyntaxError: Expected "false", "true", "{", date, end of input, number or string but "a" found.]
  message: 'Expected "false", "true", "{", date, end of input, number or string but "a" found.',
  expected: 
   [ { type: 'literal', value: 'false', description: '"false"' },
     { type: 'literal', value: 'true', description: '"true"' },
     { type: 'literal', value: '{', description: '"{"' },
     { type: 'other', description: 'date' },
     { type: 'end', description: 'end of input' },
     { type: 'other', description: 'number' },
     { type: 'other', description: 'string' } ],
  found: 'a',
  offset: 0,
  line: 1,
  column: 1,
  name: 'SyntaxError' }

However, the native script works just fine:

$ osascript -e 'set new_file to choose file'
alias SSD:Users:Dan:Documents:avva_60.jpg

Am I doing something wrong? :blush:

Thank you

FWeinb commented 9 years ago

Will be fixed in 1.0.2 Thanks for reporting.

rborn commented 9 years ago

Great, thank you for the fast reply :)