Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:30:57+00:00 2026-05-22T18:30:57+00:00

I have a GUI using Flex. I have a condition like i need to

  • 0

I have a GUI using Flex. I have a condition like i need to execute some command line arguments in the local machine and get the results back or output back to a textbox area. How can i do a button on submit, execute command in the local machine and return the output?

Command to execute example: 

    echo logfile.log | grep username

Code:

button1.onRelease = function () 
{
    // in this computer, it will now run a command, please wait.
}

My reference from the answer: https://gist.github.com/993905

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:30:58+00:00Added an answer on May 22, 2026 at 6:30 pm

    You’re not going to be able to do this using actionscript 2 and you’re not going to be able to do this using actionscript 3 in the flash web player. There are certain tools you can use to create projectors using actionscript 2 and 3 to add this kind of extended capability but you cannot simply do it from the web, as of course this would be an extreme security risk.

    However, you can do this with Adobe AIR 2.0 or greater. You use the NativeProcess class and detect the operating system, launch the terminal or cmd.exe and then you can run commands against it. Below is some code from a project I developed to run commands against the OS using AIR just as you’re trying to do:

    private var os:String;
    private var consoleExecutable:File;
    private var consoleNativeProcess:NativeProcess;
    
    private function usbMounted(e:StorageVolumeChangeEvent):void 
    {
        //status.appendText('Device: ' + e.storageVolume.name + ' mounted to drive: ' + e.storageVolume.drive + '\n');
        
        os = Capabilities.os.substr(0, 3).toLowerCase();
        
        switch (os) 
        {
            case "win":
                //Windows OS
                var rootDirs:Array = File.getRootDirectories();
                
                var i:int = 0;
                for (i; i < rootDirs.length; ++i) {
                    consoleExecutable = rootDirs[i] as File;
                    consoleExecutable  = consoleExecutable.resolvePath("Windows");
                    if (consoleExecutable.exists == true) {
                        consoleExecutable = consoleExecutable.resolvePath("System32");
                        consoleExecutable = consoleExecutable.resolvePath("cmd.exe");
                        i = rootDirs.length;                                    
                    }                   
                }
                
            break;
            
            case "lin":
                //Linux OS
                
            break;
            
            case "mac":
                //Mac OS
                
            break;
            
            case "iph":
                //Iphone OS
                
            break;
        }   
    
        var consoleNativeProcessStartupNfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
        consoleNativeProcessStartupNfo.executable = consoleExecutable;
        var startupArgs:Vector.<String> = new Vector.<String>();
        
        startupArgs.push('/C fsutil fsinfo volumeinfo ' + e.storageVolume.drive + ':');
        
        consoleNativeProcessStartupNfo.arguments = startupArgs;         
        consoleNativeProcess = new NativeProcess();
        consoleNativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, consoleOutput);           
        consoleNativeProcess.start(consoleNativeProcessStartupNfo);         
        consoleNativeProcess.closeInput();
    }       
    
    private function consoleOutput(e:ProgressEvent):void 
    {
        var consoleOuput:String = consoleNativeProcess.standardOutput.readUTFBytes(consoleNativeProcess.standardOutput.bytesAvailable);
        
        switch (os) 
        {
            case "win":
                //Windows OS
                
            break;
            
            case "lin":
                //Linux OS
                
            break;
            
            case "mac":
                //Mac OS
                
            break;
            
            case "iph":
                //Iphone OS
                
            break;
        }
        
        consoleNativeProcess.exit();
    }
    

    So the code should be pretty straight forward. It might not all be there as I’ve just copied the portion of the code dealing with the native process startup, output and termination. I then deleted parts of the code that were sensitive. Basically you’re just getting the OS info, navigating to the path of the executable, check to see if it exists and if so, start it up, run a command against it and wait for output. I put in a switch statement to check the OS when handling the output as well, since it’s safe to assume what you do next with the output will also be OS dependent (or at least in my case it was). If you need more help understanding all this I suggest googling for a tutorial on the Adobe AIR Native Process API or just post some more questions here. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GUI application written in C/C++ using gcc. I need some recommendations
I have a Flex GUI which is using AMF Streaming to BlazeDS on WebLogic
I have developed a GUI using ASP.NET 3.5 and C#.... Now at some places
I have an assignment to create a GUI using MATLAB GUIDE and am having
I have a Windows GUI application that's using the Qt framework (currently version 3.3.5,
We have a fairly complicated GUI in windows forms using C# and .Net 2.0.
I am using GridLayout in my SWT GUI app. I have the following GridData
I am using swing to create my GUI. J have a JFrame containing one
I'm using Visual C++ 2008, SP1. I have a QT app (gui, .exe) in
What java GUI layout manager does everyone use? Lately, I have been using MigLayout

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.