Adobe AIR – Issues with Command Line Arguments

After working on a little automation tool for video encoding process we ran into an interesting issue with AIR applications and command line arguments. Here is the scenario:

  1. Encoding process ends.
  2. The encoding process passes a file path to the waiting AIR application via command line.
  3. If the AIR app is not running, it starts up.
  4. The AIR application then checks some data in a database updates some tracking info and possibly grabs the duration out of the file.
  5. The AIR app waits for some more input.

Here is the issue – when the application starts up via the command line call, subsequent calls fail to the AIR application. Our solution, the AIR app has to be running when the OS starts up – that way the initial command line call to start the application doesn’t hold the process.

The command line looks something like in Windows:
C:/Program Files/ServerApplication/ServerApplication.exe “D:/my/storagedir/vidfile.f4v”

The command line looks something like on a Mac:
/Applications/ “D:/my/storagedir/vidfile.f4v”

There has to be some way to start the application via the command line without holding everything up right? What am I missing?

Here is what I’m missing:
The new command line looks something like in Windows (added the /b option):
C:/Program Files/ServerApplication/ServerApplication.exe /b “D:/my/storagedir/vidfile.f4v”

The new command line looks something like on a Mac (added the ‘&’ at the end):
/Applications/ “D:/my/storagedir/vidfile.f4v” &

Now our little automation AIR tool doesn’t need to be running when the first call happens – it will actually start up – and it can stay open and successfully receive new command line arguments.