Skip to main content
Participant
March 20, 2019
Question

Air NativeProcess space issue - starting terminal and passing arguments

  • March 20, 2019
  • 2 replies
  • 753 views

Hello,

I know this has been discussed some times - still I could not figure if there is a way without workaround to pass the arguments. I am on Mac OS X High Sierra.

I am starting Terminal.app with Native Process and need to pass arguments to Terminal.

This is what I am trying to push into the arguments array:

"/usr/bin/automator ~/Desktop/screenium-aut.workflow"

It is working when I am leaving out the args part after the space like this:

"/usr/bin/automator"

Some solution anyone without batch file?

This topic has been closed for replies.

2 replies

Legend
March 20, 2019

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

var file:File = new File("/usr/bin/automator");

nativeProcessStartupInfo.workingDirectory = new File("/usr/bin");

nativeProcessStartupInfo.executable = file;

var processArgs:Vector.<String> = new Vector.<String>();

processArgs.push("-i", "~/Desktop/screenium-aut.workflow");

nativeProcessStartupInfo.arguments = processArgs;

var process:NativeProcess = new NativeProcess();

process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);

process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);

process.start(nativeProcessStartupInfo);

public function onOutputData(event:ProgressEvent):void {

    trace(event.target.standardOutput.readUTFBytes(event.target.standardOutput.bytesAvailable));

}

public function onErrorData(event:ProgressEvent):void {

    trace(event.target.standardError.readUTFBytes(event.target.standardError.bytesAvailable));

}

ramraverAuthor
Participant
March 22, 2019

Thank you very much. I found a way but will try your code as well.

Inspiring
March 20, 2019

What's wrong with a batch file? That's literally the easiest solution.