Mouse clicking on a color that apears please point me in the right direction
#1
Posted 31 October 2009 - 05:41 AM
How do I go about this? Its using pixelsearch. If a color appears, I want to hold the mouse down on it. I know the mouse commands, I just don't know how to go about the If and Thens to coordinate the mouse clicking when the color appears. Any suggestions? Thanks!
#2
Posted 31 October 2009 - 05:48 AM
MasonMill, on 30 October 2009 - 10:41 PM, said:
How do I go about this? Its using pixelsearch. If a color appears, I want to hold the mouse down on it. I know the mouse commands, I just don't know how to go about the If and Thens to coordinate the mouse clicking when the color appears. Any suggestions? Thanks!
Can't really explain this without giving you all the code or seeing what you've tried...
#3
Posted 03 November 2009 - 05:28 AM
#5
Posted 03 November 2009 - 06:00 PM
#9
Posted 04 November 2009 - 07:15 AM
$CoOrd = PixelSearch(30, 30,1024, 768, 0xff0000) ; Looks for colour 0xff0000. If Not @error Then ;If it exists then MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0) ;Clicks the first instance of that colour else MsgBox(0,"!","Could not find colur") EndIf
#11
Posted 04 November 2009 - 05:14 PM
BitByteBit, on 04 November 2009 - 12:15 AM, said:
$CoOrd = PixelSearch(30, 30,1024, 768, 0xff0000) ; Looks for colour 0xff0000. If Not @error Then ;If it exists then MouseClick("Left", $Coord2[0], $Coord2[1], 1, 0) ;Clicks the first instance of that colour else MsgBox(0,"!","Could not find colur") EndIf
I went home and looked at your code, how does it know where the color popped up? Does this code not just see that there is the color I'm looking for and I designate where to click? I am trying to make it click on that location that the color appears. Is this possible?
#12
Posted 04 November 2009 - 05:20 PM
MasonMill, on 04 November 2009 - 09:14 AM, said:
From the help file on pixelsearch:
Return Value
Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)
Failure: Sets @error to 1 if color is not found.
PixelSearch does not return a true or false that it found the color it returns the coordinates at which if found the color.
#13
Posted 04 November 2009 - 05:22 PM
Negative1, on 04 November 2009 - 10:20 AM, said:
Return Value
Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)
Failure: Sets @error to 1 if color is not found.
PixelSearch does not return a true or false that it found the color it returns the coordinates at which if found the color.
that's what I'm missing! Thanks!
#14
Posted 04 November 2009 - 05:22 PM
These variables can be used in place of putting a specific X and Y coordinate in the MouseClick command, the outcome being the script will perform a left mouse click where the colour was found
Also that script will run an error, here's a minor correction
$CoOrd = PixelSearch(30, 30,1024, 768, 0xff0000) ; Looks for colour 0xff0000. If Not @error Then ;If it exists then MouseClick("Left", $CoOrd[0], $CoOrd[1], 1, 0) ;Clicks the first instance of that colour else MsgBox(0,"!","Could not find colur") EndIf

Sign In
Register
Help
MultiQuote