[comp.lang.pascal] Turbo Pascal challenge: a program-running-program.

J_SCHULL%HVRFORD.BITNET@cornellc.cit.cornell.edu (10/19/89)

Not for the first time, I wish I had a program that would feed
keystrokes to another program (like SuperKey, but not memory
resident).  This would allow us to make a simple program which
could be run from DOS, which would in turn send a stereotyped
keystroke sequence to another (awkwardly "user-obsequieous")
program.


I imagine that you would just need to (somehow) put the
keystrokes into the keyboard buffer, and then EXEC the driven
program.  But I can't figure out how.  Can you?

Example:

  if the program were called RUN and you wanted it to run
  UGLYMENU, and choose menu items 2, 4, 6, and 9 in that order
  (9 terminates program UGLYMENU).  You might type

  A:>RUN UGLYMENU 2469

  from DOS, and UGLYMENU would think someone was typing "2469"
  and then terminate.  RUN would also terminate.  (The program
  would be useful in more complicated circumstances, but if I had
  the code for the example, I'd know how to proceed).

unkydave@shumv1.uucp (David Bank) (10/19/89)

In article <21186@adm.BRL.MIL> J_SCHULL%HVRFORD.BITNET@cornellc.cit.cornell.edu writes:
>
>Not for the first time, I wish I had a program that would feed
>keystrokes to another program (like SuperKey, but not memory
>resident).  This would allow us to make a simple program which
>could be run from DOS, which would in turn send a stereotyped
>keystroke sequence to another (awkwardly "user-obsequieous")
>program.
>
>
>I imagine that you would just need to (somehow) put the
>keystrokes into the keyboard buffer, and then EXEC the driven
>program.  But I can't figure out how.  Can you?
>
>Example:
>
>  if the program were called RUN and you wanted it to run
>  UGLYMENU, and choose menu items 2, 4, 6, and 9 in that order
>  (9 terminates program UGLYMENU).  You might type
>
>  A:>RUN UGLYMENU 2469
>
>  from DOS, and UGLYMENU would think someone was typing "2469"
>  and then terminate.  RUN would also terminate.  (The program
>  would be useful in more complicated circumstances, but if I had
>  the code for the example, I'd know how to proceed).

    Why bother reinventing the wheel??? Pick up a copy of PC
Magazine's "DOS Powertools" and use a program called
"KEY-FAKE.COM"
    Called from a batch file (its only limitation, but quite
a reasonable one) it fills the keyboard buffer with whatever
characters or strings you specify. You can denote them by
either text enclosed in quotes or by the ASCII values.
    You can usually pick this program up from BBSs that have
the old utility collection PC Magazine put out when they still
had their Interactive Reader Service up as a public board. Or
you can still reach that Service thru Compuscrew, but I doubt
the charges are worth it.
    That "DOS Powertools" book is a HUGE 1200+ page text written
by just about everyone on the PC Magazine staff and edited by
Paul Somerson. It has become a Holy Book on my computer reference
shelf, right next to my IBM repair manuals and and other similar
works.
    It retails for $54.95 and even without the disk of 200+
ready-to-use programs it is well worth it.

Unky Dave
unkydave@shumv1.ncsu.edu
(Careful about mailing me, if you do -- we're not in all the host
tables -> altername address: bank@cslimg.ncsu.edu)