Javascript for Automation - equivalent of do shell script

I started experimenting with converting some scripts from AS to JSfA and quickly ran into an issue. JS coming from a web browser environment doesn’t (AFAIK) have a native way to call system commands, for obvious security reasons…but these are useful if not necessary for automation scripting applications.

Has anyone found as JSfA equivalent of Applescript’s “do shell script”?

I realize this is really a JSfA question but there isn’t a forum here (yet!) for that.
thx

Hi,

don’t reduce Javascript to web browser environment. It’s much more.
Including Standard Additions is just a bit different from the familiar syntax


app = Application.currentApplication()
app.includeStandardAdditions = true
app.doShellScript('whoami')

Thanks…I was messing around with the Cocoa bridge and NSTask but this is much better.