Board index » delphi » keyboard simulation

keyboard simulation

Hi y'all,

Is there a way to simulate keyboard-input to a PC (PC X) from within a
pascal program running on another PC (PC Y)? I want to give a signal
from PC Y, running a pascal executable under DOS, to a PC X, equipped
with software for measuring skin conductance responses. This SCR
software runs under Windows, and I have no source code of it. It can be
configured in such a way that its start-up is triggered by pressing a
user-defined key. But I want the SCR software's start up to be triggered
by certain events defined in the pascal program that runs on computer Y.
The only solution I can think of is connecting both computers somehow
and 'simulating' a keypress by sending an appropriate signal to the
keyboardport of computer X, but I don't even know whether this would be
technically possible.
I'm not sure that I've made myself perfectly clear, but any input would
be greatly appreciated.

Thanks in advance,

Tom Beckers

-----------------
tom beckers

centre for learning psychology
   and behaviour therapy
department of psychology
university of leuven
tiensestraat 102
b-3000 leuven
belgium

phone:  ++32 (0)16 32 59 53
fax:    ++32 (0)16 32 59 24

e-mail: tom.beck...@psy.kuleuven.ac.be
url: http://www.psy.kuleuven.ac.be/leerpsy/tom

 

Re:keyboard simulation


In article <39897B8A.1E833...@psy.kuleuven.ac.be>,
  Tom Beckers <tom.beck...@psy.kuleuven.ac.be> wrote:

Quote
> Hi y'all,

> Is there a way to simulate keyboard-input to a PC (PC X) from within a
> pascal program running on another PC (PC Y)?

I don't know your OS, but if it is DOS, have you looked into using
CTTY? It allows you to operate your PC from a remote PC connected to a
COM port. Only works if your application uses standard DOS calls to
read the keyboard.

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:keyboard simulation


Thanks, but I guess that won't work. As stated in the original post, the
to-be-controlled application runs in a Windows-environment. Anyone else
an idea?

Quote
byates...@my-deja.com wrote:

> In article <39897B8A.1E833...@psy.kuleuven.ac.be>,
>   Tom Beckers <tom.beck...@psy.kuleuven.ac.be> wrote:
> > Hi y'all,

> > Is there a way to simulate keyboard-input to a PC (PC X) from within a
> > pascal program running on another PC (PC Y)?

> I don't know your OS, but if it is DOS, have you looked into using
> CTTY? It allows you to operate your PC from a remote PC connected to a
> COM port. Only works if your application uses standard DOS calls to
> read the keyboard.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
-----------------
tom beckers

centre for learning psychology
   and behaviour therapy
department of psychology
university of leuven
tiensestraat 102
b-3000 leuven
belgium

phone:  ++32 (0)16 32 59 53
fax:    ++32 (0)16 32 59 24

e-mail: tom.beck...@psy.kuleuven.ac.be
url: http://www.psy.kuleuven.ac.be/leerpsy/tom

Re:keyboard simulation


Quote
On Thu, 3 Aug 2000, Tom Beckers wrote:
> Hi y'all,

> Is there a way to simulate keyboard-input to a PC (PC X) from within a
> pascal program running on another PC (PC Y)? I want to give a signal
> from PC Y, running a pascal executable under DOS, to a PC X, equipped
> with software for measuring skin conductance responses. This SCR
> software runs under Windows, and I have no source code of it. It can be
> configured in such a way that its start-up is triggered by pressing a
> user-defined key.

So you are under windoze when you need to press the key? I mean on windows
desktop yu need to press the key? Than i think you should read about
kernel and winapi dll's (press F1 under Borland pascal 7.0 - note that NOT
turbo pascal) and see it under dll reated section, maybe you will find a
kernel or api function of windows that emulates keypresses or mouse
events.

If you can trigger it under a full-screen running dos program too, than
you should download ralf browns interrupt list and search for a special
BIOS function that emulates keyboard presses.I used that for a rtick
similar but under real DOS and it worked.

Quote
> But I want the SCR software's start up to be triggered
> by certain events defined in the pascal program that runs on computer Y.
> The only solution I can think of is connecting both computers somehow
> and 'simulating' a keypress by sending an appropriate signal to the
> keyboardport of computer X, but I don't even know whether this would be
> technically possible.

