How to get a TP prog to pass keystrokes to another program??? 
Author Message
 How to get a TP prog to pass keystrokes to another program???

I have a program ABC.EXE which on starting always asks the user to choose the
graphics mode (1,2 or 3)  and whether to enable Adlib sound (y or n). I can by
pass this with something like  echo 3y|abc  and while the program starts OK,
certain modules when run lock up the whole PC. Is there anyway around this,
perhaps by delaying the speed with which the keystrokes are passed to ABC
using a little TP prog?

Feel free to mail me.

TIA

John



Wed, 18 Jun 1902 08:00:00 GMT  
 How to get a TP prog to pass keystrokes to another program???

Quote:

>I have a program ABC.EXE which on starting always asks the user to choose the
>graphics mode (1,2 or 3)  and whether to enable Adlib sound (y or n). I can by
>pass this with something like  echo 3y|abc  and while the program starts OK,
>certain modules when run lock up the whole PC. Is there anyway around this,
>perhaps by delaying the speed with which the keystrokes are passed to ABC
>using a little TP prog?

I have a Pascal source (KEYSIM.PAS), once published in a Dutch
computer hobby magazine, which stacks its parameters in the keyboard
buffer, so the next program you start will find it there. It is
included below.
Quote:

>Feel free to mail me.

You didn't include a mail address.
Quote:

>TIA

>John

{ KEYSIM.PAS : Keyboard simulation program

  Titel   : KEYSIM
  Version : 1.1
  Date    : Dec 17,1996
  Author  : J. Theunisz in HCC Nieuwsbrief 126, march 1990
            Slightly modified and translated to English by
            Bob Ferguson
  Language: Turbo Pascal v4.0 or higher

  KEYSIN stores its command parameters into the keyboard buffer.
  Use this program in a batch file before the program that needs
  this text as input.
  Example
    KEYSIM Y
    progname
  The program "progname" will get "Y" as an answer to its first
  question.

  Type KEYSIM without parameters for an explanation how to enter
  special key codes like function keys.

Quote:
}

PROGRAM KEYSIM;

var x,z,s: byte; code: integer; stg: string;

procedure Help;
begin
  writeln('KEYSIM v1.1   (c) 19-1-1989 by J. Theunisz  Haarlem, NL');
  writeln('Syntax: KEYSIM string1 [string2 ...]');
  writeln('Strings may contain [nnn] where "nnn" is a decimal ASCII');
  writeln('code. For instance [013] for ENTER. Function keys are');
  writeln('coded as [000;sss]. For instance F10=[000;068]');
  writeln('The keyboard buffer will hold 15 key codes.');
end;

procedure Submit(asci,scan: byte);
var
  BufHead: byte absolute $0000:$041A;
  BufTail: byte absolute $0000:$041C;
  BufKeyb: array[0..31] of byte absolute $0000:$041E;
begin
  BufKeyb[BufTail-30]:= asci; BufTail:= BufTail + 1;
  BufKeyb[BufTail-30]:= scan; BufTail:= BufTail + 1;
  if BufTail > 60 then BufTail:= 30;
end;

begin { program }
  if ParamCount = 0 then Help
  else begin
    stg:= ParamStr(1);
    for x:= 2 to ParamCount do stg:= Concat(stg,' ',ParamStr(x));
    x:= 1;
    repeat
      if stg[x] <> '[' then begin
        Submit(Ord(stg[x]),$1E); x:= x+1
      end
      else begin
        Val(Copy(stg,x+1,3),z,code);
        if stg[x+4] <> ';' then begin
          Submit(z,$1E); x:= x+5
        end
        else begin
          Val(Copy(stg,x+5,3),s,code); Submit(z,s); x:= x+9
        end;
      end;
    until x > Length(stg);
  end;
end.

-----------------------------------------
J.R. Ferguson, Amsterdam, The Netherlands

web: www.xs4all.nl/~ferguson
Freeware for DOS and Windows



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How would i program a serial link prog in TP

2. How to pass keystrokes to another windows application

3. Getting TP to compile a DOS program in Protected Mode

4. Need TP Communication Prog

5. Execute Pascal Prog from a Batch prog ?

6. tp-gls.zip Generalized least squares TP program

7. Passing Procedures as Parameters in TP 7.0

8. How does the TP compiler actually pass paramaters?

9. Getting Delphi or TP for Windows

10. TP 7 and getting the old toolboxes

11. Problem getting date going to DOS from TP

12. passing a result form procedure-->Main program

 

 
Powered by phpBB® Forum Software