Current Position:Home > Native process execution problem in mac os

Native process execution problem in mac os

Update:10-11Source: network consolidation
Advertisement
hi,
     In my flex application i have to get mac serial  number as a unique id for each system . On searching i got one terminal command to get serial number. For that i have  run terminal command through flex native process. I have set supportedprofile as <supportedProfiles>extendedDesktop desktop</supportedProfiles> in app xml. But when i install and run application on mac terminal is getting opened but command is not executing. I couldn't trace out the problem.  I could execute cmd in windows and that worked . Please help me to findout a solution................... The test code is adding below
private var process:NativeProcess
=
new NativeProcess();
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
                // TODO Auto-generated method stub
                if(NativeProcess.isSupported) {
                    Alert.show("Yes NativeProcess");
                    process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutput);
                    process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onIOError);
                    process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
                    process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
                    process.addEventListener(NativeProcessExitEvent.EXIT,onIOError);
                    var info:NativeProcessStartupInfo     =     new NativeProcessStartupInfo();
                    info.executable                               =     new File("/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal");
                     /*  var startupArgs:Vector.<String>    =     new Vector.<String>();
                         startupArgs[0]                              =    'system_profiler |grep "r (system)" '; 
                         info.arguments                              =    startupArgs;*/
                    //Alert.show(String(info.arguments.length));
                     process.start(info); 
                    process.standardInput.writeUTFBytes('system_profiler |grep "r (system)" '+ "\n");
                }else
                    Alert.show("No");
            protected function onIOError(event:IOErrorEvent):void
                // TODO Auto-generated method stub
                Alert.show("Error");
            protected function onOutput(event:ProgressEvent):void
                var processID:String            =    process.standardOutput.readMultiByte(process.standardOutput.bytesAvailable,"");       
                Alert.show("Path : " + processID );
I have tried to set arguments but didn't execute......
Message was edited by: aswathykrishnan

The Best Answer

Advertisement
Hello Aswathy, these days I'm also coding an application which uses AIR NativeProcess and I required to open the MacOS terminal with some parameter/commands. I also eventually turn to the AppleScript, but I considerably new to the AppleScript, yet trying to findout a way to passing parameters (the command argument) to the AppleScript; the appleScript I managed to open but not passing the argument. Can you please help? here's my some probable codes for the application:
My appleScript is:
#!/bin/bash
on run argv
          tell application "Terminal"
                    set currentTab to (do script) & item 1 of argv
          end tell
end run
I've packaged the appleScript as an Application (Contract.app) and here's my Flex code:
var npInfo : NativeProcessStartupInfo = new NativeProcessStartupInfo();
npInfo.executable = new File( "/Applications/Contract.app/Contents/MacOS/applet" );
                              var arg:Vector.<String> = new Vector.<String>;
                                  arg[0]="ssh [email protected]";
                              npInfo.arguments = arg;
                              process = new NativeProcess();
  process.start( npInfo );
Can you please help?
Thank you.
  • Native process execution problem in mac os Update:10-11

    hi,      In my flex application i have to get mac serial  number as a unique id for each system . On searching i got one terminal command to get serial number. For that i have  run terminal command through flex native process. I have set supportedpro

  • Execution of Java Native Process slow in Mac OS X Update:11-30

    Hi, I'm having some performance issues when executing an java native process on Mac OS X. I am developping an application in AIR that searches for people in the ldap of our organisation. It has to be usable both on Mac as on Windows. When I execute m

  • Problem with blocked native processes Update:10-11

    My application relies heavily on native processes so that I am trying to implement fallback strategies if a native process doesn't work as expected. While creating test scenarios I had a problem with handling errors caused directly by the start() met

  • Native Process Concerns on Linux and MAC Update:11-30

    I  have created an AIR application that has a feature to take screenshot  of the screen. I have used "senthil.jar" to support screenshot capture. http://sensaran.wordpress.com/2010/06/04/screen-shot-utility-using-air-2-0/ http://code.google.com/

  • Problem with AIR 2 Native Process? Update:11-30

    I had installed Adobe AIR 1 before and Flex Builder 3.0 (licensed) on a Windows Vista machine. Now i have installed AIR 2 framework (without uninstalling AIR 1, assuming that it will update that). I m trying to write a small code to use AIR 2 Native

  • HT4796 Migration process Setup problem on new MAC Update:11-30

    I just bought a MacBook Pro today and started the migration process as part of the setup and my PC suddenly shut down during the transfer process. Now the MAC seems hung on the Transferring Your Information screen and won't move.  How do I clear and

  • Creating native processes Update:11-30

    Hi, Runing SuSE Linux 8.0, java 1.4.0 I'm trying to create a native shell (I/O dumped into a JTextArea) woith java, the problem is that once I have invoked bash, it somehow manages to work out that its not running in a real console and behaves as if

  • Same Problem - Different Scenario: Encountering Problems running Mac OS X c Update:11-30

    Same Problem - Different Scenario: Encountering Problems running Mac OS X commands. Hi. I'm having a weird experience on opening document using the Microsoft word 2008 application in MAC OS X. To be specific on what is the scope of my application. Wh

  • Problem description: mac mail not opening, software updates not working, app store not opening. imac osx 10.9.5 Update:10-11

    Problem description: mac mail not opening, software updates not working, app store not opening. 10.9.5 EtreCheck version: 2.0.11 (98) Report generated 1 December 2014 16:51:49 CET Hardware Information: ℹ️   iMac (21.5-inch, Late 2009) (Verified)   iM

  • AD account Login problem with MAC 10.6.8 Update:10-11

    Hi All, We have around 50 odd MAC that are connected to windows server 2008 R2. the user were logining in to these MACs using their AD account. Recently few of the random MAC did not allow the user to login using their AD account.When analyzed though