Click pixelsearch help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Click pixelsearch help

Post by Ragnar4293 » 10 Oct 2021, 19:54

Hello, im wondering if any you guys can help me, im looking for help on pixelsearch im wanting to set search area where it would click any colour that pops up that isnt 0x21242E & 0x4EE6EB , i cant give the colours that i want it to click as its random every time i load, thanks if you can help.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Click pixelsearch help

Post by mikeyww » 10 Oct 2021, 20:26

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 11 Oct 2021, 06:40

mikeyww wrote:
10 Oct 2021, 20:26

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y
Thank you, i think its clicking those colours tho not sure if its because im doing the search area wrong, y := x := 776,244,885,914 , for x1,y1,x2,y2, will this script run until a colour is found once found it will stop until i start again, sorry im still trying to learn, thanks for help again.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Click pixelsearch help

Post by mikeyww » 11 Oct 2021, 07:21

Try:

Code: Select all

x1 := 776, y1 := 244, x2 := 885, y2 := 914

F3:: ; Pressing F3 triggers the subroutine
Loop, % x2 - x1 + 1 {
 x := x1 + A_Index - 1
 Loop, % y2 - y1 + 1 {
  y := y1 + A_Index - 1
  PixelGetColor, color, x, y, RGB
  ToolTip, (%x%`,%y%) = %color%
  If color not in 0x21242E,0x4EE6EB
  { MouseClick,, x, y
    SoundBeep, 1000
    Return
  }
 }
}
Return

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 11 Oct 2021, 08:23

mikeyww wrote:
11 Oct 2021, 07:21
Try:

Code: Select all

x1 := 776, y1 := 244, x2 := 885, y2 := 914

F3:: ; Pressing F3 triggers the subroutine
Loop, % x2 - x1 + 1 {
 x := x1 + A_Index - 1
 Loop, % y2 - y1 + 1 {
  y := y1 + A_Index - 1
  PixelGetColor, color, x, y, RGB
  ToolTip, (%x%`,%y%) = %color%
  If color not in 0x21242E,0x4EE6EB
  { MouseClick,, x, y
    SoundBeep, 1000
    Return
  }
 }
}
Return
Thank you so much this worked, sorry to be a pain, is it possible to make it scan and detect instantly in the box i create with the x and y, reason i would like to make it instant if colour on screen the colour might be gone by time the recent one you made finds it, again thank you so much for taking time to help me :)

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Click pixelsearch help

Post by mikeyww » 11 Oct 2021, 08:32

I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.

If you are searching for a specific color or a specific range of hues, you can use PixelSearch.

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 11 Oct 2021, 08:38

mikeyww wrote:
11 Oct 2021, 08:32
I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.
Thank you again mikey for helping me alot, thanks for the info!

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 11 Oct 2021, 08:56

mikeyww wrote:
11 Oct 2021, 08:32
I believe that your question is how to increase the speed. There might be some other earlier posts about that, along with examples of scripts that use different techniques for the pixel searches. You could search the forum for them. I have lost track of those older posts. You might include the term "Gdip" in your search.

If you are searching for a specific color or a specific range of hues, you can use PixelSearch.
Im just going to use the same x1 and x2 but different y1 and y2 so its in a straight line, just looking to speed up lets say when it start scanning 100-500 i would like it to be instant if possible, i will have a look at the stuff you recommended

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 11 Oct 2021, 10:07

Having no luck here improving speed :lol:

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 19 Oct 2021, 16:52

mikeyww wrote:
10 Oct 2021, 20:26

Code: Select all

y := x := 100
PixelGetColor, color, x, y, RGB
If color not in 0x21242E,0x4EE6EB
 MouseClick,, x, y
Hello again mikey, sorry for being a best,how would i add multiple y co ords as im going to use the same x, i dont want to use the other method x1 y1 x2 y2, thanks again if you can help me and sorry for being a pest again.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Click pixelsearch help

Post by mikeyww » 19 Oct 2021, 20:00

Code: Select all

x = 100
For each, y in [100, 200, 300] {
 PixelGetColor, color, x, y, RGB
 If color not in 0x21242E,0x4EE6EB
  MouseClick,, x, y
}

Ragnar4293
Posts: 12
Joined: 10 Oct 2021, 16:19

Re: Click pixelsearch help

Post by Ragnar4293 » 20 Oct 2021, 07:03

mikeyww wrote:
19 Oct 2021, 20:00

Code: Select all

x = 100
For each, y in [100, 200, 300] {
 PixelGetColor, color, x, y, RGB
 If color not in 0x21242E,0x4EE6EB
  MouseClick,, x, y
}
Hello again, it seems to be only searching the the last input number, for example , if there is a color in 100 and 200 but not 300 it wont click 100 or 200

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Click pixelsearch help

Post by mikeyww » 20 Oct 2021, 07:28

There is no need to guess. Inside the loop, you can add lines that display the color values as well as the results of the conditional statement. That will help you to pinpoint the issue.

Post Reply

Return to “Ask for Help (v1)”