Avg. Rating 4.4

Problem

Adobe AIR program can't invoke local .exe file on Windows.

Solution

Use an AutoIt script to take over this task.

Detailed explanation

It is an interesting technique to develop an application with a Adobe AIR GUI and a Python kernel (implementing the functionalities) with PyAMF in between. (see a HelloWorld example at http://pyamf.org/wiki/HelloWorld)

 
On Windows machine, it is a little inconvenient that the end user has to click-open both the GUI and the kernel program to start using the application. 

One solution is to use an AutoIt (a free Windows scripting environment) script:
 
Run(@ScriptDir & "\dist\MyKernel.exe","", @SW_HIDE)
$PID = Run(@ScriptDir & "\dist\MyGUI private.exe")
Sleep(2000)
ProcessWaitClose($PID)
WinClose(@ScriptDir & "\dist\MyKernel.exe")

 
The first "Run" command starts the kernel program in the background (@SW_HIDE). In this case, it is a python .exe generated by Py2exe. 
 
The second "Run" command starts the Adobe AIR GUI. 
 
The script waits until the GUI window is closed. It then closes the kernel program afterwards.
 
The script can be compile into a standalone .exe with icon. The end user just need to click-open the script file to run the application. 


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes