我的剧本在某个时刻崩溃了,我'我们消除了调试器能够发现的所有语法错误



这是一个脚本,应该使用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%,但就我个人而言,我会推动您使用现代表达式语法,并通过以%开头加空格来强制表达式使用该参数。所以Loop, % 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

最新更新