Jump to content
christian11

how to pixelsearch click in middle area?

Recommended Posts

my script is working fine but it mostly clicks only in the sides and corner of green square (which is the first pixels it detects i guess) any idea how can I click the middle area inside of pixelsearch? heres what i done but it wont work 

$greenbox = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00FF00)
If isArray($greenbox) then
newX := greenbox[0] + 25
newY := greenbox[1] + 25
MouseMove($newX[0],$newY[1], 0)
MouseClick("Left")

click.jpg

Share this post


Link to post
Share on other sites

my script is working fine but it mostly clicks only in the sides and corner of green square (which is the first pixels it detects i guess) any idea how can I click the middle area inside of pixelsearch? heres what i done but it wont work 

$greenbox = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x00FF00)
If isArray($greenbox) then
MouseMove($greenbox[0]+25,$greenbox[1]+25, 0)
MouseClick("Left") 

 

click.jpg

You were close :) 

 

:= doesn't assign. use = or +=

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By plankton
      While IsArray(PixelSearch(100, 100, 300, 300, 0xffffff))     Send("{ESC}")     Sleep(1000) WEnd  MsgBox(0,"Loop exited","") Hi, above is my function that will execute ESC button when white color is present in specific area which is color 0xffffff.
      But how do I do the opposite like when white color is not present in that specific area? Like this below code which gives me error
       
      While IsArray(PixelSearch(100, 100, 300, 300, <>0xffffff))     Send("{ESC}")     Sleep(1000) WEnd  MsgBox(0,"Loop exited","")  
       
    • By plankton
      Hi I want it to search for a specific color in certain area then excute the loop which presses ESC button and stop the loop when the color no longer present in that specific area.  Here is the example of my code. But it doesnt stop when color is disappeared.
       
      Pixelsearch(511, 455, 678, 501, 0xFFFFFF)
      If Not  @Error Then
      While 1
      Sleep(1000)
      Send("{ESC}")
      Pixelsearch(511, 455, 678, 501, 0xFFFFFF)
      If @Error Then Exitloop
       
    • By Borges
      Sorry if I posted in wrong section but...
      how can I do something like that?
       
      If PixelSearch(660, 30, 670, 38, 0x242424, 0 , 1) <> @error Then
          Send("{F3}")
          Sleep(200)
       ElseIf PixelSearch(800, 30, 810, 38, 0x242424, 0 , 1) <> @error Then
          Send("{F4}")
          Sleep(200)
       EndIf
       
    • By Daka
      I find it very weird:
      if I run like this:
           Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, '0xFF455E')
      works fine!
      If I run like this:
          Local $metaColor1 = '0xFF455E' or like this Local $metaColor1 = "0xFF455E" or Local $metaColor1 = "'0xFF455E'"
          Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, $color)
      it doesn't want to work! So something with variable is not working and yes if I print it out like this:
      ConsoleWrite(@LF & $posX & ":"& $posY & ":"& $sizeX & ":" & $sizeY & ":" & $color&@LF)
      771:80:833:151:0xFF455E

      So I dont see the problem, maybe some of you people?
    • By squidol
      I need help about pixel search. The problem with the script below is that PixelSearch does not continue on the coordinates where it has stopped.
      When the first pixelsearch finds the 1st pixel, it should move the mouse over it and new pixels would appear just like hovering over menus. Then upon hover, there would be another PixelSearch to see if the second red pixel is found. If not found, then it should resume the first PixelSearch instead of starting from left to right again. 
      For example we are doing a pixelsearch on two straight lines with coordinates  [x,y]  :
      [0,0] [1,0] [2,0]
      [1,0] [1,1] [1,2]
      Pixelsearch finds the coordinate [1,0] matching our color. So it checks the pixel just below it which is [1,1] to see if it is color red. If not red then it should continue searching starting on coordinates [2,0] instead of going back to [0,0]
      Local $bflag = False Do     ToolTip("finding..",0,0,"")     Sleep(500)     $var = PixelSearch(591, 169, 1365, 740, 0x464950,50) ; look for initial pixel     If Not @error Then ;         MouseMove($var[0],$var[1],0) ;move on the button to show new selections, new pixels         sleep(1000)         ;search for the red pixel on an area above the first pixel coords which was          ;generated when mouse cursor was hovered on the first pixel found.         $redpixel = PixelSearch($var[0]-50,$var[1]-50,$var[0]+50,$var[1]+50,0xFF0048)          If Not @error Then ; Found the 2nd pixel                 ToolTip("found...",0,0,"")             $bflag = True          EndIf     EndIf Until $bflag I can pay 50USD through Paypal for a working solution. thanks   
×
×
  • Create New...