Display any text on menu

‘setmenu –string’ command

The setmenu –string command can be used to display strings on menus (date&time requires grub4dos 0.4.6a 2019-08-09 and E2B v1.B5 or later). 

grub4dos maintains a list of up to 16 strings which it will write on top of each menu until the list is cleared. 

setmenu --string=iINDEX=[X]=[-]Y=COLOR="STRING"  
 iINDEX = i0-i15 (E2B v1.B8 and later only, grub4dos 2019-12-30+)
  X is X coordinate or 's' or 'm' and Y is Y coordinate (can be negative).
  X: If no X or s then text is centred  on screen, if m then text centred across menu area.
  -Y represents the count from the bottom - e.g. -0 = bottom, -1 = one up from bottom.
  "STRING"="date&time=FORMAT"  will update date FORMAT every second.
             e.g. "date&time=MMM.dd.yyyy  HH:mm:ss"
             e.g. "date&time=dd/MMM/yy AP hh:mm:ss"
                     "STRING"="date&time"   - ISO8601 format. equivalent to: "date&time=yyyy-MM-dd  HH:mm:ss"
  --string=iINDEX will disable the specified index. 
  --string= to clear all strings.

Note: Use only 0xRRGGBB or 0xrrggbb00RRGGBB for COLOR.

See this blog post for an example of how to add random jokes onto your menu screen.

You can add up to 16 setmenu –string commands to write text anywhere onto the grub4dos menu display. 

Add the following lines to your \_ISO\MyE2B.cfg file for each string you want to write: 

#                #   x  y  colour     "text to display"
setmenu --string=i0=66=15=0xFFFF00="STRING1 ångström at 66,15" 

If you save the file as UTF-8, you can include non-ASCII characters within the double-quotes. 

You can specify a background colour for –strings using a 64-bit hex number – e.g. 0xFFFFFF001111FF. 

You can also specify standard ASCII characters using their hexadecimal value – e.g. \x03 or their unicode value, e.g. \X00C4 for Ä (note use lower case x for ASCII and upper-case X for 4-character hex unicode values). e.g. 

# display ångström, yellow text on grey background - centre across menu area on bottom line of screen
setmenu --string=i0=m=-0=0x44444400FFFF00="\X212Bngstr\X00F6m"           

Up to 16 –string commands are cached\remembered and will be displayed on all menus.

You should avoid writing strings inside the menu area as may cover menu entries.

You can use \n inside string to start the text on a new line (setmenu –string=0=33=0xFF0000=”How are you\nFRED”). Note that the strings are written after the menu border and menu entries are displayed, so characters and spaces can overwrite the menu area.

Strings will use the ‘standard’ console text background colour unless you specify a background colour. For this reason it is always best to use a black background colour for the ‘color standard=’ console colour.

You can clear the –string cache of all previous string commands using setmenu –string=

Clear a string using, e.g. setmenu –string=i0

You can use echo -mem=0x3a8000=1024 to view first 1024 bytes of current –string values.

Note: When you reload the main menu (using F8 in the Main Menu), E2B will clear all strings before MyE2B.cfg is loaded and run.

Using –string in multiple menus

If you wish to use –string commands on different menus, e.g. in \_ISO\LINUX\!!CONFIG\linux.mnu and \_ISO\BACKUP\!!CONFIG\backup.mnu, etc. in order to write different strings to different menus, you must delete all previous strings first.

Note that the .mnu file must be enumerated first, so we must place it in the !!CONFIG sub-folder.

backup.mnu

# clear strings buffer
setmenu --string=
# write new string commands to string command buffer
#                x   y  colour  "text to display"
setmenu --string=i0=66=14=0xFFFF00="STRING1 ångström at 66,14"
setmenu --string=i1=66=15=0xFFFF00="\X212Bngstr\X00F6m"
setmenu --string=i2=66=16=0xFFFF00="Hello!"  
setmenu --string=i3=66=17=0xFFFF00="How are you"

You can only use a maximum of 16 string commands (i0-i15).

As an alternative, you can place the commands in a menu batch file, e.g. to place strings on the BACKUP menu. \_ISO\BACKUP.g4b

!BAT
# clear strings buffer - only 16 allowed
setmenu --string=
# write new string commands to string command buffer
#                x   y  colour  "text to display"
setmenu --string=i0=66=14=0xFFFF00="STRING1 ångström at 66,14"
setmenu --string=i1=66=15=0xFFFF00="\X212Bngstr\X00F6m"
setmenu --string=i2=66=16=0xFFFF00="Hello!"  
setmenu --string=i3=66=17=0xFFFF00="How are you"

