Jump to content

[new user] Click a pixel or pixels with loop possible?


jksp22
 Share

Recommended Posts

Hello, there!

I don't know how to use this product, but I am in need of a program where I can input a pixel (x,y) and the program will click on that pixel automatically.

Or I need to specify pixel1 (x1,y1), pixel2 (x2,y2), and pixel3 (x3,y3) where I need to click on pixel1 and loop through to pixel2 by clicking all pixels within the range (box).

But the process goes like this.

1. click x1,y1

2. wait 3 seconds

3. click x3,y3

4. click x1+1,y1

5. wait 3 seconds

6. click x3,y3

and so on.

 

Is this possible?

 

Thank you in advance!

Link to comment
Share on other sites

Yes

PixelGetColor -> Get the color of a pixel in specified coords (x,y) Then you need X,Y and will get a decimal color

Or

PixelSearch -> Search in an area for a pixel with specified coords Then you need Coords of a rectangle and a color and will get X,Y if some pixel in area have specified color

Or

PixelChecksum -> You generate a checksum of a rectangle and get value, then you can compare later if are the same.

Link to comment
Share on other sites

  • Developers

And that delay of 3-5 seconds. Is that possible as well?

Did you actually try to search first in the help file for this as MuffinMan clearly gave you the commands already?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

you didn't have to be that rude to point out that sleep is delay. who's going to ask for help in help forum if you just say go to the help file. it's all there. maybe i just like to talk to actual humans who can provide their knowledge in the area.

but yes, i read it.

thanks for the help everyone. It's going to help me a lot. I've been doing things manually. This might just increase my efficiency by 10 times.

Link to comment
Share on other sites

  • Developers

I was not rude, just simply stated a fact as you posted your reply within 4 minutes of the help you had receive, so hence the question. ;)

When this feels as being rude then have a look in the mirror and have a good talk to the person you see.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

well then, i apologize.

i was able to code something very simple for my purpose. It works as I intended.

Now, I tried a simple gui to see if I can use an exe instead of going into the code to change the pixels.

Got the inputs made for pixels, and everything...but gui disappears without a sleep(x).

I don't want the gui to disappear unless I click on X or close button on onevent.

What's required at this point?

Link to comment
Share on other sites

  • Developers

Show your code in case it doesn't work the way you expect and explain what isn't working.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

GUICreate("AutoClick", 450, 150)

GUICtrlCreateLabel("Topleft of the box", 30, 10)
Local $x1 = GUICtrlCreateInput("", 150,5, 100, 20)
Local $y1 = GUICtrlCreateInput("", 300,5, 100, 20)

GUICtrlCreateLabel("Bottomright of the box", 30, 50)
Local $x2 = GUICtrlCreateInput("", 150,45, 100, 20)
Local $y2 = GUICtrlCreateInput("", 300,45, 100, 20)

GUICtrlCreateLabel("Pixels for Hole #", 30, 90)
Local $x3 = GUICtrlCreateInput("", 150,85, 100, 20)
Local $y3 = GUICtrlCreateInput("", 300,85, 100, 20)

Local $run = GUICtrlCreateButton("Run", 150, 120, 85, 25)
Local $closeapp = GUICtrlCreateButton("Close", 250, 120, 85, 25)

GUICtrlSetOnEvent($run, "clickpixels")
GUICtrlSetOnEvent($closeapp, "closeapp")

Func closeapp()
    MsgBox($MB_OK, "Good-bye", "You selected CLOSE! Exiting...")
    Exit
EndFunc

GUISetState(@SW_SHOW)
sleep(5000)    <- without this, gui just opens and disappears right away. i'm probably missing something here.

Func clickpixels()

   While $x1 <= $x2
      While $y1 <= $y2
         MouseClick($MOUSE_CLICK_LEFT, $x1, $y1, 1, 10)
         Sleep(3000)
         $y1 = $y1 + 1
         MouseClick($MOUSE_CLICK_LEFT, $x3, $y3, 1, 10)
         Sleep(500)
         MouseClick($MOUSE_CLICK_LEFT, $x1-1, $y1, 1, 10)
         Sleep(1500)
      WEnd
      $x1 = $x1 + 1
   WEnd

EndFunc

 

Edited by Jos
Added codebox
Link to comment
Share on other sites

  • Developers

You need to add a close loop (While .. Wend)  like is shown in the Helpfile example for GUICtrlSetOnEvent()

Jos

Ps: Please use a codebox when posting code. :)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

"Doesn't work" doesn't mean much unless you tell us what you are trying to do and what it is that doesn't work.

So give us some details on what you are doing and what is not working.

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Local $x1 = 661
Local $y1 = 254
Local $x2 = 767
Local $y2 = 355
Local $x3 = 161
Local $y3 = 539

While $x1 <= $x2
   While $y1 <= $y2
      MouseClick($MOUSE_CLICK_LEFT, $x1, $y1, 1, 10)
      Sleep(3000)
      $y1 = $y1 + 1
      MouseClick($MOUSE_CLICK_LEFT, $x3, $y3, 1, 10)
      Sleep(500)
      MouseClick($MOUSE_CLICK_LEFT, $x1-1, $y1, 1, 10)
      Sleep(1500)
   WEnd
   $x1 = $x1 + 1
WEnd

I need those variables to be numbers. 

GUICtrlCreateInput("", 150,5, 100, 20)

gives me a string?

When i run the script, I think the loop is playing around pixels 0,0.

Link to comment
Share on other sites

  • Developers

The variables will be numbers.
Looks like you logic is flawed as you never reset your $y2 back to its initial value after the second while-wend loop ends.

ps. please make sure you have read our forum rules ... especially the section about game automation.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...