Andrew Greenberg wrote:
Hi everyone,
4DOS has a nifty command called "keystack" which allows you to insert
key strokes into the keyboard buffer. This is handy for controlling DOS
programs which you can't script from the command line.
Does FreeDOS have anything like this? Or does anyone have any ideas for
how I might be able to go about automating sending keystrokes to a DOS
program?
Hi Andrew,
I programmed something like this and it might do what you want. The
following constants and function allow a program to place up to 16
two-byte characters in the keyboard buffer. When the program exits
(without reading any of the characters, of course) DOS will execute the
command as though it had been typed.
#define KBQ_START 0x41E
#define KBQ_HEAD 0x41A
#define KBQ_TAIL 0x41C
void InsertCommand(char *command) {
int com_index = 0;
unsigned int qptr_segment = 0;
unsigned int qptr_start = KBQ_START;
int qptr_offset = 0;
pokeb(qptr_segment,KBQ_HEAD,0x1E);
while(command[com_index]) {
pokeb(qptr_segment,qptr_start + qptr_offset,command[com_index++]);
qptr_offset += 2;
}
pokeb(qptr_segment,qptr_start + qptr_offset,0xD);
qptr_offset += 2;
pokeb(qptr_segment,KBQ_TAIL,0x1E+qptr_offset);
}
Jim
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user