Distributing Air Applications in a clean, easy way

Distributing Air Applications in a clean, easy way

Aug 27
Distributing Air Applications in a clean, easy way
Google Buzz

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.

AIR Adobe

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:

  1. Get a license for redistribution by Adobe;
  2. Create a NSI script for your app;
  3. 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.

NSIS

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.

4 comments

  1. Iz

    We used to do the same thing and got negative feedback from Adobe. The recommended way is to download AIR and pass the air file to it as a parameter.
    Most users don’t have AIR installed anyway as you mentioned above.

  2. The propose of this post is to install a AIR application in a single step for people that don’t have AIR installed yet. Many of these people aren’t even online and cannot download the installer.
    So, with this solution you can give those users a USB pen/CD/DVD/anyware and they can install it all in a simple and unique installation process. In the end, the process will only run both installations from Adobe.
    I don’t see why Adobe would be against.. as it help to spread AIR applications :)
    Of course you have to comply with every Adobe request regrading documentation and text files that must go along with the installation package.

  3. Nik G

    Thanks for this Tiago. Works great!

  4. Thomas

    Will this only work on XP? Vista seems to have another path in the registry.

Leave a Reply

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.