Distributing Air Applications in a clean, easy way

Most times, if you want to share your AIR application, you make it available for the general public, interested people will download and install AIR and all goes well.
But what if you need to distribute an AIR application? Your end user might not like or be able to download AIR installer. Also, installing two different things is a bit anoying to a user that is “forced” or not motivated to use your software.

I most cases, you may just want to make the AIR application install process as clean, simple and transparent as possible to your clients. Most of them probably never heard of AIR platform and don’t need to.That was our case at inEvo. We like our software to be pleasant and with no use barriers, taking all the work to us and giving the user only the good, sweet software juice.
To redistribute AIR applications you need only 3 easy steps:
- Get a license for redistribution by Adobe;
- Create a NSI script for your app;
- Compile and send it.
Ok, the first step is easy, just ask Adobe for a license and wait for a positive answer.
In the second step we are going to use a NSI script. NSIS (Nullsoft Scriptable Install System) is a scripting language from Nullsoft that enables the creation of Windows installers.
Our script, will test if the user has already AIR runtime or install it if he doesn’t. Then it will install our AIR application. The user will have an easy and happy installation process. Here is an example script (you will have to change little to adapt to your app):
!include "WordFunc.nsh"
!insertmacro VersionCompare
!define PRODUCT_NAME "Example Application"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "inEvo"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} by ${PRODUCT_PUBLISHER}"
BrandingText "This is only an example"
Icon "example-application.ico"
OutFile "example-application-install.exe"
Section Prerequisites
SetAutoClose true
SetOutPath ""
SetOverwrite ifnewer
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe AIR" "DisplayVersion"
; $var=0 Versions are equal
; $var=1 Version1 is newer
; $var=2 Version2 is newer
${VersionCompare} $0 "1.1.0.5790" $R0
IntCmp $R0 2 notinst
Goto installProgram
notinst:
File /oname=$TEMP\airintalltemp.exe "AdobeAIRInstaller.exe"
ExecWait "$TEMP\airinstalltemp.exe"
Goto installProgram
installProgram:
File /oname=$TEMP\example-application.air "example-application.air"
ExecShell "" "$TEMP\example-application.air"
SectionEnd
Ok, lets review the script:
First we include everything we need. In this case, we only need the VersionCompare function that is on “WordFunc.nsh”.
Then we define some texts that will appear on the installation process. In this case, the Name of the application and branding text.
Icon is the icon image that will appear and the OutFile will be the end result after this script is compiled, this is, it’s the final installer.
The section Prerequisites is where everything happens. First some options:
- SetAutoClose will make the initial installation dialog box close after the AIR application installation window appears;
- SetOutPath will determine that the local path is here all compiled stuff will go;
- SetOverwrite specifies whether the user should be able to skip a file or not.In this case, only if it is newer.
Now we are going to check if the user already has AIR runtime and if it at least as recent as our installation version. To that purpose, we see the registration data on windows and compare with our version. In this case, the example AIR runtime version is “1.1.0.5790″.
Note that the place here the version on the register data is can change in the future.. but it will probably not for a long time.
Now, if we need to install AIR runtime, we go to “notinst” label.
There, we first set to copy “AdobeAIRInstaller.exe” to Windows temporary directory and execute it from there. This way, we won’t get any “trash” on the end.
Finally, we install the AIR application, copying it to also to the temp dir and executing it on shell mode. We need to do this as this is the only way that Windows will run the AIR installer to deal with our .air file.
Now just compile it and send the .exe to your clients or friends.
There you go.. a clean, easy and quick way to distribute your AIR applications. If you have use any different approach, please share it and comment.
About this entry
You’re currently reading “Distributing Air Applications in a clean, easy way,” an entry on In an Airplane Under the Sea
- Published:
- 8.27.08 / 3pm
- Category:
- RIA
Was it any good?





4 Comments
Jump to comment form | comments rss [?] | trackback uri [?]