| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- #HotIf WinActive("ahk_exe yysls.exe")
- global isRunning := false
- global currentStep := 1
- global interrupt := false
- global steps := [{ send: "q", sleep: 800 }, { send: "q", sleep: 800 }, { send: "{Tab}", sleep: 2100 }, { send: "q", sleep: 2000 }, { send: "{r down}", sleep: 1500 }, { send: "{r up}", sleep: 900 }, { send: "2", sleep: 1600 }, { send: "e", sleep: 1000 }, { send: "1", sleep: 2500 }, { send: "{Tab}", sleep: 1500 }, { send: "``", sleep: 900 }, { send: "``", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 1000 }, { send: "e", sleep: 800 }, { send: "q", sleep: 800 }, { send: "q", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 800 }, { send: "3", sleep: 1000 }, { send: "e", sleep: 700 }, { send: "{Tab}", sleep: 2000 }, { send: "q", sleep: 2000 }, { send: "{r down}", sleep: 1500 }, { send: "{r up}", sleep: 800 }, { send: "{Tab}", sleep: 0 }
- ]
- L:: {
- global isRunning, interrupt, currentStep
- if isRunning {
- return ; 避免重复启动
- }
- interrupt := false
- isRunning := true
- currentStep := 1
- ExecuteStep() ; ⬅️ 直接启动第一步
- }
- ~Esc:: {
- global interrupt, isRunning
- if isRunning {
- interrupt := true
- ToolTip("脚本已中止")
- SetTimer () => ToolTip(), -1000
- }
- }
- ExecuteStep() {
- global steps, currentStep, isRunning, interrupt
- if interrupt || currentStep > steps.Length {
- isRunning := false
- interrupt := false
- currentStep := 1
- return
- }
- step := steps[currentStep]
- try {
- Send(step.send)
- } catch {
- ToolTip("发送失败: " step.send)
- SetTimer () => ToolTip(), -1000
- }
- currentStep++
- if !interrupt && currentStep <= steps.Length {
- SetTimer ExecuteStep, -step.sleep
- } else {
- isRunning := false
- currentStep := 1
- }
- }
- #HotIf
|