![]() |
|
| Sponsor Nu2 | Search Nu2 | About Henk | Support Henk | Contact Henk |
| :: Introduction :: Menu file rules :: Minimal menu file :: Menu item node <MITEM> :: Download :: Functions :: Frequently asked questions :: Plans for future versions :: History :: Used tools/information |
Introduction
Menu file rulesIf you create your own menu file you must obey the following rules:
- all menu nodes must be written in uppercase,
- function names for the scripting language are case sensitive
- every opening tag needs a closing tag
Minimal menu fileA minimal menu file consist of at least three parts, namely:
- identification node (<NU2MENU>...</NU2MENU>)
- menu id node (<MENU>...</MENU>)
- menu item node (<MITEM>...</MITEM>)
With identification node, the menu system sees that this is the beginning of the menu information.
With the menu id node, you give a menu group a name. This name is used for linking it as a sub-menu e.g. <MITEM TYPE="POPUP" MENUID="System">System</MITEM>. The first menu id node is also the starting menu of Nu2menu (the one that pops up first).
Nu2Menu skeleton:
<!-- Nu2Menu entry -->
<NU2MENU>
<MENU ID="Main menu">
<MITEM TYPE=ITEM,POPUP,SEPARATOR DISABLED=... CMD=... FUNC=... >Description</MITEM>
</MENU>
<MENU ID="Sub menu">
...
</MENU>
</NU2MENU>
Menu item node <MITEM>The menu item node does have several sub nodes, namely:
- TYPE
- DISABLED
- CMD
- FUNC
- PARM
The TYPE node can have one of the following parameters:
- ITEM -> define the name of the menu entry, this is visible in the shell
- SEPARATOR -> create a separator in the menu structure
- POPUP -> define a new sub menu
The DISABLED node is for disabling the current menu item. If DISABLED="1" then the menu/shell item is disabled.
The CMD node can have one of the following parameters:
- HIDEFROMTASKBAR -> hide the Nu2Menu from the taskbar.
- SHOWINTASKBAR -> let the Nu2Menu be visible in the taskbar
- RELOAD -> reload the menu structure
- RUN -> executes the FUNC sub node from the menu item node
The FUNC node can only work if CMD="RUN".
All sub nodes can use the nu2menu functions. For a complete list of nu2menu functions see: Function list
Here is the nu2menu file mozilla_Embed_nu2menu.xml:
<!-- Nu2Menu entry -->
<NU2MENU>
<MENU ID="Programs">
<MITEM TYPE="ITEM" DISABLED="@Not(@FileExists(@GetProgramDrive()\Programs\MozillaEmbed\mfcembed.exe))"
CMD="RUN"
FUNC="@Null(@ChangeDir(@GetProgramDrive()\Programs\MozillaEmbed))@GetProgramDrive()\Programs\MozillaEmbed\mfcembed.exe">
MozillaEmbed(browser)
</MITEM>
</MENU>
</NU2MENU>
Short explanation of the used functions:
@Not() -> logical not function, 0 will be 1, 1 will be 0
@FileExists() -> Checks if file exists
Parm1 (string) : filename to check
returns:
"
0" -> filename does not exists
"
1" -> filename exists
@GetProgramDrive() -> Returns the nu2menu.exe's program drive, e.g. "c:"
@Null() -> redirect output to null device
@ChangeDir() -> Change directory
Parm1 (string) : name of directory
returns:
"
0" -> directory not changed, something went wrong
"
1" -> directory change successful
The DISABLED node in the example checks of the executable is on the booted media. The result will be inverted. In other words: If the file is not found on the booted media, the shell entry will be disabled.
The FUNC node in the example changes the directory to where the Mozilla Embed executable is situated. After that it will run the Mozilla executable. Because of the 'ChangeDir' result, the output must be redirected to the null device. If we don't do this, Mozilla won't get started.
Download
Functions| And | ChangeDir | Exec | Exit | FileExists | GetEnvVar | GetFileDialog | GetFolderDialog | GetHostName | GetOSVersion | GetProgramDir | GetProgramDrive | GetRegKey | GetServicePackNumber | GetTmpDir | GetUserName | GetVar | GetWinDir | Not | Null | Or | OsBuild | Reload | SetEnvVar | SetMenuPos | SetVar | Shl | ShowRunDialog | Shr | Ver |
Frequently asked questions
Plans for future versions[X] Run box [X] Set your own position of Go/Start button [X] Add or Change "disable" item, so that an item can be "hidden" [ ] Input box [ ] Yes / No box [ ] Something like onStartup [ ] Read icons and show them in menu [ ] Show your own icon for menu item [ ] Get errorlevel [ ] Case insens...View complete list of future plans
History2005-11-23 (V0.351) nu2menu.exe c:\tmp\nu2menu.xml Can load nu2menu.xml from different location 2005-02-17 (V0.350) Kinda bug fixed. FileExists did not work with c:\nul 2004-12-01 (V0.349) New: Shift bitwise left @Shl( ValueToShift, HowManyPositions ) Shift bitwise right @Shr( ValueToShift, HowManyPositions ) @And( ValueToAnd, AndWith ) Changed: @Or() @Not() Menu item sub node DISABLED is replaced by VISIBILITY. For backward compatibility the DISABLED node only works...View complete history
Used tools/information
|