I’m working on a new desktop (Adobe AIR) application. More on that app in the months to come. In the process of putting together a prototype, I’ve found that NativeMenu.getItemByName doesn’t work (at least not on my system). I initially used the following code to try to add a menu item to the File menu:
var nm:NativeMenu = NativeApplication.nativeApplication.menu;
var nm0:NativeMenuItem = nm.getItemByName('File');
var mi:NativeMenuItem = new NativeMenuItem("Export...");
mi.addEventListener(Event.SELECT, exportSelected);
nm0.submenu.addItem(mi);
Unfortunately, the menu item resolves to null in the above code and subsequently generates an error. Instead, I’m using the following code (that works):
var nm:NativeMenu = NativeApplication.nativeApplication.menu;
var nm0:NativeMenuItem = getMenuItemByLabel(nm, 'File');
var mi:NativeMenuItem = new NativeMenuItem("Export...");
mi.addEventListener(Event.SELECT, exportSelected);
nm0.submenu.addItem(mi);
The getMenuItemByLabel function is as follows:
function getMenuItemByLabel(menu:NativeMenu, labelName:String):NativeMenuItem {
var count:uint = menu.items.length;
for(var i:uint=0; i < count; i++){
var item:NativeMenuItem = menu.getItemAt(i);
if(item.label === labelName) return item;
}
return null;
}

That way I can get the menu by name and rest assured that I’ve added to the File menu (or any other existing menu) without having to guess its index.
Duplix is a batch duplication utility for Mac OS X, Windows, and Linux. The Duplix utility quickly duplicates files and folders using numeric or custom naming. The numeric naming option allows the user to set a range of values and includes a “minimum digits” setting which can automatically add zeroes to the file names to maintain alphabetical sorting for the duplicated files. The custom naming option allows the user to type or paste in a series of names for the duplicated files. The custom names can be separated by commas, spaces, or line breaks. Both numeric and custom naming options allow for a prefix and suffix for the duplicated file names, and even allow the user to alter the file extension if needed. Existing files can be preserved or overwritten by duplicates depending on the option selected. The user can also choose to delete the original file or folder after duplication if desired.
Installation
You can install Duplix directly from this webpage (if you don’t have the AIR runtime yet, this will install that for you as well):
Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.
How to Use Duplix
Check out these video demos:
Screenshots below the fold… (more…)
I originally posted this application with the name DuplicatAIR. Then as I was reading through the submission agreement on the Adobe AIR Marketplace, I noticed that they didn’t take too kindly to having “AIR” within the name of the application. Then I ran across this post and I decided to pull DuplicatAIR offline and rename it.
The application is now called Duplix.
I’m leaving this page available since it already went live. If you happen upon this page, please redirect your browser to the new post.