Run an exe file from AIR
Mike Chambers offered a nice solution to this. Theoretically, my workaround is based on LocalConnection and another piece of software which can launch exe files without restrictions. If you really need to run external exe files, and there is no other way of solving your problem, then you will make sure that the user runs that another software before launching the AIR application. Let’s name this another software, Executor.
Ingredients:
- Executor is built with embedded content, having inside a little piece of SWF which handles communications with your AIR application and launches upon request other applications, exe type. This can be built using SWF packers (projectors) like Zinc (which is allowed to launch exe files, and have a lot of functionality for all sort of things), or – if you have the know how – you can build it yourself (and I can’t tell you how nice it is), using for instance, Delphi.
- Another class, which handles LocalConnection communications – will be included of you AIR application. If your AIR application cannot connect to Executor, you will announce the user to launch it, indicating the exact position of Executor (since you know where the installation took place).
- Executor has the ability to minimize to tray, without interfering with AIR’s execution. Another ability of Executor, should be to close itself upon request (sky’s the limit here, talking about its abilities) just before closing your AIR application.
In the end, I’ll have to admit three things:
- Although I didn’t tested, Mike’s solution seems more elegant and probably works cross-platform. So, if you have the knowledge, adopt his solution.
- Talking about Zinc and AIR is like a pleonasm, since AIR is doing more or less what Zinc did even before Apollo was just the name for a Greek God and a space mission name. If you are adopting the above solution, you’ll have to have a very good reason (like FileStream usage or ByteArray, maybe the open-source Safari browser) since most of the support that Zinc has to offer applies to every aspect you might think. So, building a Flex project which is using Zinc’s functionality seems by far a better idea.
- I’ll have to declare myself disappointed realizing that AIR didn’t make it to the point that we’ll don’t have to buy third party software to do achieve something so simple. If it’s a desktop application, than should behave like one, isn’t it? Despite this, I still believe in AIR because I have a good preview and I’m certain that one day this workaround will be redundant.
