Sign in to follow this  
Followers 0
hobodude666

Need Help to Mouse Left Click on a Pixel

8 posts in this topic

I used a pixel detector and i got

36, 366 Pixel:4681596

How do i make a script that allows me to Click on that certain pixel?

Share this post


Link to post
Share on other sites



First, you have to code it ? Show us what you've tried. Search in the helpfile for:

MouseMove

MouseClick

PixelSearch

Should get ya started...


FootbaG

Share this post


Link to post
Share on other sites

36, 366 Pixel:4681596

the 36 and 366 are coordinates( but are they screen coordinates, or client coordinates?) the 4681596 should be the pixel's color value.

lookup PixelSearch() and MouseClick() in the help file.


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Those Coords are from the Program.

Here's What i got so far:

BTW i couldnt find the commands to open a PID process and couldnt get ALT TAB to work.

MouseClick("Left" , 247, 847 , 2 , 1)

Sleep(2000)

MouseClick("Left" , 560, 445 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

I was thinking about Pixel detecting that pixel i mentioned and then getting the MouseCoords for it then Click. Would that be possible? Edited by hobodude666

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Opt("MouseCoordMode", 0); the 0 is for window coords
Opt("PixelCoordMode", 0); same

$Coord = PixelSearch(0, 0, 200, 366);imagine a square: 1st 0 = x top left - 2nd 0 y top left - 200 = x bottom right - 366 = y bottom right
If Not @error Then
MouseClick("Left", $Coord[0], $Coord[1], 1, 1)
EndIf

Edit: Variable name was wrong

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

MouseClick("Left" , 247, 847 , 2 , 1)

Sleep(2000)

MouseClick("Left" , 560, 445 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

MouseClick("Left" , 491, 649 , 1 , 1)

Sleep(100)

Opt("MouseCoordMode", 0); the 0 is for window coords

Opt("PixelCoordMode", 0); same

$Coord = PixelSearch(0, 0, 200, 366);imagine a square: 1st 0 = x top left - 2nd 0 y top left - 200 = x bottom right - 366 = y bottom right

If Not @error Then

MouseClick("Left", $Coord[0], $Coord[1], 1, 1)

EndIf

Like that?

With the $coord it will click the area around that pixel like a square, am i correct?

Share this post


Link to post
Share on other sites

it will click directly on that pixel, if PixelSearch found the pixel in the search area


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

Like that?

With the $coord it will click the area around that pixel like a square, am i correct?

<{POST_SNAPBACK}>

Just a suggestion since your using MouseClick() in other parts of your script:

Top:

Opt("MouseCoordMode", 0); the 0 is for window coords
Opt("PixelCoordMode", 0); same

While 1
Sleep(100)

MouseClick("Left" , 247, 847 , 2 , 1)
Sleep(2000)
MouseClick("Left" , 560, 445 , 1 , 1)
Sleep(100)
MouseClick("Left" , 491, 649 , 1 , 1)
Sleep(100)
MouseClick("Left" , 491, 649 , 1 , 1)
Sleep(100)
MouseClick("Left" , 491, 649 , 1 , 1)
Sleep(100)

$Coord = PixelSearch(0, 0, 200, 366);imagine a square: 1st 0 = x top left - 2nd 0 y top left - 200 = x bottom right - 366 = y bottom right
If Not @error Then
MouseClick("Left", $Coord[0], $Coord[1], 1, 1)
EndIf
Wend

I don't know what the other mouseclicks do, but if you put the coord pixelsearch in a while statement, it will loop either indefinately if never found, or click it when found and continue the loop again.

If your "MouseClicks" are just to sign in or something, you can take them out of the While Loop or the will always click. And put them above the While 1 or something.

The Sleep(100) is to make help on CPU usage. The 100 is approximately 100 millieseconds or 1/10 of a second....

Good Luck to you.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
Sign in to follow this  
Followers 0