wtfaremyinitials / osa2

Interact with Apple's Open Scripting Architecture in node.js
67 stars 4 forks source link

stdlib not found on macOS Mojave Beta (18A293u) #2

Open acenqiu opened 6 years ago

acenqiu commented 6 years ago

execution error: Error on line 2: Error: nothing found to import (-2700)

Possible workaround:

ObjC.import('Foundation')
var fn   = (${fn.toString()})
var args = JSON.parse(ObjC.unwrap($.NSProcessInfo.processInfo.environment.objectForKey("OSA_ARGS")))
var out  = fn.apply(null, args)
JSON.stringify(out)
dnicolson commented 4 years ago

Ironically $.NSProcessInfo is undefined in the Big Sur betas and doing the reverse works: https://github.com/JXA-userland/JXA/pull/24.