简体   繁体   English

如何向此脚本添加切换 function

[英]how to add a toggle function to this script

f:: Send {p down} f:: 发送 {p down}
Sleep 200睡眠 200
Send {p up} sleep, 899 Send, 7 return发送{p up} sleep,899发送,7返回

2:: Send {o down} 2:: 发送 {o down}
Sleep 200睡眠 200
Send {o up} Send, 7 sleep, 899 Send, 7 return发送 {o up} 发送,7 休眠,899 发送,7 返回

capslock::suspend return大写锁定::暂停返回

I would like to add a toggle function to this script, example: holding down mouse 2, changes "7" to "8" in the script is something like that possible?我想在此脚本中添加一个开关 function,例如:按住鼠标 2,将脚本中的“7”更改为“8”是否可能?

I have tried many ways but unfortunately my knowledge in ahk is too small to do it.我尝试了很多方法,但不幸的是我对 ahk 的了解太少而无法做到。

var = 7
f::
    Send {p down}
    Sleep 200
    Send {p up}
    sleep, 899
    Send, %var%
return

2::
    Send {o down}
    Sleep 200
    Send {o up}
    Send, %var%
    sleep, 899
    Send, %var%
return

capslock::
    suspend
return

~RButton::
    var := GetKeyState( "RButton", "P" ) ? 8 : 7
Return

thenks you very much, its almost work.非常感谢你,它几乎工作。 when I release the mouse button, the script doesn't go back to "7" and it keeps the value of 8 all the time.当我释放鼠标按钮时,脚本不会将 go 变回“7”,它始终保持值 8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM