每次发送一个数字,而不是像它应该显示的那样显示文本。
#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
$what1
是ControlID
,因此运行Send($what1)
时返回数字3。
不确定目的是什么后,你已经打开我的世界,但Send($what1)
应该运行应用程序路径(eq。"C:applicationapp.exe")在$what1
输入框?
如果这是您正在寻找的,那么不是使用Send()
命令,您应该读取输入并将其分配给一个变量,也可以使用Run()
命令。
下面是一个示例,说明如何编写for case $run1
:
Case $run1
$w1 = GUICtrlRead($what1)
WinActivate("Minecraft")
Send("{ESC}")
Send("t")
Run($w1)
Send("{Enter}")
您没有读取来自GUI的输入。
你只需要:
GUICtrlRead($what1)
我今天做了同样的事情——有一段时间没有创建GUI输入了——哎呀!