Yes, as you say, connecting *SOMEHOW* is a good idea. I mean if you are
good in hardware, you would be able to make a trick: don't connect the
keyboard of the remotaly controlled machine directly, but trough a special
connector that is connected to the other pc. So if you press keys, it is
passed trough, and also if you can make good signs with the other pc it
woud be seen as it came from the keyb. It is possible, but i'm not good in
hardware so i don't knw how to do it exactly :)

Quote
> I'm not sure that I've made myself perfectly clear, but any input would
> be greatly appreciated.

I think you did, at lest i think i understand the problem :)

Anyway maybe you should find another way to run that program. Maybe there
is a way to run it simply from dos prompt with a special parameter
that tells it to pop up.

Or maybe it has DDE support? If so, you have another perspective to call
it.

Quote

> Thanks in advance,

> Tom Beckers

> -----------------
> tom beckers

> centre for learning psychology
>    and behaviour therapy
> department of psychology
> university of leuven
> tiensestraat 102
> b-3000 leuven
> belgium

> phone:  ++32 (0)16 32 59 53
> fax:    ++32 (0)16 32 59 24

> e-mail: tom.beck...@psy.kuleuven.ac.be
> url: http://www.psy.kuleuven.ac.be/leerpsy/tom

Re:keyboard simulation


Quote
> > configured in such a way that its start-up is triggered by pressing a
> > user-defined key.
> So you are under windoze when you need to press the key? I mean on windows
> desktop yu need to press the key? Than i think you should read about
> kernel and winapi dll's (press F1 under Borland pascal 7.0 - note that NOT
> turbo pascal) and see it under dll reated section, maybe you will find a
> kernel or api function of windows that emulates keypresses or mouse
> events.

> If you can trigger it under a full-screen running dos program too, than
> you should download ralf browns interrupt list and search for a special
> BIOS function that emulates keyboard presses.I used that for a rtick
> similar but under real DOS and it worked.

Afaik you can't do this with 32-bits applications. Without emulator VXD,
only windows programs may call the windows API. For dos programs it is
not in the scope.

Quote
> > But I want the SCR software's start up to be triggered
> > by certain events defined in the pascal program that runs on computer Y
> > The only solution I can think of is connecting both computers somehow
> > and 'simulating' a keypress by sending an appropriate signal to the
> > keyboardport of computer X, but I don't even know whether this would be
> > technically possible.

> Yes, as you say, connecting *SOMEHOW* is a good idea. I mean if you are
> good in hardware, you would be able to make a trick: don't connect the
> keyboard of the remotaly controlled machine directly, but trough a special
> connector that is connected to the other pc. So if you press keys, it is
> passed trough, and also if you can make good signs with the other pc it
> woud be seen as it came from the keyb. It is possible, but i'm not good in
> hardware so i don't knw how to do it exactly :)

Hmm. Simple but smart. A simple client (in a suitable 32-bit compiler)
under Win32 that puts all data on the serial bus. The other end pops it
off under windows. The only problem afaik is that you are limited to
a few meters serial cable.

Re:keyboard simulation


On Fri, 4 Aug 2000, Marco van de Voort wrote:

Quote
> > > configured in such a way that its start-up is triggered by pressing a
> > > user-defined key.
> > So you are under windoze when you need to press the key? I mean on windows
> > desktop yu need to press the key? Than i think you should read about
> > kernel and winapi dll's (press F1 under Borland pascal 7.0 - note that NOT
> > turbo pascal) and see it under dll reated section, maybe you will find a
> > kernel or api function of windows that emulates keypresses or mouse
> > events.

> > If you can trigger it under a full-screen running dos program too, than
> > you should download ralf browns interrupt list and search for a special
> > BIOS function that emulates keyboard presses.I used that for a rtick
> > similar but under real DOS and it worked.

> Afaik you can't do this with 32-bits applications. Without emulator VXD,
> only windows programs may call the windows API. For dos programs it is
> not in the scope.

> > > But I want the SCR software's start up to be triggered
> > > by certain events defined in the pascal program that runs on computer Y
> > > The only solution I can think of is connecting both computers somehow
> > > and 'simulating' a keypress by sending an appropriate signal to the
> > > keyboardport of computer X, but I don't even know whether this would be
> > > technically possible.

