1 Reply Latest reply on Sep 24, 2010 9:18 AM by sleblang

    [AIR] NativeProcess - sending arguments to cmd.exe


      I have a similar problem to this post - http://forums.adobe.com/message/2898467#2898467, in that I am not receiving any communication/response from the command prompt.

      Microsoft Windows XP [Version 5.1.2600]
      (C) Copyright 1985-2001 Microsoft Corp.
      C:\Program Files\Adobe\Flash Builder 4>

      However, after reading the post, I am still unable to get it working. For simplicity sake, I am using a basic example just so that I can get it working. Here's my code:

                     protected var npsi:NativeProcessStartupInfo;
                     protected var nativeProcess:NativeProcess;
                     protected var file:File = new File("c:\\windows\\system32\\cmd.exe");
                     protected var args:Vector.<String> = new Vector.<String>;
                     protected function init():void
                          npsi = new NativeProcessStartupInfo();
                          npsi.arguments = args;
                          npsi.executable = file;
                          nativeProcess = new NativeProcess();
                          nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onError);
                     private function onError(event:ProgressEvent):void {
                          var process:NativeProcess = event.target as NativeProcess;
                          var data:String = process.standardError.readUTFBytes(process.standardError.bytesAvailable);
                          lbl.text += data;                    
                     private function onStandardOutputData(event:ProgressEvent):void
                          var process:NativeProcess = event.target as NativeProcess;
                          var data:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
                          lbl.text += data
      <s:Label id="lbl" fontSize="14" />