Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Run perl simultaniously with notepad

by Carnyx (Initiate)
on Oct 03, 2012 at 14:33 UTC ( #997071=perlquestion: print w/replies, xml ) Need Help??
Carnyx has asked for the wisdom of the Perl Monks concerning the following question:

Namasté, !first of all I am not building in any way a keylogger or something like that! What I am actually building is a program to analyse typing behaviour. I don't need keylogger or hidden stuff. This is an example I used as a base for my program:

use Term::ReadKey ReadMode ('cbreak'); print "Press keys to see their ASCII values. Use Ctrl-C to quit.\n" while (1){ $char = ReadKey (0); last unless defined $char; printf("Hex: %x\n", ord($char), ord($char)); } ReadMode ('normal');

If you execute this in perl you'll get the Hex code for every character you type at the exact same time you type it. So for example "spacebar = 20 in hex". But this output comes vertically and without the actual typed-in key. Showing the key is not a problem offcourse. That actually worked with my solution. But I would like my users to type in notepad. So that the output in notepad eq "Hallo i am harry" and the output in perl is like:"

H Hex: 68 a Hex: 61 l Hex: 6c l Hex: 6c o Hex: 6f Hex: 20 I Hex: 69 Hex: 20 a Hex: 61 m Hex: 6d etc etc etc etc etc
Could you please help me with this... I deliberately did not post my reading part of the program (dont like malicious). If you don't want to post the solution, because it can be used for evil, can you please PM me or somthing? Greetz, Harry

Replies are listed 'Best First'.
Re: Run perl simultaniously with notepad
by zentara (Archbishop) on Oct 03, 2012 at 15:32 UTC
    I don't use Windows, but why don't you work it the other way, that is let your windowed widget ( i.e.Notebook) receive the keystrokes, then just record them to a file? You might want to look at Win32 API keyboard hooks

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Run perl simultaniously with notepad
by Anonymous Monk on Oct 03, 2012 at 15:43 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997071]
Approved by herveus
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-05-20 20:44 GMT
Find Nodes?
    Voting Booth?