Create Right Click Menus to Test AIR Files (Win/Mac)

August 22, 2007
Greg Ferrell

At the beginning of this year, when I first heard about A.I.R. I was excited to learn more about it and see what I could do with it. What really jumpstarted my interest was a trip to Cincinnati, OH to the Adobe onAIR Bus Tour. At this point I am full steam excited about working with AIR.

I work on a Windows machine at work and Mac at home, so I am also excited to see cross platform development. One thing that is a little wonky about AIR is the way that you test your applications. Since AIR is built with an SDK instead of a builder application, such as Flash, you have you use the terminal to launch the SDK. So I came up with methods for OS X and Windows XP to use right-click contextual menus to test AIR applications. I will first note that you can use Aptana, Flex 3, Flash CS3, and Dreamweaver CS3 to test your AIR apps, but i thought i would make something for the hardcore coders. Though, I personally use all the aforementioned for AIR.

I will assume you have already installed the SDK on either system.

Windows XP: [skip to mac version]

In Windows XP, you can customize your right-click menus for any filetype with the ‘folder options’ panel. First, navigate to control panel, then folder options. Navigate to XML (It will be close to the bottom.).


If the button says ‘Restore’ where you expect it to say ‘Advanced’, it is because you have changed the Windows default opening program for the xml file type. Click ‘Restore’ first then you can click ‘Advanced’. (When you are finished, you can change the opening program back when you are finished, the menu will still stick.)

Next, click the ‘edit’ button and we will create a new contextual command. You will need the full path of the location of your AIR SDK. For this example, I will use mine:

C:\Program Files\Adobe\AIR SDK\bin\adl.exe

This will application field in quotes, followed by “%1”. This will notate that you are opening the file right-clicked with this program. (This works on most other windows programs as well.) Then give it a name you can remember. This is how it will show up in the contextual menu. Just replace my AIR bin location with yours.

"C:\Program Files\Adobe\AIR SDK\bin\adl.exe" "%1"


Now click OK and you should see your command in the window:


Now you can right-click your AIR application.xml and test them right from the Windows file explorer:


The CMD prompt will open, then your air file should open. The CMD prompt will be your error output window.




The Mac version will be somewhat similar, but we will use Automator to do the function. This means you will need at least OS X 10.4 for this tutorial.

Open Automator, and go to ‘Finder’ in the Library menu, under Applications. Drag ‘Get Selected Finder Items’ to the work space.


Next, go to ‘Automator’ in the Library menu, and drag ‘Run AppleScript’ to the work space under ‘Get Selected Finder Items’.


For the Applescript, I had a little help from Mac OS X Hints. You will need the directory for your Adobe AIR SDK. Mine is:

/Applications/Adobe AIR SDK/bin/adl

For this one, I will give the code to you. Paste this into the Applescript window and replace my AIR Adl location with yours:

on run {input, parameters}
	tell application "Terminal"
		if (the (count of the window) = 0) or ¬
			(the busy of window 1 = true) then
			tell application "System Events"
				keystroke "n" using command down
			end tell
		end if
		do script "'/Applications/Adobe AIR SDK/bin/adl' \"" & (POSIX path of ¬
			(input as string)) & "\"" in window 1
	end tell
	return input
end run

Next, we will save this as a Plug-in. Under the File menu, select ‘Save As Plug-in..’. Then select finder as the application and give it a name you can remember:



Now you can just right-click your AIR application.xml, hover over Automater, and choose your new workflow to preview AIR projects!