#Requires AutoHotkey v2.0
; 定义全局变量
global clickCount := 1
global wheelScrollCount := 4
global delayTime := 10
; 创建 GUI 界面
Gui := Gui()
Gui.Add("Text", "x10 y10 w100 h20", "鼠标点击次数:")
Gui.Add("Edit", "x120 y10 w50 vClickCount gUpdateValue", clickCount)
Gui.Add("Text", "x10 y40 w100 h20", "滚轮滚动次数:")
Gui.Add("Edit", "x120 y40 w50 vWheelScrollCount gUpdateValue", wheelScrollCount)
Gui.Add("Text", "x10 y70 w100 h20", "延迟时间 (ms):")
Gui.Add("Edit", "x120 y70 w50 vDelayTime gUpdateValue", delayTime)
Gui.Add("Button", "x10 y100 w100 h30 gStartScript", "开始脚本")
Gui.Show("w250 h150", "脚本参数设置")
UpdateValue() {
global clickCount, wheelScrollCount, delayTime
clickCount := GuiControlGet("ClickCount")
wheelScrollCount := GuiControlGet("WheelScrollCount")
delayTime := GuiControlGet("DelayTime")
}
StartScript() {
global clickCount, wheelScrollCount, delayTime
; --------------- 点击"更换奖励" ---------------
MouseMove 463, 1099, 0 ; 瞬间移动
Sleep delayTime
Loop(clickCount) {
Click "Left"
Sleep delayTime
}
Loop(wheelScrollCount) {
Send "{WheelDown}"
Sleep delayTime
}
MouseMove 482, 1132, 0
Sleep delayTime
Click "Left"
Sleep delayTime
MouseMove 471, 1280, 0
Sleep delayTime
Click "Left"
Sleep delayTime
}
; 一键出售功能
p:: {
firstX := 1725
firstY := 1010
stepX := 73.5
stepY := 107.5
timeStep := delayTime
for a in Range(0, 2) { ; 外层循环 Y 轴 (0-2 共3次)
y := firstY + a * stepY
for b in Range(0, 10) { ; 内层循环 X 轴 (0-10 共11次)
x := firstX + b * stepX
MouseMove x, y, 0
Sleep timeStep
Click "Right"
Sleep timeStep
}
}
}
Range(start, stop) {
arr := []
for i, val in stop - start + 1
arr.Push(start + i - 1)
return arr
}
F1:: {
MouseGetPos &xpos, &ypos
MsgBox("The cursor is at X: " xpos ", Y: " ypos)
}
-------------------------------------------------------------------------------------------------------
>"D:\ahk\AutoHotkey.exe" /ErrorStdOut "D:\ahk\SciTE\TestSuite.ahk"
D:\ahk\SciTE\TestSuite.ahk (84) : ==> This Class cannot be used as an output variable.
Specifically: Gui
>Exit code: 2 Time: 0.08679
-------------------------------------------------------------------------------------------------------
请根据报错信息,修正代码
最新发布