if #IfWinActive 'xx' AND the pixel_color of this position is 123 Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

if #IfWinActive 'xx' AND the pixel_color of this position is 123

29 Dec 2017, 04:16

I want to apply several shortcuts to a IfWinActive condition plus a pixel color

I'm looking for something that would look like:

Code: Select all

If (WinActive ahk_exe abc.exe) and (PixelGetColor at  1359, 64 RGB is "0x85C78B")
^a::
msgbox yes
I know I could do that (bellow) but is there a shorter way?


Code: Select all

#IfWinActive ahk_exe abc.exe 
^a::
	PixelGetColor mycolor, 1359, 64 RGB 

	if (color_sync_button="0x85C78B")
		{
		; dont do anything 
		return
		}
	else 
		{
		msgbox yes
		return
		}
^b::
	PixelGetColor mycolor, 1359, 64 RGB 

	if (color_sync_button="0x85C78B")
		{
		; dont do anything 
		return
		}
	else 
		{
		msgbox yes
		return
		}
etc. 
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: if #IfWinActive 'xx' AND the pixel_color of this position is 123  Topic is solved

29 Dec 2017, 13:09

Maybe it helps using functions ,it depends on what you want to do .

example:

Code: Select all

#If  WinActive("ahk_exe abc.exe") and get_pixel(1359, 64,0x85C78B)
^a::
msgbox yes
return
#If

get_pixel(x,y,color){
PixelGetColor mycolor, x,y, RGB
if (mycolor=color)
return 1
else
return 0
}
soundcloud.com/user-32706894
nadjibSoft
Posts: 9
Joined: 29 Dec 2017, 14:57
Facebook: 100011403841640

Re: if #IfWinActive 'xx' AND the pixel_color of this position is 123

29 Dec 2017, 15:26

if your title is "my pge". and the pixel is:"0x85C78B"
___________________________________
pixelExist(color, X, Y)
{
;return true if the pixel exist, and false if alse
}
IfWinActive , Gumroad - Mozilla Firefox
{
if(pixelExist("0x85C78B", X, Y))
{
MsgBox, OK
}
}

if you want a help inter my profile
partof
Posts: 95
Joined: 16 Jan 2016, 08:38

Re: if #IfWinActive 'xx' AND the pixel_color of this position is 123

30 Dec 2017, 17:07

noname wrote:Maybe it helps using functions ,it depends on what you want to do
It's perfect thanks a lot! (I just understood how to build ahk function, I'm very happy!)

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Godvicien, Google [Bot], MannyKSoSo, pureby, sinkfaze and 151 guests