advis0r Posted March 7, 2006 Posted March 7, 2006 hi there, i want to control an app with my keyboard (usually you have to use the mouse), everything works allright but i want the hotkeys only to work within certain windows (indicated by their title) i started using IF WinActive($WINDOW_TEXT) THEN ... and it semi-works, functions wont be called in other windows, but the problem is, that the hotkeyed keys are not usuable in the other windows either (like when i switch to the script editor i cannt move the cursor with the arrow keys since they are bound in my script) is there a way to get around that i.e. make hotkeys only available under given conditions (window handle, window title etc) ? would be really useful, sorry if i didnt find it in the forums yet
CyberSlug Posted March 7, 2006 Posted March 7, 2006 (edited) Something like this should work. $winTitle = "Title of window where I want the hotkeys" While 1 sleep(100);don't max-out CPU If WinActive($winTitle) Then EnableHotKeys() Else DisableHotkeys() EndIf WEnd Func EnableHotkeys() HotKeySet("!^a", "foo") HotKeySet("!^b", "foo") EndFunc Func DisableHotkeys() HotKeySet("!^a") HotKeySet("!^b") EndFunc Func foo() ;... EndFunc Func bar() ;... EndFunc Edited March 7, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
advis0r Posted March 7, 2006 Author Posted March 7, 2006 (edited) thanks, i loaded the hotkeys from an ini file and so i had to make variables for the bound key globally in order to not read from harddisc every 100ms Edited March 7, 2006 by advis0r
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now