A mere apprentice asks for help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Tio_oddish
Posts: 2
Joined: 29 Apr 2024, 17:29
Contact:

A mere apprentice asks for help

29 Apr 2024, 18:06

What I want to do is for my script in AHK to be active constantly checking the color that I defined on my screen in the exact coordinates and if it finds that color press the F5 key, but I don't know where I'm going wrong, I ask the Masters for help.

SCRIPT -> Please don't judge, I'm having a lot of difficulty learning.

Code: Select all

#Persistent 

        Pixelgetcolor, 525763, 1275, 287
        if (Color = 525763)
            Send, {f5}
	
Return

[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]
Last edited by joedf on 29 Apr 2024, 18:09, edited 1 time in total.
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: A mere apprentice asks for help

29 Apr 2024, 19:44

See the comments. Depending on your answers, some modifications would be necessary.

Code: Select all

loop {
	Pixelgetcolor, Color, 1275, 287 ; where did you get these coordinates?  are they relative to the active window or the screen?
	if (Color = 0x525763) ; where did you get this color? is it BGR or is it really in RGB format?
	Send, {F5} ; what’s supposed to happen after this? stop or keep checking?
}	
return
Tio_oddish
Posts: 2
Joined: 29 Apr 2024, 17:29
Contact:

Re: A mere apprentice asks for help

29 Apr 2024, 21:54

boiler wrote:
29 Apr 2024, 19:44
See the comments. Depending on your answers, some modifications would be necessary.

Code: Select all

loop {
	Pixelgetcolor, Color, 1275, 287 ; where did you get these coordinates?  are they relative to the active window or the screen?
	if (Color = 0x525763) ; where did you get this color? is it BGR or is it really in RGB format?
	Send, {F5} ; what’s supposed to happen after this? stop or keep checking?
}	
return

---------------------------------------------------------------------------------------//----------------------------------------------------------------------------
where did you get these coordinates? are they relative to the active window or the screen? // Full screen client
where did you get this color? is it BGR or is it really in RGB format? // RGB
what’s supposed to happen after this? stop or keep checking? // continue checking if the color changes, stop clicking the key
I'm using Window Spy for AHKv2 to have this data.


WINDOWN TITLE< CLASS AND PROCESS:
Tibia - Finn Kieran
ahk_class Qt5158QWindowOwnDCIcon
ahk_exe client.exe
ahk_pid 10468
ahk_id 2099580

***************
MOUSE POSITION:
Screen: 330, 14
Window: 330, 14
Client: 329, 13 (default)
Color: 272727 (Red=27 Green=27 Blue=27)

I don't really understand how the program works, but I'm trying to make it work as much as possible.
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: A mere apprentice asks for help  Topic is solved

30 Apr 2024, 01:09

Given your answers, these additional changes are needed::

Code: Select all

CoordMode, Pixel, Screen

loop {
	Pixelgetcolor, Color, 1275, 287, RGB
	if (Color = 0x525763)
		Send, {F5}
}	
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, olshev and 104 guests