0

它不是按应有的方式显示文本,而是每次都发送一个数字。

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 487, 551, 299, 250)
GUISetBkColor(0x800000)
$what1 = GUICtrlCreateInput("What to run:", 64, 120, 393, 21)
$run1 = GUICtrlCreateButton("Run this!", 64, 152, 129, 25)
$what2 = GUICtrlCreateInput("What to run:", 64, 192, 393, 21)
$run2 = GUICtrlCreateButton("Run this!", 64, 224, 129, 25)
$what3 = GUICtrlCreateInput("What to run:", 64, 264, 393, 21)
$run3 = GUICtrlCreateButton("Run this!", 64, 296, 129, 25)
$what4 = GUICtrlCreateInput("What to run:", 64, 336, 393, 21)
$run4 = GUICtrlCreateButton("Run this!", 64, 368, 129, 25)
$Label1 = GUICtrlCreateLabel("NativePrison", 16, 0, 339, 72)
GUICtrlSetFont(-1, 36, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0x008000)
$Label2 = GUICtrlCreateLabel("AUTO-RUNNER", 184, 64, 271, 49)
GUICtrlSetFont(-1, 24, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0x000080)
$Label3 = GUICtrlCreateLabel("1", 24, 128, 20, 37)
GUICtrlSetFont(-1, 18, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0xC0C0C0)
$Label4 = GUICtrlCreateLabel("2", 24, 200, 20, 37)
GUICtrlSetFont(-1, 18, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0xC0C0C0)
$Label5 = GUICtrlCreateLabel("3", 24, 272, 20, 37)
GUICtrlSetFont(-1, 18, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0xC0C0C0)
$Label6 = GUICtrlCreateLabel("4", 24, 344, 20, 37)
GUICtrlSetFont(-1, 18, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0xC0C0C0)
$runall = GUICtrlCreateButton("RUN ALL!", 8, 400, 473, 145)
GUICtrlSetFont(-1, 48, 400, 0, "Arial Black")
GUICtrlSetColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $run1
           WinActivate("Minecraft")
           Send("{ESC}")
           Send("t")
           Send($what1)
           Send("{Enter}")
        Case $run2
           WinActivate("Minecraft")
           Send("{ESC}")
           Send("t")
           Send($what1)
           Send("{Enter}")
        Case $run3
           WinActivate("Minecraft")
           Send("{ESC}")
           Send("t")
           Send($what1)
           Send("{Enter}")
        Case $run4
           WinActivate("Minecraft")
           Send("{ESC}")
           Send("t")
           Send($what1)
           Send("{Enter}")
        Case $runall
           WinActivate("Minecraft")
           Send("{ESC}")
           Send("t")
           Send($what1)
           Send("{Enter}")
           Send("t")
           Send($what2)
           Send("{Enter}")
           Send("t")
           Send($what3)
           Send("{Enter}")
           Send("t")
           Send($what4)
           Send("{Enter}")
    EndSwitch
WEnd
4

2 回答 2

1

$what1是 a ControlID,因此它在运行时返回数字 3 Send($what1)

在您已经打开 Minecraft 之后不确定目的是什么,但是应该在输入框中Send($what1)运行应用程序路径(例如“C:\application\app.exe”) ?$what1

如果这是您要查找的内容,那么Send()您应该读取输入并将其分配给变量,而不是使用命令,也可以使用Run()命令。

以下是如何编写 for case 的一个示例$run1

    Case $run1
       $w1 = GUICtrlRead($what1)
       WinActivate("Minecraft")
       Send("{ESC}")
       Send("t")
       Run($w1)
       Send("{Enter}")
于 2013-05-28T15:55:53.520 回答
0

您没有从 GUI 读取输入。

您所需要的只是:

GUICtrlRead($what1)

我今天做了同样的事情 - 有一段时间没有创建 GUI 输入 - 哎呀!

于 2014-06-03T14:51:11.113 回答