2013-05-28 26 views
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 

回答

0

你沒有讀從GUI輸入。

你需要的所有是:

GUICtrlRead($what1) 

我今天做了同一件事 - 沒有創造了一段GUI輸入 - 哎呀!

1

$what1ControlID,因此它當它運行Send($what1)返回數字3。

不知道您打開Minecraft後目的是什麼,但是Send($what1)應該在$what1輸入框中運行應用程序路徑(eq。「C:\ application \ app.exe」)?

如果這是您正在尋找的內容,則不應使用Send()命令,而應該讀取輸入並將其分配給變量,也可以使用Run()命令。

下面是你應該怎麼寫的情況下$run1一個例子:

Case $run1 
     $w1 = GUICtrlRead($what1) 
     WinActivate("Minecraft") 
     Send("{ESC}") 
     Send("t") 
     Run($w1) 
     Send("{Enter}")