Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

I need help with pixel search and mouse click.

$
0
0

I have this script:

AutoIt         
#region HotKeySet HotKeySet("{F4}","PIXELREAD") HotKeySet("{F2}","PIXELFIND") HotKeySet("{f3}","ExitProg") #ENDREGION #region variables dim $pos[2] dim $color Global $counter=0 Global $searchfor = 12059395 Global $on=0 #ENDREGION Func ExitProg()    Exit EndFunc     #region Functions Func PIXELREAD()    $pos = MouseGetPos()    $color = PixelGetColor($pos[0],$pos[1])    MsgBox(0,"Color",$color&@CRLF&$pos[0]&","&$pos[1]) EndFunc Func PIXELFIND()    $on=1    While $on=1       $pos = PixelSearch(133,231,1155,936,$searchfor)       if not @error Then          MouseMove($pos[0],$pos[1],0)          Sleep(500)          MouseDown("left")       EndIf       If @error Then          $counter=$counter+1       EndIf       if $counter>5 Then          $on=0       EndIf    WEnd    MouseUp("left")    MsgBox(0,"It's Colored","We colored it.") EndFunc #ENDREGION While 1    Sleep(100) WEnd

when i press F2 it search for pixel color and left click on it. Works fine.

 

I want to search pixels in a small area in the center of the screen (200 x 200 px)

If no pixel find then make area larger and larger until pixel is find and left click on it,

then sleep 4 sec and make area small again instant (200 x 200 px)

 

thank you


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>