Autohotkey 我的脚本在某个时候崩溃了,我';我消除了调试器能够发现的所有语法错误

Autohotkey 我的脚本在某个时候崩溃了,我';我消除了调试器能够发现的所有语法错误,autohotkey,Autohotkey,这是一个脚本,应该使用windows剪贴工具从在线图库中按顺序截取图片。如果有人能发现问题,我们将不胜感激 #SingleInstance, Force a := 112 name :=1 x:: Pause, Toggle y:: ExitApp Loop, a { MouseClickDrag, Left, 1300, 210, 645, 140 Sleep, 100 MouseClick, Left, 1277, 1038, 0, 5 sleep,

这是一个脚本,应该使用windows剪贴工具从在线图库中按顺序截取图片。如果有人能发现问题,我们将不胜感激

    #SingleInstance, Force

a := 112
name :=1
x:: Pause, Toggle
y:: ExitApp
Loop, a
{
    MouseClickDrag, Left, 1300, 210, 645, 140
    Sleep, 100
    MouseClick, Left, 1277, 1038, 0, 5
    sleep, 100
    MouseClick, Left, 838, 64, 0, 5
    sleep, 100
    SendInput, %name%
    name ++
    sleep, 100
    SendInput, {Enter}
    Sleep, 100
    MouseClickDrag, Left, 670, 13, 1393, 153
    Sleep, 100
    MouseClick, Left, 500, 490, 0, 5
    Sleep, 300
    MouseClick, Left, 500, 490, 0, 5
    SendInput, {Right}
}
其中有两个问题

首先,您的循环是无法访问的代码。
遇到第一个热键标签时,代码执行停止。这就是所谓的

其次,循环不将表达式带到第一个参数。它采用传统的文本参数。因此,您可能希望使用引用变量的传统方式,即
%a%
,但就个人而言,我会推动您使用现代表达式语法,并通过先用
%
再加一个空格将表达式强制为该参数。所以
循环,%a

若要了解有关遗留语法和表达式语法的更多信息,请参阅文档的第页


以下是您的固定脚本:

#SingleInstance, Force

a := 112
name := 1
Sleep, 3000
Loop, % a
{
    MouseClickDrag, Left, 1300, 210, 645, 140
    Sleep, 100
    MouseClick, Left, 1277, 1038, 0, 5
    Sleep, 100
    MouseClick, Left, 838, 64, 0, 5
    Sleep, 100
    SendInput, % name
    name++
    Sleep, 100
    SendInput, {Enter}
    Sleep, 100
    MouseClickDrag, Left, 670, 13, 1393, 153
    Sleep, 100
    MouseClick, Left, 500, 490, 0, 5
    Sleep, 300
    MouseClick, Left, 500, 490, 0, 5
    SendInput, {Right}
}

;this return here ends the auto-execute section
;but of course, in this specific case it's totally
;useless since the next line is a hotkey label
;which would also stop the auto-execute section
return

;even though the code execution gets stuck inside the loop, 
;hotkeys can be specified down here
;they're created even before the auto-execute section starts
x::Pause, Toggle
y::ExitApp