Home: Perl Programming Help: Beginner:
Input simultaniously in perl and txt


Oct 3, 2012, 5:42 AM

Views: 2382
Input simultaniously in perl and txt


I seriously can't find out how to do this, first i'll give you the sample code:

#!/usr/bin/perl -w
#sascii - show ASCII values for keypresses

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 make this a .pl program you'll see that when the program is started you get a hex value in return for every key you press... so for example push the spacebar and hex=20. But that is only if you push the spacebar in the cmd (anyway I use it from the cmd). But I wan't to use it from a notepad / wordpad / MSword file.

In short:
Run Program
Open notepad (automated by starting up the program)
Type stuff
exit notepad
return to cmd
and see output + hex values

Really hope you can help me, its the last touch on my program



Veteran / Moderator

Oct 3, 2012, 6:57 AM

Views: 2380
Re: [HarryAchterdeur] Input simultaniously in perl and txt

Sounds like you're trying to figure out how to write a keylogger malware program.


Oct 3, 2012, 7:00 AM

Views: 2378
Re: [FishMonger] Input simultaniously in perl and txt

Yeah I know it sounds like it but im writing a program that analyses typing behaviour.. And I don't want it by any means to be hidden or something... Im trying to build an interface for my users so that they can type normally instead of vertically if you'd seen the output from this program.

Veteran / Moderator

Oct 3, 2012, 4:49 PM

Views: 2366
Re: [HarryAchterdeur] Input simultaniously in perl and txt

It's probably possible to do this in Perl, but not on its own. You'll need to embed C code that accesses low level system functions.