Display text anywhere on the menu screen

E2B v1.97A+ and grub4dos 0.4.6a 2017-12-23 and later. 
 
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=[X]=[-]Y=COLOR="STRING"  max 16 commands.
  If no X, text in middle.
  -Y represents the count from the 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=INDEX to disable the specified index. 
  --string= to clear all strings.
  --string=date&time to disable the date&time.
Note: Use only 0xRRGGBB for COLOR. INDEX range is 1-16.
 

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=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 also specify standard ASCII characters using their hexedecimal 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
setmenu --string=66=15=0xFFFF00="\X212Bngstr\X00F6m"           

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

You should avoid writing strings on the menu area.

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.

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

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 because only 16 allowed
setmenu --string=
# write string commands to string command buffer
setmenu --string=66=15=0xFFFF00="\X212Bngstr\X00F6m"  
setmenu --string=66=16=0xFFFF00="Hello!"  
setmenu --string=66=17=0xFFFF00="How are you"  
 
#                        x    y    colour       "text to display"

 # clear strings buffer because only 16 allowed
setmenu --string=
# write new string commands to string command buffer

#                x   y  colour  "text to display"
setmenu --string=66=14=0xFFFF00="STRING1 ångström at 66,14"
setmenu --string=66=15=0xFFFF00="\X212Bngstr\X00F6m"
setmenu --string=66=16=0xFFFF00="Hello!"  
setmenu --string=66=17=0xFFFF00="How are you"

 

You can only use a maximum of 16 string commands.

 
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 because only 16 allowed
setmenu --string=
# write new string commands to string command buffer
#                x   y  colour  "text to display"
setmenu --string=66=14=0xFFFF00="STRING1 ångström at 66,14"
setmenu --string=66=15=0xFFFF00="\X212Bngstr\X00F6m"
setmenu --string=66=16=0xFFFF00="Hello!"  
setmenu --string=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

With E2B v1.B5+ you can add a 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)
###setmenu --string=75=0=0xffffff="date&time"
# Can add own string with special replacement code strings of dd MM MMM yyyy hh HH mm ss AP - e.g. Display [2019-Aug-05  02:24:33 PM]
 
setmenu --string=71=0=0xffffff="date&time=[dd-MMM-yyyy  hh:mm:ss AP]"
 
This line first tests that the command is supported by grub4dos by using the help command and then executes the setmenu command. 
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)
 
Example using mixed text:
setmenu --string=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=date&time" > 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=71=0=0xffffff="date&time=[dd-MMM-yyyy  hh:mm:ss AP]"
# add other strings here, etc.
 
\_ISO\WINDOWS.g4b
!BAT
setmenu --string=date&time
 
\_ISO\DOS.g4b
!BAT
setmenu --string=date&time
 
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 holds up to 16 strings.
You can only run a maximum of 16 consecutive setmenu --string commands to add strings. 
Once 16 strings have been added to the internal list, any further added strings are ignored.
You can use setmenu --string=INDEX  to disable string n, where INDEX=1-16.
You can use setmenu --string=date&time to disable the current date&time string.
Disabling a string does not remove it from the internal grub4dos list.
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 add up to 16 new strings.
There is no grub4dos command to list all strings in the list.