> > Yes, as you say, connecting *SOMEHOW* is a good idea. I mean if you are
> > good in hardware, you would be able to make a trick: don't connect the
> > keyboard of the remotaly controlled machine directly, but trough a special
> > connector that is connected to the other pc. So if you press keys, it is
> > passed trough, and also if you can make good signs with the other pc it
> > woud be seen as it came from the keyb. It is possible, but i'm not good in
> > hardware so i don't knw how to do it exactly :)

> Hmm. Simple but smart. A simple client (in a suitable 32-bit compiler)
> under Win32 that puts all data on the serial bus. The other end pops it
> off under windows. The only problem afaik is that you are limited to
> a few meters serial cable.

Hmm, yes, lngth limitation. But another idea: maybe the remote computer
sends tcp packets (unlimited length;) and one of the application on the
controlled computer catches it and writes out to the keyborard emulaton
device. So the computer controlls itself (with a short serial cable) by
TCP events that can came from hunderds of kilometers. Hmm, more
complicated :)

Lets race: who can think out the most complicated solution? :)

Re:keyboard simulation


Palinkas Tibor <pt...@hszk.bme.hu> schrieb in im Newsbeitrag:
Pine.GSO.4.21.0008051333300.25792-100000@ural2...

Quote

> On Fri, 4 Aug 2000, Marco van de Voort wrote:

> > > > configured in such a way that its start-up is triggered by pressing
a
> > > > user-defined key.
> > > So you are under windoze when you need to press the key? I mean on
windows
> > > desktop yu need to press the key? Than i think you should read about
> > > kernel and winapi dll's (press F1 under Borland pascal 7.0 - note that
NOT
> > > turbo pascal) and see it under dll reated section, maybe you will find
a
> > > kernel or api function of windows that emulates keypresses or mouse
> > > events.

> > > If you can trigger it under a full-screen running dos program too,
than
> > > you should download ralf browns interrupt list and search for a
special
> > > BIOS function that emulates keyboard presses.I used that for a rtick
> > > similar but under real DOS and it worked.

> > Afaik you can't do this with 32-bits applications. Without emulator VXD,
> > only windows programs may call the windows API. For dos programs it is
> > not in the scope.

> > > > But I want the SCR software's start up to be triggered
> > > > by certain events defined in the pascal program that runs on
computer Y
> > > > The only solution I can think of is connecting both computers
somehow
> > > > and 'simulating' a keypress by sending an appropriate signal to the
> > > > keyboardport of computer X, but I don't even know whether this would
be
> > > > technically possible.

> > > Yes, as you say, connecting *SOMEHOW* is a good idea. I mean if you
are
> > > good in hardware, you would be able to make a trick: don't connect the
> > > keyboard of the remotaly controlled machine directly, but trough a
special
> > > connector that is connected to the other pc. So if you press keys, it
is
> > > passed trough, and also if you can make good signs with the other pc
it
> > > woud be seen as it came from the keyb. It is possible, but i'm not
good in
> > > hardware so i don't knw how to do it exactly :)

> > Hmm. Simple but smart. A simple client (in a suitable 32-bit compiler)
> > under Win32 that puts all data on the serial bus. The other end pops it
> > off under windows. The only problem afaik is that you are limited to
> > a few meters serial cable.

> Hmm, yes, lngth limitation. But another idea: maybe the remote computer
> sends tcp packets (unlimited length;) and one of the application on the
> controlled computer catches it and writes out to the keyborard emulaton
> device. So the computer controlls itself (with a short serial cable) by
> TCP events that can came from hunderds of kilometers. Hmm, more
> complicated :)

> Lets race: who can think out the most complicated solution? :)

Perhaps I have an easy solution: Write your RC-Server in a Windows Pascal
compiler (TPW? Delphi? FPC?) and use SendMessage to send keypresses to your
program (or PostMessage)

Re:keyboard simulation


Quote
> Hmm, yes, lngth limitation. But another idea: maybe the remote computer
> sends tcp packets (unlimited length;) and one of the application on the
> controlled computer catches it and writes out to the keyborard emulaton
> device. So the computer controlls itself (with a short serial cable) by
> TCP events that can came from hunderds of kilometers. Hmm, more
> complicated :)

> Lets race: who can think out the most complicated solution? :)

Another wild one:

Hook with Delphi or so the apps message queues and manipulate them?
Get the data over WinSock :-)

--

Marco van de Voort (Mar...@stack.nl or ma...@freepascal.org)

Re:keyboard simulation


Hmm, seems you win :) The most complicated :) But let me think...

