Jump to content

_IsPressed


Recommended Posts

Ok so, I'm trying to make _IsPressed more efficient because if I just tap the key it doesn't register that I pressed it. And if I hold it for even a little it sends the command a bunch of times. This wouldn't normally be a problem but I'm trying to make it for sites that I go to. I always forget my password to sites. So I'm making it so that if I type in autoitscript it will go to autoitscript it will go to autoitscript.com and log me in automatically, I'm getting good enough at autoit to do all of that except the _IsPressed, it doesn't register it half the time and spams as mentioned above. Thanks.

~IKilledBambi

Link to comment
Share on other sites

Larry has already improved on this. There is a hook version he has made. Look for posts by LarryDalooza containing "hook" or "key hook".

Link to comment
Share on other sites

If you have found the afore-mentioned post could you share the link so others can find it easier (and save me from having to repeat this information)?

Link to comment
Share on other sites

im interested in this script..... but when i searched for it, i did come up with the results but when i ran the example i got an error

in the Dllcallback.au3 with @unicode not being a reconised macro.

will be keeping an eye on this as _ispressed is used alot in my scripts, and is sometimes a pain in the :mellow:

Link to comment
Share on other sites

Ok so, I'm trying to make _IsPressed more efficient because if I just tap the key it doesn't register that I pressed it. And if I hold it for even a little it sends the command a bunch of times. This wouldn't normally be a problem but I'm trying to make it for sites that I go to. I always forget my password to sites. So I'm making it so that if I type in autoitscript it will go to autoitscript it will go to autoitscript.com and log me in automatically, I'm getting good enough at autoit to do all of that except the _IsPressed, it doesn't register it half the time and spams as mentioned above. Thanks.

~IKilledBambi

Can't help you with the tap not registering, but if you want to prevent the key "spamming" of _IsPressed() without resorting to adding a non-system dll (like Larry's hook) then you just need something to check for when a key is pressed and then released. A simple While loop in conjuction with _IsPressed works perfectly well for me:

#include <Misc.au3>
$dll = DllOpen("user32.dll")

While 1
    _keyPress()
    Sleep(100)
WEnd

Func _KeyPress()
    If _IsPressed("41", $dll) OR _IsPressed("61") Then; check for "A" or "a"
        ToolTip(' "A" key is down')
        While _IsPressed("41", $dll) Or _IsPressed("61", $dll)
            Sleep(10)
        WEnd
        ToolTip(' "A" key is up')
    EndIf
    If _IsPressed("1B",$dll) Then;if "ESC" is pressed, then exit the script
        DllClose($dll)
        Exit
    EndIf
EndFunc
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
 Share

  • Recently Browsing   0 members

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