Sign in to follow this  
Followers 0
IKilledBambi

_IsPressed

8 posts in this topic

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

Share this post


Link to post
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".

Share this post


Link to post
Share on other sites

Thanks alot! I LOVE YOU LARRYYYY!!! :mellow:

Share this post


Link to post
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)?

Share this post


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

Share this post


Link to post
Share on other sites

Works fine for me, two things to check, is you hook.dll in the same folder as your script? Are you using an updated autoit?(I didn't test with beta.)

Share this post


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

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  
Followers 0