为什么我的AutoIt脚本编译但没有做任何事情?

时间:2015-01-18 13:32:41

标签: autoit

我的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

来自de-bug的输出。第一行是编译和运行时,第二行是我停止代码时:

  

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

     

流程未能响应;迫使突然终止......   退出代码:1时间:14.39

1 个答案:

答案 0 :(得分:1)

我想你需要做的就是写这样的电话:

HotKeySet("G", "gather")

你不需要+,因为大写字母G.如果你想,那么你必须把它放到“”。看看发送功能。