2013-04-16 58 views

回答

2

如果你知道按鈕的位置並且它在那裏,你可以在屏幕上點擊一個位置。

如果您不知道閃光燈按鈕的狀態(如果它存在或不存在,它的確切位置),您可以使用截取屏幕截圖的腳本,處理圖像,然後創建並運行AutoIT單擊該按鈕的腳本。過去,我必須用Perl和ImageMagick來做這件事。

+0

你好謝謝Narthring可以請你告訴我的AutoIt的任何代碼示例點擊Flash或iteracting閃存..我的google搜索,但你可以參考任何鏈接或任何代碼,我再次無法理解他們..謝謝 – selva

+2

只需使用MouseClick函數點擊相應的區域:http://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm您需要知道提前點擊的位置並通過那些X和Y座標到函數中。 – Narthring

0

下面是使用的AutoIt自動閃光遊戲的一個例子。

#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