我試圖找到一個地方,AutoIt的GUICtrlRead
$Password = GUICtrlRead($PasswordInput)
內的
Func BeginningGUI()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Stronghold Kingdoms", 248, 95, -1, -1)
$PasswordInput = GUICtrlCreateInput("Password", 8, 32, 233, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$ButtonOk = GUICtrlCreateButton("OK", 86, 64, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("Cancel", 167, 64, 75, 25, $BS_NOTIFY)
$EnterPassLabel = GUICtrlCreateLabel("Please Enter Your Stronghold Kingdoms Password", 0, 12, 241, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCancel
Exit
Case $ButtonOk
OpenSHK()
Exit
EndSwitch
WEnd
EndFunc
Func OpenSHK()
Run("C:\Program Files (x86)\Firefly Studios\Stronghold Kingdoms\StrongholdKingdoms.exe")
WinWaitActive("Stronghold Kingdoms")
Sleep(5000)
Send($Password)
MouseClick("left",927,163)
Sleep(5000)
MouseClick("left",1112,371)
WinWaitActive("Stronghold Kingdoms - World 8")
sleep(10000)
EndFunc
我只需要聲明一下他們的供以後使用$密碼進入。
我試着把它放在Case $ ButtonOk下面,但是它給出了一個關於變量未被聲明的錯誤。
你嘗試了什麼,爲什麼它不起作用? –
後來在程序中我試着發送($ Password),但是它說變量沒有被定義。我在OpenSHK()的正上方嘗試過,但沒有成功。 – NathanG