简体   繁体   中英

Autohotkey how to make this toggle when I press F4?

I am pretty new at this, so this code could be very broken within itself, but the goal is for it to basically alternate between clicking from left to right over and over. Of course, for efficiency, I would like to toggle it. I cannot find the solution after reading multiple articles, so any help would appreciated. Thanks.

~$F4::
While GetKeyState("F4", "P"){
        Send, {Click down}
        sleep 50
        Send, {Click up}
        sleep 50
        Send, {Click down right}
        sleep 50
        Send, {Click up right}
        sleep 50
}
return
~$F4::
While GetKeyState("F4", "P"){
        Send, {LButton down}
        sleep 50
        Send, {LButton up}
        sleep 50
        Send, {RButton down}
        sleep 50
        Send, {RButton up}
        sleep 50
}
return

Your mistake is that you are not using right key names in Send command and also command parameters are not in right place. First parameter should be name of the key. You can get the list of all keys here: http://ahkscript.org/docs/KeyList.htm . Second parameter should be the state of the key (up, down).

Also, always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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