Jump to content

Need Help to Mouse Left Click on a Pixel


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...