2

I have an AppleScript script that is calling a shell command that I want to convert to JavaScript (JXA) but I don't see the equivalent of do shell script.

Here is the script using AppleScript:

#!/usr/bin/osascript

on run argv

    set convertScript to "export -i '" & first item of argv  & "' -o '" & second item of argv & ".csv'"

    do shell script convertScript

end run

My desktop application calls this script and then the script executes the shell command.

1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231
  • Similar question: https://stackoverflow.com/questions/28044758/calling-shell-script-with-javascript-for-automation – GDP2 Aug 15 '22 at 22:07

1 Answers1

4

It is possible using the following command:

var app = Application.currentApplication();
app.includeStandardAdditions = true;
return app.doShellScript('ls');

From here.

OrigamiEye
  • 864
  • 1
  • 12
  • 31
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231