This is a utility to sort the Nu2Menu.xml prior to building the ISO file.
SortMenu <Path To XML File>
It usually will be invoked by configuring PeBuilder to run a command file instead of mkisofs. The sorted XML output from the program is to stdout and any errors are reported to stderr. If the program parses the XML without any errors then the the program will set an errorlevel of 0. Otherwise if errors are discovered the errorlevel will be set to 1.
This is usually achieved by using post processing scripts. One such is the Sherpya Build Scripts ( external link ). These replace the supplied mkisofs file with a fake mkisofs.exe file that calls wrapper.cmd and then calls the mymkisofs.exe program which is the original mkisofs.exe file renamed ( rename your mkisofs.exe to this file prior to extracting the download into your pebuilder directory).
If you are using the Sherpya wrapper.cmd then you should add to this file after the line that starts :main ( assuming you have copied my sortmenu program to your pebuilder directory)
SortMenu.exe "%pedir%\Programs\nu2menu\nu2menu.xml" > nu2menu.xml
if errorlevel 1 goto end
copy nu2menu.xml "%pedir%\Programs\nu2menu\nu2menu.xml"
An example wrapper.cmd is included in the zip file.
I set the command file up so that the build is aborted if sortmenu reports errors. This usually means that entries will be missing from the menu. The error will reference a line number in the output nu2menu file to be found at:
Look at the line number and fix the problem in the original plugin file. The usual problem is that a menu is referenced with a <MENU> item that has not been previously defined in the file with a <MITEM TYPE="POPUP" ... > item.
The program consolidates all duplicate menus into one menu and within each menu sorts the items alphabetically with popup menu items sorted first with respect to other popup menu items. All none popup menu items within a menu will follow the sorted popup menu items and will be sorted with respect to the other none popup menu items.
If whilst parsing a menu a seperator is processed then all menu items which are processed in that menu after processing the seperator will be added to the menu without sorting. Two special comments are defined which control how the program sorts the menu items within a menu. These are:
<!--==--> : this directs that any menu items that are processed for this menu after this special comment are added to the menu unsorted.
<!--++--> : this directs that any items discovered in this menu after this special comment are sorted with respect to all later menu items in this menu using the usual sorting rules with later popup menu items sorted first.
In the output XML all special comments are removed except a <!--==-> comment is added at the start of every menu. This ensures that if the program is run on a sorted XML file that no further sorting is attempted for the menus.