Flash 自动点击闪光按钮?

Flash 自动点击闪光按钮?,flash,automation,autoit,Flash,Automation,Autoit,是否可以使用AutoIT单击闪光按钮?如果是这样的话,有人能给我一个示例代码吗?如果你知道按钮的位置和位置,你可以在某个位置点击屏幕 如果您不知道flash按钮的状态(如果它在那里或不在那里,它到底在哪里),您可以使用一个脚本来截图、处理图像,然后创建并运行一个单击按钮的AutoIT脚本。在过去,我必须使用Perl和ImageMagick来实现这一点。无需截图,您可以使用像素校验和计算像素的哈希值。然后将其与之前计算的版本进行比较。您需要检查一系列像素区域 下面是一个使用AutoIt自动化fla

是否可以使用AutoIT单击闪光按钮?如果是这样的话,有人能给我一个示例代码吗?

如果你知道按钮的位置和位置,你可以在某个位置点击屏幕


如果您不知道flash按钮的状态(如果它在那里或不在那里,它到底在哪里),您可以使用一个脚本来截图、处理图像,然后创建并运行一个单击按钮的AutoIT脚本。在过去,我必须使用Perl和ImageMagick来实现这一点。

无需截图,您可以使用
像素校验和计算像素的哈希值。然后将其与之前计算的版本进行比较。您需要检查一系列像素区域


下面是一个使用AutoIt自动化flash游戏的示例

#include <IE.au3>

example()

Func example()
    $oIE = _IECreate("http://andkon.com/arcade/puzzle/greatmatemaster/")

    Local $oEmbedFlash = _IETagNameGetCollection($oIE, "embed", 0)
    Local $hWin = _IEPropertyGet($oIE, "hwnd")
    WinSetState($hWin, "", @SW_MAXIMIZE)

    ;get the x/y position of the flash game
    Local $iX = _IEPropertyGet($oEmbedFlash, "screenx")
    Local $iY = _IEPropertyGet($oEmbedFlash, "screeny")

    ;add click positions
    Local $aPlayChestBtn = [$iX + 240, $iY + 350]
    Local $a2b = [$iX + 120, $iY + 390]
    Local $a4b = [$iX + 120, $iY + 300]

    ;click the play chest button
    Click($aPlayChestBtn, 2000)

    ;move pawn to 4b with clicks
    Click($a2b, 1000)
    Click($a4b, 1000)

EndFunc   ;==>example

Func Click($aPos, $iWaitTime = 0)
    ;waits for a set amount of time for nothing to change where you want to click
    If $iWaitTime <> 0 Then PixelChecksumWait($aPos, $iWaitTime)

    ;clicks the area you want to click
    MouseClick("left", $aPos[0], $aPos[1], 1, 0)
EndFunc   ;==>Click

Func PixelChecksumWait($aPos, $iWaitTime = 5000)
    Local $iCheckSum

    ;wait to make sure there is no change in the region
    While 1
        ;get checksum
        $iCheckSum = PixelChecksum($aPos[1] - 5, $aPos[0] - 5, 10, 10)

        ;sleep to make sure there is no change
        Sleep($iWaitTime)

        ;exit loop if there was no change
        If $iCheckSum = PixelChecksum($aPos[1] - 5, $aPos[0] - 5, 10, 10) Then ExitLoop
    WEnd
EndFunc   ;==>PixelChecksumWait
#包括
示例()
Func示例()
$oIE=_IECreate(“http://andkon.com/arcade/puzzle/greatmatemaster/")
本地$oEmbedFlash=\u IETagNameGetCollection($oIE,“嵌入”,0)
本地$hWin=_IEPropertyGet($oIE,“hwnd”)
WinSetState($hWin,“,@SW_最大化)
;获取flash游戏的x/y位置
本地$iX=\u IEPropertyGet($oEmbedFlash,“screenx”)
本地$iY=\u IEPropertyGet($oEmbedFlash,“屏幕”)
;添加单击位置
本地$aPlayChestBtn=[$iX+240,$iY+350]
本地$a2b=[$iX+120,$iY+390]
本地$a4b=[$iX+120,$iY+300]
;单击“播放胸部”按钮
点击($aPlayChestBtn,2000)
;用咔嗒声将兵移动到4b
点击(20亿美元,1000美元)
点击($a4b,1000)
EndFunc;==>例子
函数单击($aPos,$iWaitTime=0)
;等待设定的时间量,以便在您要单击的位置不发生任何更改
如果$iWaitTime为0,则PixelChecksumWait($aPos,$iWaitTime)
;单击要单击的区域
鼠标单击(“左”,$aPos[0],$aPos[1],1,0)
EndFunc;==>点击
Func PixelChecksumWait($aPos,$iWaitTime=5000)
本地$iCheckSum
;等待以确保该区域没有变化
而1
;获取校验和
$iCheckSum=PixelChecksum($aPos[1]-5,$aPos[0]-5,10,10)
;睡觉以确保没有变化
睡眠($i等待时间)
;如果没有更改,则退出循环
如果$iCheckSum=PixelChecksum($aPos[1]-5,$aPos[0]-5,10,10),则退出
温德
EndFunc;==>像素检查等待

嗨,谢谢你,Narthring,你能给我看一下AutoIT点击flash或操作flash的示例代码吗。。我在谷歌上搜索了一下,但我不明白他们的意思。你能参考任何链接或代码吗。。再次感谢使用MouseClick函数单击适当的区域:您需要知道提前单击的位置,并将这些X和Y坐标传递到函数中。