2017-09-04 84 views
1

我正在嘗試創建一個腳本,當按x剪切時,c複製,v粘貼,如果ScrollLock打開。按ScrollLock鍵時執行操作AutoHotKey

這是我的腳本不工作,無論ScrollLock打開還是關閉,它都會執行剪切,複製和粘貼。

~ScrollLock:: 
KeyWait, ScrollLock 
GetKeyState, ScrollLockState, ScrollLock, T 
If ScrollLockState = D 
{ 
    x:: Send, ^x 
    c:: Send, ^c 
    v:: Send, ^v 
} 

而對於下面的腳本,我不能鍵入xcv時ScrollLock鍵處於關閉狀態,但可以剪切,複製和粘貼時ScrollLock鍵上。

~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 
} 

回答

4

你可以做到這一點通過以下方式:

#If GetKeyState("ScrollLock", "T") 
x::Send, ^x 
c::Send, ^c 
v::Send, ^v 
#If