Hello,i just started using grub4dos on my usb for booting... So today i put a splashart in my menu.ist file,and i wanted to set when i press f5 to restart the computer,and f6 for shutdown.. So i saw online,and downloaded the hotkey file needed to set it up,i put this in my menu .ist file:
In need of help with grub4dos command
#1
Posted 03 August 2019 - 09:09 PM
#2
Posted 04 August 2019 - 10:31 AM
So you want a couple hidden menu entries, actionable by the hotkeys.
It should be enough to remove the text following the hotkey, i.e.:
title ^F6 Shutdown halt
becoming:
title ^F6 #Shutdown halt
But see also here:
https://www.rmprepus...orials/grub4dos
"Secret menus".
Wonko
#3
Posted 04 August 2019 - 10:54 AM
Yeah,i tried that,you can still select it in the menu,it just has no name... I want the hotkey to work,but so that you cant select the title in the menu..
#4
Posted 04 August 2019 - 01:26 PM
Yep , hence I pointed you also to a more complex solution (which BTW may or may not work as you wish), is "that" the "that" that you already tested unsuccessfully?
Maybe (only thinking out loud) it is possible to check if last key pressed was a function key and only execute the menu entry if that is true , see Fn20 here:
https://www.rmprepus...s-and-functions
20 checkkey- get kbd key without emptying buffer - e.g. call Fn.20 ;; set /A key=%@retval%&0xff > nul ;; echo %key% prints 0x31 if number 1 key pressed (top 8 bits is scancode, bottom 8 are ASCII code, Function keys are 'special') @retval returns -1 if no key available.
So the entry will be hidden, selectable, but will do nothing unless it was triggered by the Functon key .
Wonko
#5
Posted 04 August 2019 - 03:54 PM
Thank you so much for you help,Wonko!
#6
Posted 04 August 2019 - 05:23 PM
Hello,i want the entry to be hidden,but not selectable,but i want the hotkey to still work.. Since im not sure if theres a command that would allow this,is there any other way to make hotkeys work,without setting up an entry?
Thank you so much for you help,Wonko!
I have no idea if the above Fn20 idea works, it may, but unless you test it we'll never know.
A selectable (but doing nothing when selected) blank line (working fine with Function key ONLY) seems to me a good enough approximation (again IF it works).
DavidB made something similar (using the 0x8276 value instead), see here:
http://reboot.pro/to...n-with-hotkeys/
His initial approach is simple enough, but with the attached string of "fixed menu.lst entry numbers" and when it comes to auto-determine based on menu.lst entry numbers it becomes fairly complex, if the Fn20 approach works it might become easier/straightforward.
Let's wait a bit, if Steve6375 or tinybit may happen to see this thread and have an idea (or have already a solution)
Wonko
#7
Posted 05 August 2019 - 08:39 AM
I hope that Steve or tinybit know how to solve this... I want to set it up like you have in gfxmenu,you press f9 to reboot.. .I want to do something like that,but without gfxmenu,and since i saw the entry approach to this,i thought i'd give it a shot... And it does work,the only problem is,that its selectable (it is not hidden),and that really irritates me...
Thanks for your help,i guess i'll wait for Steve or tinybit
#8
Posted 05 August 2019 - 12:30 PM
Wait a minute.
Rethinking about it, you need only "simple commands", not really "menu entries".
Apr 8 2015 Hotkey for grub4dos by chenall
Usage:
hotkey -nb only selected menu when press menu hotkey
hotkey -nc disable control key
hotkey -A Select the menu item with the first letter of the menu
hotkey [HOTKEY] "COMMAND" register new hotkey
e.g.
hotkey [F9] "reboot"
hotkey [HOTKEY] Disable Registered hotkey HOTKEY
Command keys such as p, b, c and e will only work if SHIFT is pressed when hotkey -A
You can do the following:
hotkey
hotkey [F5] "restart"
hotkey [F6] "halt"
This way there won't be any menu.lst entries (so they won't be visible nor selectable, let alone executable), but if you press F5 or F6 the corresponding command will be executed.
Wonko
- Tokener likes this
#9
Posted 05 August 2019 - 04:26 PM
Wonko you are my hero... It worked... I dont know how i missed that line in the tutorial....
But now im struggling to understand how the numbering entries in the menu works...
I cant get the numbers to be right (for my entries) it starts with 0,1,2,3,4-and i dont know how to change it to start with 1-so 1,2,3,4.. Is it possible to do this without adding like Steve's menu... (i saw this in the tutorial).. As far as i understood the statement "Steve's menu" is being counted like 0,even tho you cant select or access it,so the next entry is selectable,so it starts with 1?
Thanks for your help
#10
Posted 05 August 2019 - 05:01 PM
The first menu entry is always 0.
If you want to start from 1 then use a blank menu entry for the first menu entry
notice the space after the word title...
title \n root title menu number 1 etc.
#11
Posted 05 August 2019 - 05:43 PM
Wonko you are my hero... It worked... I dont know how i missed that line in the tutorial....
Basically because it is seemingly not there , the feature must have been added later and AFAICT noone documented or mentioned it.
I only found it by chance, reading the "Usage;" I quoted.
The "new" version has been posted by Steve6375 underlining the -A usage but not the other "direct assigning" of commands:
http://reboot.pro/to...4dos/?hl=hotkey
on the site the "Usage:" must be of an earlier version:
https://www.rmprepus...ey-menu-entries
and later edited only for the -A added option
From the mouth of the wolf (you'd better use the google translate link):
https://grub4dos.che...t/utils/hotkey/
https://translate.go...t/utils/hotkey/
Please note the (optional) usage of @ to hide the commands:
2013-10-14 Added support hotkey command, which can specify a hotkey for some commands, and execute when the hotkey is pressed
grammar
Hotkey [ HOTKEY ] "COMMAND"
Example: After using the following command, if you press F9, it will execute reboot.
Hotkey [ F9 ] reboot
Support for multiple commands at the same time""
Hotkey [ A ] "echo Is test ;; pause test"
You can use the hidden mode to hold the button in front of the command without any screen display.
Hotkey [ F2 ] "@kernel /xxxx ;; initred /xxxx ;; boot"
Use the hotkey without command to remove or disable the hotkey. For example: Disable registered F9 hotkeys
Hotkey [ F9 ]
Note: Two hotkey modes can be selected as needed.
Very likely what happened was that Steve made his page after first release 2011-12-30 and only updated it when the 2015-04-08 came out, somehow missing the update related to the 2013-10-14 version.
Anyway, all is well that ends well.
Wonko
#12
Posted 05 August 2019 - 06:57 PM
@Steve i tried that... I tried naming it my menu,just to check if its there,and even tho the first entry is my menu with root(),it still starts with 0(the next entry is still 0)
Here is my command
#13
Posted 05 August 2019 - 07:07 PM
Try this one (save it as - say - numbers.lst and invoke it from command prompt as configfile /numbers.lst )
color black/cyan yellow/cyan timeout 30 title This is 0 set /a CURDEF=*0x8276 & 0xff > nul echo grub4dos sees this as menu entry #%CURDEF% pause title this is 1 set /a CURDEF=*0x8276 & 0xff > nul echo grub4dos sees this as menu entry #%CURDEF% pause title and this is 2 set /a CURDEF=*0x8276 & 0xff > nul echo grub4dos sees this as menu entry #%CURDEF% pause
Wonko
#14
Posted 05 August 2019 - 07:42 PM
The first menu entry in your menu should be
title \n root
EXACTLY THIS - do not add anything!
You should see that you grub4dos menu will now have a blank line as menu entry 0
If you set the default as 1, then your first menu entry that follows this menu entry will be highlighted which will be menu entry 1.
Are you using --auto-num-on too?
If so use this:
default 1 /_ISO/e2b/grub/hotkey -A setmenu --auto-num-on title \n errorcheck off boot title my menu .....
You will see the attached screen.
Is that what you wanted?
Attached Files
#15
Posted 05 August 2019 - 08:52 PM
@Wonko Im not looking for anything complex,im thinking about Steve's idea? I think it would be simpler to just create a blank menu as (0).. But thanks for your idea!
@Steve I tried that,it didnt work,im sending you a screenshot,and my menu.ist file
My menu.ist file:
#16
Posted 05 August 2019 - 09:32 PM
#17
Posted 06 August 2019 - 11:57 AM
@Steve the problem with that command,while it does work,i can still select the empty entry which is really annoying.. Is there any way to get it working,but without having it selectable?
#18
Posted 06 August 2019 - 12:05 PM
I can't think of anything.
Using 0x8274 with a value of 01 will number only the bootable menu entries, using 02 will number all menu entries (both bootable and not).
But in all cases they all start at 0.
What you could do is not use autonumbering and just use numbers in your menu entries, e.g.
title 1 This is menu 1
....
title 2 This is next menu
...
I am afraid the whole grub4dos menu system, auto-numbering, menu selection, jumping, defaults, etc, is all 0 based.
#19
Posted 06 August 2019 - 12:06 PM
@Steve Okay,but what exactly is autonumbering? And how does it work?
Thanks
#20
Posted 06 August 2019 - 12:07 PM
If you read the 3rd and 4th line of your own menu - you will see!
P.S. You have autonumbering enabled twice in your menu, the first is correct - uses the space character as a separator (0x20) and 01 as the type of autonumbering (only numbers bootable entries). It should only write 2 bytes.
write --bytes=2 0x8274 0x2001
The second item further down is incorrect and should be removed. It writes 4 bytes and so corrupts 2 other locations.
write 0x8274 0x2001
But actually with the latest grub4dos, you don't need to use the write command at all, just use
setmenu --auto-num-on
or
setmenu --auto-num-off
Edited by steve6375, 06 August 2019 - 12:23 PM.
#21
Posted 06 August 2019 - 12:26 PM
Thanks for helping,i disabled autonumbering,i like it better without the numbers at all..
Thanks for helping me guys!
#22
Posted 06 August 2019 - 01:10 PM
@Steve the problem with that command,while it does work,i can still select the empty entry which is really annoying.. Is there any way to get it working,but without having it selectable?
Hmmm.
any of these might do as first entry:
title \n
fallback 1
echo Hey dumbass this is entry 0, you shouldn't select empty lines, I will boot menu entry 1 instead.
pause
root (NOTHING)
or:
title \n
echo Hey mate, why do you think this entry has no text? Let's redo from start ...
pause
write 0x307ff8 1 && configfile
or:
title \n
call Fn.0 0 0x8217 | set mymenu=
configfile %mymenu%
Wonko
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users