Jump to content
Sign in to follow this  
ddear

Trapping f 9 Key

Recommended Posts

ddear

New here, this program was recommended by a friend. I am not really a programmer, I do some simple scripting to get things done.

I am trying to figure out if AutoIt can do what I am looking for. I want to trap when the f9 key is pressed. The active application will be another program.I need to pause what the active application does.(I know the process and program exe). Once f9 is pressed, I want to do a couple things, and return to the active application. Is this possible? If possible just point me in the right direction, if I am out to lunch - let me know - cheers

Share this post


Link to post
Share on other sites
Tvern

Capturing F9 is easy. As long as you start your script before any other application registers it as a hotkey this should run a function when F9 is pressed. It also prevents F9 from being send to any other application.

HotKeySet("{F9}","_YourFunctionName") ;register F9 hotkey and bind it to your function

While 1
    Sleep(100) ;wait indefinately untill the hotkey is pressed
WEnd

Func _YourFunctionName()
    ConsoleWrite("F9 was pressed" & @CRLF) ;the function to execture once the hotkey is pressed
EndFunc

I can't help you with the contents of the function as I'm not clear on what you want it to do exactly. Is there a build in wait to pause the application? If so, how do you normally active it etc.

Share this post


Link to post
Share on other sites
ddear

I will try and figure out the rest... very interesting and thanks for the fast response! -d

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.