Copy link to clipboard
Copied
Is there a way to get a value back?
As per my understanding for your need, you can not directly return any value, But still you can full fill your need by declaring a variable before calling another script using app.doScript and pass this variable and in another file store result in that variable and when execution of script finishes you can get that result through that variable.
Best
Sunil
Copy link to clipboard
Copied
This works for me:
alert(app.doScript("1"));
Copy link to clipboard
Copied
Yep same here…
var appScr = 'return \"This String…\"'; alert(app.doScript(appScr, ScriptLanguage.APPLESCRIPT_LANGUAGE));
Copy link to clipboard
Copied
As per my understanding for your need, you can not directly return any value, But still you can full fill your need by declaring a variable before calling another script using app.doScript and pass this variable and in another file store result in that variable and when execution of script finishes you can get that result through that variable.
Best
Sunil
Copy link to clipboard
Copied
Unfortunately, passing of variables only works for doScript calls outside any function. But at least on Mac platform, text returned from an AppleScript is forwarded by doScript, as suggested by the previous answers.