Jump to content

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?

Link to comment
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:


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

$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)

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...