Hmm, disassemble the program first :) Than write it to be controlled by
socks. I think it is more complicated :)

On Sun, 6 Aug 2000, Marco van de Voort wrote:

Quote

> > Hmm, yes, lngth limitation. But another idea: maybe the remote computer
> > sends tcp packets (unlimited length;) and one of the application on the
> > controlled computer catches it and writes out to the keyborard emulaton
> > device. So the computer controlls itself (with a short serial cable) by
> > TCP events that can came from hunderds of kilometers. Hmm, more
> > complicated :)

> > Lets race: who can think out the most complicated solution? :)

> Another wild one:

> Hook with Delphi or so the apps message queues and manipulate them?
> Get the data over WinSock :-)

> --

> Marco van de Voort (Mar...@stack.nl or ma...@freepascal.org)

Re:keyboard simulation


Hi,
        I'think the easiest way will be to write a small programm in eg.
Visual
Basic which will listen on a COM port of PC X. Then from PC Y you will
send to COM port a command "press a key", then after receiving it PC X
programm should call API function SetKeyboardState  to simulate pressing
a key on PC X.

Quote
>>>>>>>>>>>>>>>>>> Pierwotna wiadomo?? <<<<<<<<<<<<<<<<<<

Am 2000-08-04, 12:08:24, napisa3 Tom Beckers
<tom.beck...@psy.kuleuven.ac.be> na temat Re: keyboard simulation:
Quote
> Thanks, but I guess that won't work. As stated in the original post, the
> to-be-controlled application runs in a Windows-environment. Anyone else
> an idea?
> byates...@my-deja.com wrote:

> > In article <39897B8A.1E833...@psy.kuleuven.ac.be>,
> >   Tom Beckers <tom.beck...@psy.kuleuven.ac.be> wrote:
> > > Hi y'all,

> > > Is there a way to simulate keyboard-input to a PC (PC X) from within a
> > > pascal program running on another PC (PC Y)?

> > I don't know your OS, but if it is DOS, have you looked into using
> > CTTY? It allows you to operate your PC from a remote PC connected to a
> > COM port. Only works if your application uses standard DOS calls to
> > read the keyboard.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> --
> -----------------
> tom beckers
> centre for learning psychology
>    and behaviour therapy
> department of psychology
> university of leuven
> tiensestraat 102
> b-3000 leuven
> belgium
> phone:  ++32 (0)16 32 59 53
> fax:    ++32 (0)16 32 59 24
> e-mail: tom.beck...@psy.kuleuven.ac.be
> url: http://www.psy.kuleuven.ac.be/leerpsy/tom

Re:keyboard simulation


Hi,
        I'think the easiest way will be to write a small programm in eg.
Visual
Basic which will listen on a COM port of PC X. Then from PC Y you will
send to COM port a command "press a key", then after receiving it PC X
programm should call API function SetKeyboardState  to simulate pressing
a key on PC X.

Quote
>>>>>>>>>>>>>>>>>> Pierwotna wiadomo?? <<<<<<<<<<<<<<<<<<

Am 2000-08-04, 12:08:24, napisa3 Tom Beckers
<tom.beck...@psy.kuleuven.ac.be> na temat Re: keyboard simulation:
Quote
> Thanks, but I guess that won't work. As stated in the original post, the
> to-be-controlled application runs in a Windows-environment. Anyone else
> an idea?
> byates...@my-deja.com wrote:

> > In article <39897B8A.1E833...@psy.kuleuven.ac.be>,
> >   Tom Beckers <tom.beck...@psy.kuleuven.ac.be> wrote:
> > > Hi y'all,

> > > Is there a way to simulate keyboard-input to a PC (PC X) from within a
> > > pascal program running on another PC (PC Y)?

> > I don't know your OS, but if it is DOS, have you looked into using
> > CTTY? It allows you to operate your PC from a remote PC connected to a
> > COM port. Only works if your application uses standard DOS calls to
> > read the keyboard.

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> --
> -----------------
> tom beckers
> centre for learning psychology
>    and behaviour therapy
> department of psychology
> university of leuven
> tiensestraat 102
> b-3000 leuven
> belgium
> phone:  ++32 (0)16 32 59 53
> fax:    ++32 (0)16 32 59 24
> e-mail: tom.beck...@psy.kuleuven.ac.be
> url: http://www.psy.kuleuven.ac.be/leerpsy/tom

Other Threads