0

只是试图用ControlSend(). 由于某种原因,它不起作用。

While 1
   ControlSend("PokeMMO", "", "", "{DOWN}")
   Sleep(900)
   ControlSend("PokeMMO", "", "", "{DOWN}")
   Sleep(900)
   ControlSend("PokeMMO", "", "", "{DOWN}")
   Sleep(900)
   ControlSend("PokeMMO", "", "", "a")
   Sleep(Random(750, 2000, 1))
   ControlSend("PokeMMO", "", "", "a")
   Sleep(Random(750, 2000, 1))
   ControlSend("PokeMMO", "", "", "a")
   Sleep(Random(750, 2000, 1))
   ControlSend("PokeMMO", "", "", "a")
   Sleep(3000)
WEnd

Au3信息

标题:РokеММO,
类别:LWJGL

Global $sProcess = "javaw.exe" ;PokeMMO Process

ControlSend(_Process2Win($sProcess), "", "", "{DOWN}")

Func _Process2Win($pid)
    If IsString($pid) Then $pid = ProcessExists($pid)
    If $pid = 0 Then Return -1
    $list = WinList()
    For $i = 1 To $list[0][0]
        If $list[$i][0] <> "" And BitAND(WinGetState($list[$i][1]), 2) Then
            $wpid = WinGetProcess($list[$i][0])
            If $wpid = $pid Then Return $list[$i][0]
        EndIf
    Next
    Return -1
EndFunc   ;==>_Process2Win
4

1 回答 1

0

您可以先使用 WinGetHandle 接收窗口句柄,然后在 ControlSend 函数中使用此句柄,这应该可以工作。它如下所示:

$handle = WinGetHandle("[TITLE:PokeMMO; CLASS:LWJGL]")
ControlSend($handle, Default, $handle, "{Down}")

尝试先显示句柄的内容以确认,您正在接收一个工作句柄。喜欢ConsoleWrite($handle)MsgBox(1, "Handle", WinGetTitle($handle))

去吧,试一试;-)
祝你好运!

于 2013-02-09T16:15:26.470 回答