Jump to content
Sign in to follow this  
a_Lexx

Sendkey function only

Recommended Posts

Good day!

I've tried to use AutoIt scripts in combination with Perl and met the following problem: I've created a small Autoit script with only one SendKey function, which receives command from a command line. I've noticed, that SendKey("{<any key> down}") command works only when autoit script is working, so after the script exists (almost immediately), buttons doesn't remains pressed. Is there any way to keep it pressed, when the scripts has already finished?

Share this post


Link to post
Share on other sites

It seems that you can hook user32.dll in perl, so you should be able to use it's keybd_event to do your keyboard control. Take a look at this:

http://perl.topictracer.com/articles/take_...t_explorer.html

The following code presses A and releases it in AutoIt. You should be able to compare this to the code in my link and see how they're doing the same thing in perl:

$akey = 0x41
$VK_NUMLOCK = 0x90
$KEYEVENTF_KEYUP = 0x02

$dll = DllOpen("user32.dll")
$result = DllCall($dll, "int", "keybd_event", "int", $akey, "int", 0, "int", 0, "ptr", 0)
$result = DllCall($dll, "int", "keybd_event", "int", $akey, "int", 0, "int", $KEYEVENTF_KEYUP, "ptr", 0)
DllClose($dll)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...