bmcbrett
asked on
MS-DOS hot keys
What's the easiest way to create a hot key for use in MS-DOS 6.22? We want to be able to launch an application from anywhere in DOS.
I used to remap any of my keyboard keys (including the function keys) by loading ansi.sys in the config.sys file, and then including a call to a batch file in the autoexec.bat. This way, you can have any key on the keyboard do anything you want it to, and all that is resident in memory is ansi.sys. Let me know if you need further details, and I will dig out my notes.
jbeaman
jbeaman
ASKER
jbeaman,
Yes we would like more info. Any thing you can provide would be of help - direct email is brett@bmccomputers.com - I will still give answer points on site
Yes we would like more info. Any thing you can provide would be of help - direct email is brett@bmccomputers.com - I will still give answer points on site
First, put the following line in your config.sys:
device=c:\dos\ansi.sys
Then, put the following lines in your autoexec.bat file towards the end:
prompt $e[0;68;"dir";13p
prompt $p$g
What this does is remaps the F10 key (ASCII value 68) to the dos command "dir" followed by a RETURN (13p). So after rebooting the computer with these lines in place, you can now get a directory by pressing the F10 key. All standard keys are covered by any ASCII table, and you should be able to find it fairly easy. If not let me know. The ASCII values for the function keys are as follows:
F1-F10 59-68
F11 113
F12 134
SHIFT F1-F10 84-93
SHIFT F11 135
SHIFT F12 136
CTRL F1-F10 94-103
CTRL F11 137
CTRL F12 138
ALT F1-F10 104-113
ALT F11 139
ALT F12 140
Let me know if this makes sense, and what you are trying to do. I could possibly create the code myselft if you don't want to mess with it.
jbeaman
device=c:\dos\ansi.sys
Then, put the following lines in your autoexec.bat file towards the end:
prompt $e[0;68;"dir";13p
prompt $p$g
What this does is remaps the F10 key (ASCII value 68) to the dos command "dir" followed by a RETURN (13p). So after rebooting the computer with these lines in place, you can now get a directory by pressing the F10 key. All standard keys are covered by any ASCII table, and you should be able to find it fairly easy. If not let me know. The ASCII values for the function keys are as follows:
F1-F10 59-68
F11 113
F12 134
SHIFT F1-F10 84-93
SHIFT F11 135
SHIFT F12 136
CTRL F1-F10 94-103
CTRL F11 137
CTRL F12 138
ALT F1-F10 104-113
ALT F11 139
ALT F12 140
Let me know if this makes sense, and what you are trying to do. I could possibly create the code myselft if you don't want to mess with it.
jbeaman
Here's a utility that will do just what you want:
http://oak.oakland.edu/simtel.net/msdos/keyboard/bmp-20.zip
http://oak.oakland.edu/simtel.net/msdos/keyboard/bmp-20.zip
ASKER
jbeaman,
We're trying to follow your example above, with the following replacements: we are replacing "dir" with "inv", which is a batch file that we created and would like to run from anywhere. We are also relacing the 68 with 104, for ALT-F1. So the entire string is
PROMPT $E[0;104;"inv";13p
This is not working. Does there need to be an end bracket? What does the zero represent?
We're trying to follow your example above, with the following replacements: we are replacing "dir" with "inv", which is a batch file that we created and would like to run from anywhere. We are also relacing the 68 with 104, for ALT-F1. So the entire string is
PROMPT $E[0;104;"inv";13p
This is not working. Does there need to be an end bracket? What does the zero represent?
ASKER
jbeaman,
We're trying to follow your example above, with the following replacements: we are replacing "dir" with "inv", which is a batch file that we created and would like to run from anywhere. We are also relacing the 68 with 104, for ALT-F1. So the entire string is
PROMPT $E[0;104;"inv";13p
This is not working. Does there need to be an end bracket? What does the zero represent?
We're trying to follow your example above, with the following replacements: we are replacing "dir" with "inv", which is a batch file that we created and would like to run from anywhere. We are also relacing the 68 with 104, for ALT-F1. So the entire string is
PROMPT $E[0;104;"inv";13p
This is not working. Does there need to be an end bracket? What does the zero represent?
ASKER
jbeaman,
OK, we have figured out the end bracket and zero questions. Let me give you some more info on what we are trying to do with this. We have a menu program that we use for our business during the day. What we are trying to do is create a hot key to access a program that is not in the menu program, and then have it return us to the menu program when exiting the other. We can type the line in at the command prompt, and it will work, but only at the command prompt. It will not work if loading it in the autoexec.bat file either. Hope this helps.
OK, we have figured out the end bracket and zero questions. Let me give you some more info on what we are trying to do with this. We have a menu program that we use for our business during the day. What we are trying to do is create a hot key to access a program that is not in the menu program, and then have it return us to the menu program when exiting the other. We can type the line in at the command prompt, and it will work, but only at the command prompt. It will not work if loading it in the autoexec.bat file either. Hope this helps.
Your menu program nay be preventing the use of batch files or recursive batch files. This is not an easy subject and is very dependent on what type of menu program you are using. It may be able to modify the menu system to do what you need, but you will need to have knowledge of the menu system itself.
I hope this helps.
I hope this helps.
What is the name of the batch file, and where is it located? If it is in a directory that is not in the path, you will have to specify the pathname. You will also most likely have to include the keyword "Call" in the prompt statement. So, the stuff in quotes should look something like this: "Call c:\mydir\mysubdir\mybatfil e.bat". Try that and let me know what happens.
jbeaman
jbeaman
You may need to put an "exit" command at the exit points of the batch file, in order to make the call command work properly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Aw shucks, cymbolic, ya spoiled the fun of watching their journey of discovery.
If this is a pure DOS environment, then the best thing would be a TSR ( terminate and stay resident ) program.
DOS is NOT designed for multitasking, so unless the app you are calling is a TSR, the chances are you wil crash DOS.
The other option is to use a batch file.
Much easier, and will always work at a command prompt.
I hope this helps.