Help - Search - Members - Calendar
Full Version: Where's the ANY key?
The CD Forum > CD Shell and Boot Scriptor > Troubleshooting & Problems
Bandito
Ok, this isn't a silly Homer Simpson quote, but simply asking a basic question...

I have this little snippet of code right at the beginning of my cdshell.ini so prompt me to hit ENTER to boot into my CDSHELL menu.

CODE
boot:
cls
print "\n"
print "Press Enter to boot from CD... \n"
getkey 5 boot 0x80
if $lastKey == key[enter]; then goto Begin
boot 0x80


.. But what if I wanted the ability to hit ANY key instead of just the ENTER key? Is there a simple way to accomplish this or do I have to list every key on the keyboard like this:

CODE
if $lastKey == key[a]; then goto Begin
if $lastKey == key[b]; then goto Begin
if $lastKey == key[c]; then goto Begin
if $lastKey == key[d]; then goto Begin
...
etc
jaclaz
What if you try this:
if $lastKey != key[enter]; then goto Begin
this means if lastkey is NOT equal to [enter] then.....

jaclaz
Bandito
Nevermind...

It was actually much easier than I expected.

Basically I'm looking to get a key (getkey) otherwise boot to 0x80. By not specifying a key, it's taking ANY KEY.

CODE
boot:
cls
print "\n"
print "Press Enter to boot from CD... \n"
getkey 5 boot 0x80


As long as a key is pressed the code will continue to the next part of the cdshell.ini script.
Zharif
Hmm,
I could offer another solution which has its own advantages.

The following code accepts any key to start from CD...except the one you put as value in the "set lastKey"command.
This provides the ability to jump to wherever you want inside the script.

QUOTE
boot:
cls
print "\n"
print "Press any key to boot from CD... \n"
getkey 10 set lastKey = key[']if $lastKey == key[']; then goto BOOTC
# if $lastKey == key[@]; then boot 0x80 # additional option - remove "BOOTC:" section then
goto BEGIN

Test:
cls
print "\n"
print "This should be skipped... \n"


BEGIN:
cls
print "\n"
print "Welcome to CDShell... \n"
wait
exit

BOOTC:
cls
print "\n"
print "No key pressed...boot from harddrive \n"
boot 0x80
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.