Venya
Venya

Reputation: 198

ahk #If not working?

any ideas what I'm doing wrong?

#If (GetKeyState("ScrollLock"))

NumpadUp::Send, #{Tab}

NumpadPgUp::Send, {Media_Play_Pause}

NumpadLeft::Send, ^#{Left}

NumpadRight::Send, ^#{Right}

NumpadAdd::Send, ^#d

NumpadSub::Send, ^#{F4}

#If

this is suppose to make is so when scroll lock is on (I found a use for it! XD) the numpad arrow keys allow me to quickly switch between the virtual desktops in windows 10

it works if I remove the #If

thoughts?

Upvotes: 0

Views: 319

Answers (1)

Relax
Relax

Reputation: 10636

T retrieves the toggle state of keys that can be toggled such as Capslock, Numlock, Scrolllock, and Insert.

https://autohotkey.com/docs/commands/GetKeyState.htm#Parameters

#If GetKeyState("ScrollLock","T")

    NumpadUp::Send, #{Tab}

    NumpadPgUp::Send, {Media_Play_Pause}

    NumpadLeft::Send, ^#{Left}

    NumpadRight::Send, ^#{Right}

    NumpadAdd::Send, ^#d

    NumpadSub::Send, ^#{F4}

#If

Upvotes: 2

Related Questions