here is a tsr program to supply keyboard input to another program
i am asking for help in programming it and we can all use it
i hope i am not reinventing the wheel here.
well most of the work is done i believe except for
some error routines
memory reducing
unloading the program from memmory by the command prompt
i use tsrmark and tsrremv to solve these program now
maybe some adjusting on times concerning the popup stuff command
a data file to provide keyboard input can be any file
all timing is based on a one-half (.5) second
for example if the first line is a number of 10, the program will wait
about 5 seconds before suppling input
the minium input of time if 0 is replaced with a value of 1 so a one-haf
second pause between inputs is the least
the first line in the data file is how long the tsr will wait before supplying
keyboard input
the remaining of the data files is a string then a number - comma delimited
for special key characters, they will will start with << and end with >>
so a carriage return will be <<cr>> and down cursor will be <<dn>>
a listing of the program is first followed by a sample data file to that list
the keyboard entrys made .
thanks your help in advance.
--------------------------------------------------------------
--------------------------------------------------------------
the start of the data file listing
--------------------------------------------------------------
6
"dir",1
"<<CR>>",8
"see the brown fox",3
"<<CR>>",3
"see the red fox",3
"<<CR>>",3
--------------------------------------------------------------
the end of the data file listing
------------------
[This message has been edited by paul d purvis (edited May 29, 2006).]
i am asking for help in programming it and we can all use it
i hope i am not reinventing the wheel here.
well most of the work is done i believe except for
some error routines
memory reducing
unloading the program from memmory by the command prompt
i use tsrmark and tsrremv to solve these program now
maybe some adjusting on times concerning the popup stuff command
a data file to provide keyboard input can be any file
all timing is based on a one-half (.5) second
for example if the first line is a number of 10, the program will wait
about 5 seconds before suppling input
the minium input of time if 0 is replaced with a value of 1 so a one-haf
second pause between inputs is the least
the first line in the data file is how long the tsr will wait before supplying
keyboard input
the remaining of the data files is a string then a number - comma delimited
for special key characters, they will will start with << and end with >>
so a carriage return will be <<cr>> and down cursor will be <<dn>>
a listing of the program is first followed by a sample data file to that list
the keyboard entrys made .
thanks your help in advance.
--------------------------------------------------------------
Code:
REM TSRKMACR.BAS REM POWERBASIC SOURCE CODE REM TO SUPPLY ANSWERS TO PROGRMS FROM A FILE PLACED ON THE COMMAND LINE REM VERSION 05-29-2006 REM COMPILED WITH POWERBASIC 3.5 FOR DOS REM $CPU 80386 'program works on any CPU $OPTIMIZE SPEED 'make FASTEST possible executable $DEBUG MAP OFF 'turn off map file generation $DEBUG PBDEBUG OFF 'don't include pbdebug support in our executable $LIB COM OFF 'turn off PowerBASIC's communications library. $LIB CGA OFF 'turn off PowerBASIC's CGA graphics library. $LIB EGA OFF 'turn off PowerBASIC's EGA graphics library. $LIB LPT OFF 'turn off PowerBASIC's printer support library. $LIB IPRINT OFF 'turn off PowerBASIC's interpreted print library. $LIB FULLFLOAT OFF 'turn off PowerBASIC's floating point support. $ERROR BOUNDS ON 'turn on bounds checking $ERROR NUMERIC OFF 'turn off numeric checking $ERROR OVERFLOW OFF 'turn off overflow checking $ERROR STACK OFF 'turn off stack checking $COM 0 'set communications buffer to nothing $STRING 32 'set largest string size at 32k $STACK 4096 'let's use a 2k stack $SOUND 1 'smallest music buffer possible $STATIC $OPTION CNTLBREAK OFF 'don't allow Ctrl-Break to exit program $COMPILE EXE 'this tells PB to make a standalone EXE $EVENT OFF DIM MACROWAIT%(1600) DIM MACROKEY$(1600) x& = SETMEM( -700000 ) 'release unused memory MACROFILE$=COMMAND$ IF MACROFILE$="" THEN GOTO NOTAIL ON ERROR GOTO FINDFILENO OPEN MACROFILE$ FOR INPUT AS #1 CLOSE 1 ON ERROR GOTO ERRORINFILE FIRSTTIME%=0 MACROLINES%=0 OPEN MACROFILE$ FOR INPUT AS #1 INPUT #1, FIRSTTIME% DO UNTIL EOF(1) INPUT #1, A$,A% MACROLINES%=MACROLINES%+1 LOOP CLOSE 1 ON ERROR GOTO FINISHERR OPEN MACROFILE$ FOR INPUT AS #1 INPUT #1, FIRSTTIME% FOR I%=1 TO MACROLINES% INPUT #1, MACROKEY$(I%),A% IF LEN(MACROKEY$(I%))<>6 THEN GOTO 11 IF UCASE$(MACROKEY$(I%))="<<CR>>" THEN MACROKEY$(I%)=CHR$(13) IF UCASE$(MACROKEY$(I%))="<<UP>>" THEN MACROKEY$(I%)=CHR$(0,0,&H48) IF UCASE$(MACROKEY$(I%))="<<DN>>" THEN MACROKEY$(I%)=CHR$(0,0,&H50) IF UCASE$(MACROKEY$(I%))="<<LT>>" THEN MACROKEY$(I%)=CHR$(0,0,&H4B) IF UCASE$(MACROKEY$(I%))="<<RT>>" THEN MACROKEY$(I%)=CHR$(0,0,&H4D) IF UCASE$(MACROKEY$(I%))="<<PU>>" THEN MACROKEY$(I%)=CHR$(0,0,&H49) IF UCASE$(MACROKEY$(I%))="<<PD>>" THEN MACROKEY$(I%)=CHR$(0,0,&H51) IF UCASE$(MACROKEY$(I%))="<<NL>>" THEN MACROKEY$(I%)=CHR$(0,0,&H45) IF UCASE$(MACROKEY$(I%))="<<CL>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3A) IF UCASE$(MACROKEY$(I%))="<<SL>>" THEN MACROKEY$(I%)=CHR$(0,0,&H46) IF UCASE$(MACROKEY$(I%))="<<F1>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3B) IF UCASE$(MACROKEY$(I%))="<<F2>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3C) IF UCASE$(MACROKEY$(I%))="<<F3>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3D) IF UCASE$(MACROKEY$(I%))="<<F4>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3E) IF UCASE$(MACROKEY$(I%))="<<F5>>" THEN MACROKEY$(I%)=CHR$(0,0,&H3F) IF UCASE$(MACROKEY$(I%))="<<F6>>" THEN MACROKEY$(I%)=CHR$(0,0,&H40) IF UCASE$(MACROKEY$(I%))="<<F7>>" THEN MACROKEY$(I%)=CHR$(0,0,&H41) IF UCASE$(MACROKEY$(I%))="<<F8>>" THEN MACROKEY$(I%)=CHR$(0,0,&H42) IF UCASE$(MACROKEY$(I%))="<<F9>>" THEN MACROKEY$(I%)=CHR$(0,0,&H43) 11 IF LEN(MACROKEY$(I%))<>7 THEN GOTO 12 IF UCASE$(MACROKEY$(I%))="<<INS>>" THEN MACROKEY$(I%)=CHR$(0,0,&H52) IF UCASE$(MACROKEY$(I%))="<<F10>>" THEN MACROKEY$(I%)=CHR$(0,0,&H44) IF UCASE$(MACROKEY$(I%))="<<F11>>" THEN MACROKEY$(I%)=CHR$(0,0,&HD9) IF UCASE$(MACROKEY$(I%))="<<F12>>" THEN MACROKEY$(I%)=CHR$(0,0,&HDA) IF UCASE$(MACROKEY$(I%))="<<END>>" THEN MACROKEY$(I%)=CHR$(0,0,&H4F) IF UCASE$(MACROKEY$(I%))="<<PTR>>" THEN MACROKEY$(I%)=CHR$(0,0,&H37) IF UCASE$(MACROKEY$(I%))="<<DEL>>" THEN MACROKEY$(I%)=CHR$(0,0,&H53) 12 IF UCASE$(MACROKEY$(I%))="<<HOME>>" THEN MACROKEY$(I%)=CHR$(0,0,&H47) IF A%=0% THEN A%=1% MACROWAIT%(I%)=A%*9% NEXT I% CLOSE 1 ON ERROR GOTO FINISH POPUP TIMER FIRSTTIME%*9% POPUP SLEEP POPUP TIMER 9 10 KBUFFER%=POPUP(3) IF KBUFFER%=0 THEN POPUP SLEEP IF KBUFFER%=0 THEN GOTO 10 FOR I%=1 TO MACROLINES% KEYSTROKE$=MACROKEY$(I%) NEWKEYSTROKE: KBUFFER%=POPUP(3) IF LEN(KEYSTROKE$)>KBUFFER% THEN TEMP$=LEFT$(KEYSTROKE$,KBUFFER%) B$=RIGHT$(KEYSTROKE$,LEN(KEYSTROKE$)-KBUFFER%) POPUP STUFF TEMP$,2,0 POPUP TIMER 9 POPUP SLEEP KEYSTROKE$=B$ GOTO NEWKEYSTROKE END IF POPUP STUFF KEYSTROKE$,0,0 IF I%=MACROLINES% THEN I%=0:GOTO FINISHTSR IF MACROWAIT%(I%)<0% THEN I%=0:GOTO FINISHTSR POPUP TIMER MACROWAIT%(I%) POPUP SLEEP NEXT I% GOTO FINISH FINISHTSR: I%=I%+1 POPUP TIMER 73 POPUP SLEEP IF POPUP(1) THEN GOTO FINISH IF I%=3330 THEN GOTO FINISH GOTO FINISHTSR FINDFILENO: PRINT "cannot find the keyboard macro file listed on the command tail" GOTO FINISH NOTAIL: PRINT "command tail is blank, place a keyboard macro file on the command tail" GOTO FINISH ERRORINFILE: PRINT "There was a problem reading the file "+MACROFILE$ PRINT "around line number "+STR$(MACROLINES%) FINISHERR: PRINT "There was an error filling keystrokes" PRINT "around line number "+STR$(MACROLINES%)+" in "+MACROFILE$ FINISH: STOP END
the start of the data file listing
--------------------------------------------------------------
6
"dir",1
"<<CR>>",8
"see the brown fox",3
"<<CR>>",3
"see the red fox",3
"<<CR>>",3
--------------------------------------------------------------
the end of the data file listing
------------------
[This message has been edited by paul d purvis (edited May 29, 2006).]
Comment