Need help getting this script to work- I'm 99% sure I have the formatting incorrect

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Jahgoda
Posts: 1
Joined: 27 Jan 2023, 16:50

Need help getting this script to work- I'm 99% sure I have the formatting incorrect

Post by Jahgoda » 27 Jan 2023, 16:58

Code: Select all

Pause on
CoordMode,Pixel,Window
CoordMode,Mouse,Window

Loop
{PixelSearch, Px, Py, 413, 342, 576, 368, fefffe, 3, RGB
if ErrorLevel=0
    send {click 413, 342}
    sleep 10000
    send {click 483, 483}
    sleep 10000
    send {click 420, 200}
    sleep 10000
    send {click 440, 400}
    sleep 10000
    send {click 400, 320}}
Shift & F6::Pause
Here's the script. I think it's obvious what I'm trying to get to happen, but if not:
I'm trying to get pixel search on a loop (idk how to but would be perfect if it did a pixelsearch only every 5 minutes). If it finds the color, it sends a series of specified clicks.
Apologies if the solution is obvious- I'm quite new to AHK scripting ^^;
Last edited by joedf on 27 Jan 2023, 17:11, edited 1 time in total.
Reason: [code] tags

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

Re: Need help getting this script to work- I'm 99% sure I have the formatting incorrect

Post by mikeyww » 27 Jan 2023, 17:23

Although you show a block on line 6, you don't use one for the ErrorLevel. Indentation looks nice but has no functional effect on the script, so use a block if you need one.

See: https://www.autohotkey.com/docs/v1/lib/Block.htm

gmoises
Posts: 74
Joined: 18 Nov 2017, 16:43

Re: Need help getting this script to work- I'm 99% sure I have the formatting incorrect

Post by gmoises » 27 Jan 2023, 17:25

The most obvious is the {} pairs
I did not run your code

Code: Select all

Pause on
CoordMode,Pixel,Window
CoordMode,Mouse,Window

Loop
{	PixelSearch, Px, Py, 413, 342, 576, 368, fefffe, 3, RGB
	if ErrorLevel=0
	{	send {click 413, 342}
		sleep 10000
		send {click 483, 483}
		sleep 10000
		send {click 420, 200}
		sleep 10000
		send {click 440, 400}
		sleep 10000
		send {click 400, 320}}
	}
}
Shift & F6::Pause

Post Reply

Return to “Ask for Help (v1)”