Highlighted

Air NativeProcess space issue - starting terminal and passing arguments

Community Beginner ,
Mar 20, 2019

Copy link to clipboard

Copied

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?

TOPICS
Development

Views

452

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Air NativeProcess space issue - starting terminal and passing arguments

Community Beginner ,
Mar 20, 2019

Copy link to clipboard

Copied

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?

TOPICS
Development

Views

453

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 20, 2019 0
Advocate ,
Mar 20, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2019 0
Engaged ,
Mar 20, 2019

Copy link to clipboard

Copied

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));

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2019 1
ramraver LATEST
Community Beginner ,
Mar 22, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 22, 2019 0