【问题标题】:Why does my AutoIt script compile but doesn't do anything?为什么我的 AutoIt 脚本编译但不执行任何操作?
【发布时间】:2015-03-16 14:35:55
【问题描述】:

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

进程没有响应;强制终止... 退出代码:1 时间:14.39

【问题讨论】:

  • 函数“gather”在哪里调用?
  • @UweKeim 来自 HotKeySet(+"{G}","gather") ,由于格式化,它在代码块之外,但据我所知应该在里面。

标签: autoit


【解决方案1】:

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

HotKeySet("G", "gather")

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 2021-07-01
    • 2010-10-11
    • 2013-09-13
    • 1970-01-01
    • 1970-01-01
    • 2015-07-02
    相关资源
    最近更新 更多