简体   繁体   English

自动热键循环中的相同热键

[英]Autohotkey same hotkey in loop

I am a complete noob in autohotkey and I basically need a script that uses the F1 key to execute multiple steps in a loop. 我在autohotkey中是一个完全菜鸟,基本上我需要一个使用F1键在循环中执行多个步骤的脚本。 Here is my current script... 这是我当前的脚本...

$F1::fileappend, `n<!><1><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><2><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><3><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><4><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><5><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><6><!>, C:\Users\Administrator\Documents\count.log
$F1::fileappend, `n<!><7><!>, C:\Users\Administrator\Documents\count.log

I understand why this doesn't work, I just need help making a script to loop through 1-7 using the same hotkey on press. 我知道为什么这行不通,我只需要帮助就可以制作一个脚本,用按下相同的热键在1-7之间循环。

Thanks in advance! 提前致谢! ^^ ^^

$F1::
Loop, 7
FileAppend,% "`n<!><" A_Index "><!>", C:\Users\Administrator\Documents\count.log
return

Thanks to budRich I've got my answer. 感谢budRich,我得到了答案。

n := 1

$F1::
FileAppend,% "`n<!><" n "><!>", C:\Users\Administrator\Documents\count.log
if (n>=7)
  n=0
n++
return

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

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