Sign in to follow this  
Followers 0
strate

Keyboard Activity

7 posts in this topic

I have a program that loops really fast non-stop. I want the program to slow down to a crawl when nothing has been typed for a period of time. I know I can do something with the Timer functions with the mouse position to slow it down. I'm stumped with the keyboard part though. Can you pull the button being sent with the driver, or some other function? I don't think IsPressed will work for me.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



I think _IsPressed() would work, you just have to check enough keys. This in fact checks everything - all keys and mouse buttons.

#include <misc.au3>

HotKeySet ("{ESC}", "quitme")

While 1
    For $i = 1 To 255
        If _IsPressed (Hex ($i)) Then
            MsgBox (0, "pressed", $i)
        EndIf
    Next
WEnd

Func quitme()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

need a sleep in your while/wend loop

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Actually you don't _need_ one, it's just a nice thing to do.

Even with Sleep (100) it still uses 12% of CPU... interesting.

Share this post


Link to post
Share on other sites

I know you're right Larry, but I just did it to show that it could be done with _ispressed, and I don't really know a better way (I've tried something, but it didn't work out for me). If you'd like to say the way you'd do it (or PM me if posting it would be bad), that'd be really cool.

Share this post


Link to post
Share on other sites

ancient chinese secret...

Lar.

I remember that commercial... Wasn't that a 'Tide' Commercial? :lmao:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

GUIRegisterMsg + dll WH_KEYBOARD hook... but that's a key logger... ancient chinese secret...

Lar.

Could I get an example of the dllcall that uses GetAsyncKeyState? I believe it is in one of lazycats UDFs I want it so that I can try pluging in SendInput into it to see what I might get.

Thank you.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

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