simplify Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ik4u
Posts: 80
Joined: 05 Jun 2020, 13:52
Contact:

simplify

29 Jul 2021, 15:57

Code: Select all

PixelGetColor, color, 160, 160
if color=0xE0E0E0
Click 335 380
PixelGetColor, color, 195, 160
if color=0xE0E0E0
Click 380 380
PixelGetColor, color, 230, 160
if color=0xE0E0E0
Click 420, 380
PixelGetColor, color, 265, 160
if color=0xE0E0E0
Click 465 380
PixelGetColor, color, 300, 160
if color=0xE0E0E0
Click 510 380
PixelGetColor, color, 335, 160
if color=0xE0E0E0
Click 550 380     
Can this be simplified, color is same in all
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: simplify

29 Jul 2021, 16:14

Code: Select all

loop, 6 {
	PixelGetColor, color, 160 + (A_Index - 1) * 35, 160
	if (color = 0xE0E0E0)
		Click, % [335, 380, 420, 465, 510, 550][A_Index] "," 380
}
ik4u
Posts: 80
Joined: 05 Jun 2020, 13:52
Contact:

Re: simplify

29 Jul 2021, 16:46

boiler wrote:
29 Jul 2021, 16:14

Code: Select all

loop, 6 {
	PixelGetColor, color, 160 + (A_Index - 1) * 35, 160
	if (color = 0xE0E0E0)
		Click, % [335, 380, 420, 465, 510, 550][A_Index] "," 380
}
The code works, however she skips some clicks, can you please add a small delay
between clicks to avoid a miss
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: simplify

29 Jul 2021, 16:58

Code: Select all

 loop, 6 {
	PixelGetColor, color, 160 + (A_Index - 1) * 35, 160
	if (color = 0xE0E0E0) {
		Click, % [335, 380, 420, 465, 510, 550][A_Index] "," 380
		Sleep, 100
	}
}
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: simplify  Topic is solved

29 Jul 2021, 17:10

If it's still missing clicks, I would try this instead:

Code: Select all

 loop, 6 {
	PixelGetColor, color, 160 + (A_Index - 1) * 35, 160
	if (color = 0xE0E0E0) {
		MouseMove, [335, 380, 420, 465, 510, 550][A_Index], 380, 0
		Sleep, 100
		Click
	}
}
Or this to make sure you don't move the mouse and cause it to click in a different location:

Code: Select all

 loop, 6 {
	PixelGetColor, color, 160 + (A_Index - 1) * 35, 160
	if (color = 0xE0E0E0) {
		BlockInput, On
		MouseMove, [335, 380, 420, 465, 510, 550][A_Index], 380, 0
		Sleep, 100
		Click, % [335, 380, 420, 465, 510, 550][A_Index] "," 380
		BlockInput, Off
	}
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 281 guests