bleh

Is it possible to "hook" keys?

8 posts in this topic

Hey,

I want to leave an autoit file running in the background that looks for a key i press.
However, is it possible to "hook" the key that the key press ONLY sends to the autoit script and not to whatever program i currently work in?

Share this post


Link to post
Share on other sites



Your first sentence sounds like a keylogger.

Your second sentence sounds like you want to use AccelKeys. Accel keys are like hotkeys that are only active when your GUI is in focus.

What are you trying to do? Could we get some more info.

Share this post


Link to post
Share on other sites

No, if i wanted a keylogger it would have to look for every key pressed, wouldn't it?

I want to control an autoit script that is running in the background with my keyboard. Let's say with the F1 key.
Now the problem is, if i am in - for example - notepad and press F1, it will open the windows help, i don't want that.

I want to know if there is a way that the F1 key only gets recognized by autoit and not by notepad, while focus is not on the autoit script.

Share this post


Link to post
Share on other sites
HotKeySet("{F1}", "Function")

 

Share this post


Link to post
Share on other sites

This works great! Exactly what i was looking for. Thanks to you two!

Thanks

Share this post


Link to post
Share on other sites

Another way of course, is to use _IsPressed, but you would need to be careful, and certainly use the DLL option for repetitive checking. That could solve the issue regarding another active program, but will chew up processing cycles if called too often, so a Sleep would be necessary. You would have to make it a unique key combo as well, or risk issues related to that, when using an editor or any program that takes input, etc.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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