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

1 Answer 1

5

It is possible using the following command:

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

From here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.