Oh Xyz
Oh Xyz

Reputation: 75

How do I get the key's value after I release the key

I understand by using for example,

Space & a::b

I can have b by holding Space then press a. However this disable the Space's output. How do I get a Space character, for example by releasing Space key or press Space key twice.

Upvotes: 1

Views: 76

Answers (2)

Chema
Chema

Reputation: 745

You have to bind Space to send itself:

Space & a::b
Space::Send {Space}

I would advise against using a common key as a prefix, however: a prefix key will lose any "on press" and repeat capabilities. So with this script, Space won't write many spaces, only one, and only on release (and you'll wonder for a while why can't you bunny hop in your fav game anymore, every time!).

Just typing text feels awkward right now, the slight delay after every space causing mistakes.

I'd recommend at least using a whitelist to restrict the hotkey to the programs where you need it:

SetTitleMatchMode RegEx
#IfWinActive "i)notepad|word|thunderbird"
Space & a::b
Space::Send {Space}    

Or some such.

Upvotes: 1

D. Pardal
D. Pardal

Reputation: 6597

Try this:

#If GetKeyState("Space")
a::b

Upvotes: 0

Related Questions