When any menu folder is loaded, a .g4b file of the same name as the menu folder will be executed if present (e.g. \_ISO\MAINMENU.g4b or \_ISO\MYNEWFOLDER.g4b). 

Grub4dos batch files must start with !BAT on the first line. 

Add an updating Date and Time string

You can add a transparent string anywhere on the screen which includes the current date and time. This will automatically update every second. Add to end of \_ISO\MyE2B.cfg: 

# Display Date and Time on every menu (max. 16 --string commands, use 'setmenu --string=' to clear all strings)
# Can add own string with special replacement code strings of dd MM MMM yyyy hh HH mm ss AP
 setmenu --string=i5=71=0=0xffffff="date&time=[dd-MMM-yyyy  hh:mm:ss AP]

71 is the X co-ordinate, 0 is Y co-ordinate, 0xffffff is 0xRRGGBB colour.

MM will print 08 or MMM will print Aug, AP will print either AM or PM, hh will print 13 (24-hour clock) or HH will print 01 (12-hour clock). 

Note: 00:xx does not exist with 12-hour clock… 

12:00 AM (midnight)
12:43 AM
01:43 AM
07:00 AM (time to wake up)
11:59 AM
12:00 PM (noon)
12:43 PM
01:43 PM
05:01 PM (Gin&Tonic time)
11:00 PM (zzzzzz.. time)

Example using mixed text:

setmenu --string=i10=40=0=0xffffff="date&time=Year=yyyy Month=MM Day=dd  The current hour is HH" 

You could set up a hotkey in the MyE2B.cfg to permanently disable the date&time string:

()/%grub%/hotkey [ctrl+F2] "@setmenu --string=i10" > nul 

The \_ISO\docs\Sample mnu Files\E2B Menus folder contains a Display_DateAndTime.mnu example menu file. 

Date and Time in Main Menu only

If you do not want the Date and Time displayed on any of the sub-menus, you can create a .mnu file for each of the sub-menu folders to disable the date&time string. We do not need to modify the MyE2B.cfg file.  

Example: The three files below will cause the date and time to be displayed whenever the Main Menu is loaded and the string will be removed whenever the WINDOWS or DOS menu is loaded. 

Note that we must delete all strings first because we can only add a maximum of 16 strings and we may change the menu more than 16 times. If you also want other strings displayed on the menu, then you must add extra lines for each string into the MAINMENU.g4b file.

\_ISO\MAINMENU.g4b
!BAT
# clear all strings
setmenu --string=
setmenu --string=i5=71=0=0xffffff="date&time=[dd-MMM-yyyy  hh:mm:ss AP]"
# add other strings here, etc.
 
\_ISO\WINDOWS.g4b
!BAT
setmenu --string=i5
 
\_ISO\DOS.g4b
!BAT
setmenu --string=i5

If you do not want the date&time string in the UTILITIES menu you must create a \_ISO\UTILITIES.g4b file, etc., etc. 

Notes:

  • The grub4dos internal string list only holds up to 16 strings.
  • Use the iINDEX syntax to specify a unique number for each string
  • You can use setmenu –string=iINDEX  to disable string INDEX, where INDEX=0-15.
  • You can use setmenu –string= to clear all strings.
  • You cannot re-enable a disabled string.
  • You can add another string (up to 16 in total) or clear the list and then add up to 16 new strings.
  • There is no grub4dos command to list all strings in the list.

New! Ventoy for Easy2Boot v1.0.97 now released!

 

eBooks available (in PDF format)

Easy-to-read eBooks are available in PDF format (each eBook is over 100 pages) – rated 4.5/5 stars.
Learn the secrets of Legacy and UEFI USB booting and then make your perfect multiboot USB drive.
E2B eBook #1 includes instructions on how to remove the E2B 5-second start-up delay blue screen.

E2B is unique in that it uses partition images which allows you to directly boot from Secure Boot images (no need to disable Secure Boot or run MOK manager or modify your UEFI BIOS).

Most eBooks are over 100 pages long, contain original content and step-by-step exercises which are suitable for both the beginner or the more experienced user.
Customer reviews are located at bottom of each eBook product page and multi-buy discounts are available when you buy more than one eBook. Please also visit RMPrepUSB.com and the E2B Forum.
Subscribe to my blog for the latest news, tips, USB boot articles and free eBook updates.