Using a hotkey in KeyWait

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nathan323
Posts: 44
Joined: 31 Jan 2016, 02:53
Location: Australia

Using a hotkey in KeyWait

18 Jul 2017, 07:02

I want to use a mouse button that has proven impossible to register (tried MouseHook, AHKHID). Seems easiest to use other suggestion in docs and define that button as an hotkey in my mouse software, then get the script to trigger from that hotkey. Tried using the example given (Ctrl+F1), but my script uses KeyWait, and KeyWait doesn't like using a hotkey.

Script:

Code: Select all

^F1::
KeyWait, ^F1, T.5
If ErrorLevel
  {
  Send ^!{Tab}
  Send {Ctrl Up}{AltUp}
  }
Else
  {
  Send !{Tab}
  Send {Alt Up}
  }
Return
I know I can use a single key, but I wanted to use at least 1 modifier to keep it unique.

Any way to use a hotkey with KeyWait?
User avatar
boiler
Posts: 16973
Joined: 21 Dec 2014, 02:44

Re: Using a hotkey in KeyWait

18 Jul 2017, 08:08

Not sure what you mean by KeyWait doesn't like using a hotkey. They are used together all the time. The issue is ^F1 is not a key, it's a key combination. Try using F1 in your KeyWait statement, and it will wait until that key is released.
nathan323
Posts: 44
Joined: 31 Jan 2016, 02:53
Location: Australia

Re: Using a hotkey in KeyWait

18 Jul 2017, 09:21

Ok, stand corrected. So is there a way to make a key combination to work with KeyWait? Like I said I want to stay away from a single key to avoid a conflict.
User avatar
boiler
Posts: 16973
Joined: 21 Dec 2014, 02:44

Re: Using a hotkey in KeyWait

18 Jul 2017, 10:20

I just told you how. Use F1 in the KeyWait statement. I didn't say you had to change your hotkey from ^F1. It will wait until F1 is released. You can follow it with another for Control if you want to make sure both are released.
nathan323
Posts: 44
Joined: 31 Jan 2016, 02:53
Location: Australia

Re: Using a hotkey in KeyWait

18 Jul 2017, 19:53

Ah I see, thanks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, haomingchen1998, mikeyww, Oblomov228, RussF, sanmaodo and 260 guests