Reputation: 1005
I am trying to make a script that when press x
to cut, c
to copy and v
to paste if the ScrollLock is on.
Here is my script that is not working, it will perform cut, copy and paste no matter ScrollLock is on or off.
~ScrollLock::
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
If ScrollLockState = D
{
x:: Send, ^x
c:: Send, ^c
v:: Send, ^v
}
And for the script below, I cannot type x
, c
and v
when ScrollLock is off, but can cut, copy and paste when ScrollLock is on.
~ScrollLock::
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
x::
If ScrollLockState = D
{
Send, ^x
return
}
c::
If ScrollLockState = D
{
Send, ^c
return
}
v::
If ScrollLockState = D
{
Send, ^v
return
}
Upvotes: 1
Views: 491
Reputation: 6314
You can do it in the following way:
#If GetKeyState("ScrollLock", "T")
x::Send, ^x
c::Send, ^c
v::Send, ^v
#If
Upvotes: 4