2
Func OpenSHK()
global $Loginx = 0, $Loginy = 0, $Playx = 0, $Playy = 0
Run(@ProgramFilesDir & "\Stronghold Kingdoms\StrongholdKingdoms.exe")
WinWaitActive("Stronghold Kingdoms")
If WinExists("Stronghold Kingdoms") Then
SendKeepActive("Stronghold Kingdoms")
Else
WinWait("Stronghold Kingdoms")
SendKeepActive("Stronghold Kingdoms")
EndIf
Sleep(5000)
Send("testphrase")
Local $search = _ImageSearch('pics/LoginButton.bmp', 0, $Loginx, $Loginy, 0)
If $search = 1 Then
MouseMove($Loginx, $Loginy, 20)
MouseClick("left")
Else
Do
$search = _ImageSearch('pics/LoginButton.bmp', 0, $Loginx, $Loginy, 0)
sleep(5000)
Until $search = 1
MouseMove($Loginx, $Loginy, 20)
MouseClick("left")
EndIf
Sleep(5000)
Local $search = _ImageSearch('pics/PlayButton.bmp', 0, $Playx, $Playy, 0)
If $search = 1 Then
MouseMove($Playx, $Playy, 20)
MouseClick("left")
Else
Do
$search = _ImageSearch('pics/PlayButton.bmp', 0, $Playx, $Playy, 0)
sleep(5000)
Until $search = 1
MouseMove($Playx, $Playy, 20)
MouseClick("left")
EndIf
WinWaitActive("Stronghold Kingdoms - World 8")
sleep(10000)
EndFunc
函數工作正常,直到它到達第6行。它不發送測試短語,我似乎無法弄清楚爲什麼。AutoIt發送()不工作
謝謝。
好吧,所以我改變了你的說法,並將其設爲循環,但發送功能仍然沒有發送。我可以輸入它應該發送的內容,但沒有發送。我會在一秒內上傳新代碼。 – NathanG
已在主帖中上傳新版本。 – NathanG
使用'send'時窗口是否激活? –