Is there a way to communicate with cmd (using native process) in adobe air.
As an example;
How to send “ping http://www.google.com” to cmd and capture the return values in Air.
Edit
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Program Files\Adobe\Adobe Flash Builder 4.5>ping www.google.com
Pinging www.l.google.com [209.85.175.103] with 32 bytes of data:
Reply from 209.85.175.103: bytes=32 time=1733ms TTL=50
Reply from 209.85.175.103: bytes=32 time=189ms TTL=50
Reply from 209.85.175.103: bytes=32 time=188ms TTL=50
Reply from 209.85.175.103: bytes=32 time=186ms TTL=50
Ping statistics for 209.85.175.103:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 186ms, Maximum = 1733ms, Average = 574ms
C:\Program Files\Adobe\Adobe Flash Builder 4.5>
I can print above from Air application. I need to know is there a specific way to grab the values of Minimum = ?, Maximum = ? and Average = ?
Planning to explode the string. Is there another way. Please help me
Thanks in advance.
You should read up on Interacting with Native Processes in AIR. What you write in the command prompt (
pingin your case) is another exe file located in a folder specified in the Windows Path. So you’ll actually have to invoke theping.exewith theNativeProcessclass in AIR. OR, you could study how the exe works and then implement that logic in your AIR application.EDIT
After you have edited your question, here are more details:
You use Regular Expressions (follow that link and learn about regular expressions)
Since you want to match this pattern
your regular expression will look something like