kite
kite

Reputation: 313

How do I use a variable to define key up/down?

test(key){
    send "{key down}" ;no
    ; send "{%key% down}" ;no
    sleep 500
    send "{key up}"
}
test("w") ;test(w) doesnt work either as per the manual

%key% works in AutoHotkey v1. For AutoHotkey v2 it says this works but it doesn't :

if InStr(MyVar, "fox")
    MsgBox "The variable MyVar contains the word fox."

Upvotes: -2

Views: 48

Answers (1)

kite
kite

Reputation: 313

key:="up"
send "{" key " down}" 

is equivalent to

send "{up down}" 

Upvotes: 1

Related Questions