【问题标题】:AutohotKey start/stop same key pressAutohotKey 启动/停止相同的按键
【发布时间】:2015-08-11 01:20:57
【问题描述】:

这个脚本应该在按键被按下时启动/停止。我希望那是同一个键。示例我按 F3 启动,然后再次按 F3 停止它。它会慢慢地从 0000 数到 9999,并在你停止循环时记住你在哪里。出于某种原因,它会启动,但是当我再次按 F3 时它不会停止。按照这个例子http://www.autohotkey.com/docs/FAQ.htm#repeat 我究竟做错了什么?

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

start = 0000
Run = false

F3::                       
SetFormat, Float, 04.0
current = %start%

if Run {
    Run := false
    return 
}

Run := true
Loop, 9999{
    Send e                      
    Sleep, 760 

    TrayTip, PinCode BruteForce, %current%, , 16
    Send %current%                  
    current += 1.0
    start += 1.0
    Sleep, 700

    if(current = 10000){
        Break
    }

    if (not Run){
        Break
    }
}

Run := false
return

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    您缺少#MaxThreadsPerHotkey,可以在您发布的链接中找到它。它的默认值为1,所以一旦你按下F3,它就不能再被触发了。增加它,这样热键就可以按照您想要的方式自行中断。

    以下是其他三种阻止操作执行的方法:

    • 使用timer 代替循环并切换其状态
    • 使用pause 命令
    • 使用goto 命令

    【讨论】:

    • 成功了,谢谢! autohotkey 的新手,所以我没有意识到这是命令的一部分。
    猜你喜欢
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 2019-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多