3 Replies Latest reply on Dec 16, 2010 3:24 PM by jordana309-36

    Showing a newly started NativeProcess

    jordana309-36

      I have a complex terminal program that I need to start from AIR, and I need the terminal window visable and separate from my air window. Thus, the easiest thing (in my mind) would be to just make the terminal window visible, but I can't find any way to access the nativeWindow object or any other visual property of the process to do this. How can I make a newly created NativeProcess visible after I send the command process.start(nativeProcessStartupInfo) ? I might add that I'm using Javascript to do this stuff, not FLEX.

        • 1. Re: Showing a newly started NativeProcess
          Hasan Otuome Level 1

          Well, NativeProcess is not a display class so that's why you're having

          trouble finding a way to access a nativeWindow object.

           

          It does however, allow you to monitor STDIN and STDOUT. So, you can launch a

          separate window with the GUI necessary to display the progress of your

          process in realtime.

           

          Assuming you added a response handler to your process to handle output,

          input and error events, you could trap STDOUT and print it to  the screen

          via your custom GUI:

           

          /**

           

          • Handles responses from the NativeProcess bridge.

           

          • @param e

          */

          private function _onNativeProcessResponse( e:ProgressEvent ):void

          {

          // use this w/your custom terminal GUI

          var stdOut:String = process.standardOutput.readUTFBytes(

          process.standardOutput.bytesAvailable );

          }

           

           

          P E A C E

           

          Hasan

           

           

          On Fri, Dec 10, 2010 at 4:02 PM, jordana309-362147823521

          1 person found this helpful
          • 2. Re: Showing a newly started NativeProcess
            commadelimited Level 2

            I would think you could just call a shell script from AIR using the NativeProcess API mentioned by Hasan. That would open the Terminal window for you.

            • 3. Re: Showing a newly started NativeProcess
              jordana309-36 Level 1

              I tried that, but I don't think I did it correctly. In retrospect, I think capturing it in the application might be a little better. But, when using STDIN and

              STDOUT listeners, I only am able to pass in one command, and then both of them stop being responsive. Are there examples I could reference for how to dynamically control input and output of a program multiple times, like passing arguments and commands through to a CMD and showing everything it ECHOs in a textbox in my app?

               

              [EDIT] It simply will not allow me to start another file (I have to call a batch file through that CMD instance started by AIR, and it won't allow the call).

               

              [EDIT] Ah. I didn't keep the directory changed here. I just had to CD in my first batch file, and then change how it called all other batch files and then this worked great. I actually have AIR execute a batch file with the following code:

               

              @ECHO OFF


              REM Global Variable declairation

              SET appRoot=%USERPROFILE%\Desktop\DEV FOLDER\Program Folder

              SET appTempPath=%USERPROFILE%\ProgramName

              SET startString="%appRoot%\Subfolder\EncodingBaseBatchFile.bat" "%appRoot%" "%appTempPath%"

               

              START CMD /C "%startString%"

               

              This allows me to see the window, and works alright. However, I lose control of the input, and can no longer show that in my terminal. Ideas? Nevermind...I'll post that question as a new thread.

               

              Thanks, you guys!

               

              Message was edited by: jordana309-362147823521