I develop an AIR application. I want when I press the open button it open the text file with notepad++ which I specify as ("C:\Program Files\Notepad++\notepad++.exe") or with any other application I provide. Also Can I specify the command line arguments for application. Thanks
Asked
Active
Viewed 882 times
1
-
Is it ever possible to launch something else from Flash? – Vesper Mar 27 '13 at 08:12
-
1See http://stackoverflow.com/a/1922487/40064 – Wim Deblauwe Mar 27 '13 at 08:25
-
1The answers are yes to both as Wim's link shows the first, if you dig into the documentation on NativeProcess and related parts you'll see you can also pass arguments to a command relatively easily. I attempted to build a wrapper for the command line using this, it worked for some things but ran into difficulties attempting to do things like tab completion or using the up-arrow for history. Anyhow was a fun project lets me write quick "batch" scripts and execute them all in a custom GUI. – shaunhusain Mar 27 '13 at 08:58
-
1This also could be helpful: [AIR openWithDefaultApplication](http://cookbooks.adobe.com/post_Open_file_with_Default_Application_AIR_2_0-16745.html) – Lukasz 'Severiaan' Grela Mar 27 '13 at 10:49
-
I Used NativeProcess and its working fine. Thanks. – Sarfraz Ahmed Mar 27 '13 at 12:49
1 Answers
2
if(NativeProcess.isSupported)
{
var npsi:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = new File("Appication to launch");
npsi.executable = file;
var args:Vector.<String> = new Vector.<String>();
args[0] = "File that is being open with application";
args[1] = "Additonal argument if any";
npsi.arguments = args;
var process:NativeProcess = new NativeProcess();
process.start(npsi);
}
This is how I did it. May be it help others. Thanks

Sarfraz Ahmed
- 1,349
- 6
- 23
- 43
-
1Just to help out others in the future, you should mark your own answer as the correct one here. – Josh Mar 27 '13 at 16:25