Nu2Menu, functions help
@FunctionName - > short explanation of function
Parameternumber (type of parameter) : short explanation of parameter
[Parm] optional parameter
And
@And() -> Logical And function
Parm1 (string) : numeric string value
Parm2 (string) : numeric string value
returns: numeric string value
ChangeDir
@ChangeDir() -> Change directory
Parm1 (string) : name directory
returns:
"0" -> directory not changed, something went wrong
"1" -> directory change successful
Exec
@Exec() -> Executes file
Parm1 (string) : filename to execute
[Parm2] (number) : show parameter, default is 1
returns: have to check (HDJ)
Show parameter should be one of the following:
0 - hide window
1 - show window normal
2 - show window minimized
3 - show window maximized
4 - show window, window not activated
5 - show window
6 - show window minimized, activates next top level window in z-order
7 - show window minimized, window is not activated
8 - show window, window is not activated
9 - activates and displays the window. if the window is minimized or maximized, the system restores it to its original size and position
10 - show default
11 - force minimize (2000/XP/PE only, minimizes a window, even if the thread that owns the window is hung)
Examples:
Start notepad maximized
@Exec( @GetWinDir()\system32\notepad.exe, 3 )
Start command in 'normal' window
@Exec( 'cmd.exe',1 )
Comment:
Not all applications respond on the show parameters and some parameters doesn't do anything under WinPE. They are only included for the sake of completeness.
For example, calc.exe (Calculator) cannot be started maximized.
Exit
@Exit() -> function for shutting down nu2menu
FileExists
@FileExists() -> Checks if file exists
Parm1 (string) : filename to check
returns:
"0" -> filename does not exists
"1" -> filename exists
Examples:
@FileExists( @GetWinDir()\system32\notepad.exe )
@FileExists( 'c:\windows\system32\cabview.dll' )
GetEnvVar
@GetEnvVar() -> Get environment variable
Parm1 (string) : name of environment variable
returns: the value of the requested environment variable
Example:
@GetEnvVar( 'ComSpec' )
GetFileDialog
@GetFileDialog() -> Get file dialog and returns file name
Example:
@GetFileDialog( 'xml',' ','nu2menu file (.xml)|*.xml|All Files (*.*)|*.*||' )
GetFolderDialog
@GetFolderDialog() -> Get folder dialog and returns folder name
GetHostName
@GetHostName() -> Get computer/host name
GetOSVersion
@GetOSversion() -> Get operating system version (major and minor version), e.g. '1.0'
GetProgramDir
@GetProgramDir() -> Returns the nu2menu.exe's program directory, like "c:\nu2menu"
GetProgramDrive
@GetProgramDrive() -> Returns the nu2menu.exe's program drive, like "c:"
GetRegKey
@GetRegKey() -> Get registry key value
Parm1 (string) : RootKey, this can be one of the following:
'HKLM' -> HKEY_LOCAL_MACHINE
'HKCU' -> HKEY_CURRENT_USER
'HKCR' -> HKEY_CLASSES_ROOT
'HKU' -> HKEY_USERS
'HKCC' -> HKEY_CURRENT_CONFIG
Parm2 (string) : Subkey, name of sub key
Parm3 (string) : KeyName, name of key to read
Parm4 (string) : KeyType, this can be one of the following:
REG_SZ -> String
REG_EXPAND_SZ -> expandable string
REG_BINARY -> Binary
REG_DWORD -> DWORD
Example: Get PE-Builder Version
@GetRegKey( 'HKLM', 'SYSTEM\CurrentControlSet\Control\PE Builder', 'Version', 'REG_SZ' )
GetServicePackNumber
@GetServicePackNumber() -> Get service pack number (major and minor version), e.g. '5.1'
GetTmpDir
@GetTmpDir() -> Returns the path of the directory designated for temporary files
GetUserName
@GetUserName() -> Returns username
GetVar
@GetVar() -> Get global variable
GetWinDir
@GetWinDir() -> Returns the windows directory, like "c:\windows"
Not
@Not() -> logical not function
returns: numeric string value
Examples:
Not, 0->1, 1->0
Null
@Null() -> redirect output to null device
Or
@Or() -> logical or function
Parm1 (string) : numeric string value
Parm2 (string) : numeric string value
returns: numeric string value
OsBuild
@OsBuild() -> returns OS build number
Reload
@Reload() -> Reload menu as a function
returns: nothing
SetEnvVar
@SetEnvVar() -> Set environment variable
SetMenuPos
@SetMenuPos() -> Set menu position
Parm1 (string) : XPos = x position, can also be 'R' for right, 'L' for left or 'C' for center
Parm2 (string) : YPos = y position, can also be 'T' for top, 'B' for bottom or 'C' for center
returns: nothing
Example 1: @SetMenuPos( '100','400' )
Example 2: Set menu position to the top right corner
@SetMenuPos( 'R','T' )
SetVar
@SetVar() -> Set global variable, so you can use anywhere else in the menu system
Shl
@Shl() -> Shift bitwise left
Parm1 (string) : ValueToShift
Parm2 (String) : HowManyPositions
returns: shifted value
Example: The following example hides the menu item if notepad.exe is not found in the system32 directory
<MITEM TYPE="ITEM" VISIBILITY="@Shl(@Not(@FileExists( @GetWinDir()\system32\notepad.exe
)),'1')" CMD="RUN" FUNC="@GetWinDir()\system32\notepad.exe" PARM="1">@GetWinDir()\system32\Notepad</MITEM>
ShowRunDialog
@ShowRunDialog - > Show the default windows run dialog. (thanks to Cyberian)
Shr
@Shr() -> Shift bitwise right
Parm1 (string) : ValueToShift
Parm2 (String) : HowManyPositions
returns: shifted value
Ver
@Ver() -> Displays version of nu2menu