use lib qw(./lib ./blib/arch/auto/Win32/Shortkeys/Kbh); #use blib; use strict; use warnings; use Time::HiRes qw(usleep); use Win32::Shortkeys::Kbh qw(:hook :input VK_BACK VK_TAB); set_key_processor(sub { my ($cup, $code, $alt, $ext) = @_; return unless $cup == 0; print "process_key in perl cup: $cup code: $code alt: $alt ext: $ext \n"; // F12 to leave the script if ($code == 123) { unregister_hook(); } // s: hitting s in notepad replace s with the string below if ($code == 83) { usleep(400_000); send_cmd(1, VK_BACK); send_string("You hit the s key !!!"); } }); register_hook(); MsgLoop();