click part of screen when number pops up

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Sam77899
Posts: 8
Joined: 01 Oct 2021, 12:35

click part of screen when number pops up

Post by Sam77899 » 21 May 2022, 20:22

hi i have no idea where to start or how to do this but basically what i would like todo is have a script where if a number pops up on the screen or webpage like if number 35 pops up click on it then wait like 15 seconds then wait for number to pop up
again and repeat i have looked it up and cant find other forums explaining how to autoclick certain part of screen when a number pops up or just click in general wherever that number pops up any help is appreciated

User avatar
Chunjee
Posts: 1400
Joined: 18 Apr 2014, 19:05
Contact:

Re: click part of screen when number pops up

Post by Chunjee » 21 May 2022, 23:37

Well I would think of it like this; you have a detection part, and an action part
Detecting the number probably accomplished by something like ImageSearch; lets do it in a loop so it tries over and over

Code: Select all

while (true) {
	ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
	if (OutputVarX) {
		; do something
	}
}


Then what you wanna do is the action; Click in this case

Code: Select all

MouseClick, WhichButton, X, Y


put them together:

Code: Select all

while (true) {
	ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
	if (OutputVarX) {
		MouseClick, WhichButton, X, Y
		; wait 15 seconds
		sleep, % 15 * 1000
	}
}

Post Reply

Return to “Ask for Help (v1)”