为什么我的 AutoIt 脚本可以编译但什么都不做?

Why does my AutoIt script compile but doesn't do anything?

我的 AutoIt 脚本可以编译,但没有执行预期的操作。代码:

HotKeySet(+"{G}","gather")

While 1
    sleep(100)
WEnd

Global $charRunTimeS = 2;
Global $collectKey = "{LWIN}";
Global $vehicleInvKey = "{T}";
Global $charRunTimeMS = $charRunTimeS * 1000

Global $posItemX = 820;
Global $posItem1Y = 300;
Global $posItem2Y = 340;
Global $posItem3Y = 365;
Global $posItem4Y = 397;
Global $posBtnStore = 678;
Global $posItemSelectedY = $posItem4Y

Func gather()

$counter = 0;
While $counter <= 2

    Send("{s down}")
    Sleep($charRunTimeMS)
    Send("{s up}")

    $counter1 = 0;
    While $counter1 <= 4
        Send($collectKey)
        Sleep(100)
        Send($collectKey)
        Sleep(30000)
        $counter1 = $counter1 + 1
    WEnd

    Send("{w down}")
    Sleep($charRunTimeMS)
    Send("{w up}")

    Send($vehicleInvKey)
    MouseClick("primary", $posItemX, $posItemSelectedY)

    $counter2 = 0;
    While $counter2 <= 30
        MouseClick($posItemX, $posBtnStore)
        $counter2 = $counter2 + 1
    WEnd

    Send("{ESC}")
    $counter = $counter + 1
WEnd

EndFunc

调试输出。第一行是编译时运行,第二行是我停止代码的时候:

"C:\Program Files (x86)\AutoIt3\SciTE..\autoit3.exe" /ErrorStdOut "C:\Users\RichusX\Desktop\AltisGatherScript.au3"

Process failed to respond; forcing abrupt termination... Exit code: 1 Time: 14.39

我想您需要做的就是像这样编写调用:

HotKeySet("G", "gather")

你不需要+,因为大写G。如果你想那么你必须把它变成""。看一下发送函数。