Loading Google Chrome using Pixel Locator? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
eblanc
Posts: 67
Joined: 08 May 2019, 14:41

Loading Google Chrome using Pixel Locator?

06 Jun 2019, 11:27

Hi, I'm running a script that needs a page to load. Sleep mode doesn't work as it's not consistent, also sometimes pages don't load.

I'm tried using image search, (didn't work) and some other ideas such as com, and win active by name, but page name can be different.

This seems like a smart idea. When page load the way I need there is a login box, with a blue button. I would like to use that as reference, if it finds it. Send me message. And maybe add a 30 second timeout.

This is the script I have so far. It doesn't seem to work. Page refreshes, (which should mean chrome is active, right?) but I never get the msgbox, more over I cannot run the script again, only once, which tells me it's still running. forever.

Thing that might be important, I am running two screens in my setup. But I believe coordinates are correct. (I'm selecting the page, and going by Window value)

Image

Code: Select all

!z::  
	if PixelGetColor, 4285F4, 1037, 292
		{
		MsgBox I found your stupid pixel
		return
		}
	Else
		{
		msgbox, I didn't find your stupid pixel, work harder.
		return
		}
return
User avatar
Xtra
Posts: 1446
Joined: 02 Oct 2015, 12:15

Re: Loading Google Chrome using Pixel Locator?

06 Jun 2019, 12:09

Use CoordMode.

PixelGetColor syntax:

Code: Select all

PixelGetColor, pColor, 1037, 292
if (pColor = "0x4285F4")
    msgbox, Color Found
User avatar
eblanc
Posts: 67
Joined: 08 May 2019, 14:41

Re: Loading Google Chrome using Pixel Locator?

06 Jun 2019, 14:03

Xtra wrote:
06 Jun 2019, 12:09
Use CoordMode.

PixelGetColor syntax:

Code: Select all

PixelGetColor, pColor, 1037, 292
if (pColor = "0x4285F4")
    msgbox, Color Found
Tried but no luck. No message.

I tried using this script to see if it would work, always gives me color not found.

Code: Select all

!z::  
	send {F5}
	Sleep, 2000
	PixelGetColor, pColor, 1037, 292
if (pColor = "0x4285F4")
    msgbox, Color Found
Else msgbox, color not found
return
I'm wondering if its' because I have two screens or am I missing something?
Hellbent
Posts: 712
Joined: 23 Sep 2017, 13:34

Re: Loading Google Chrome using Pixel Locator?

06 Jun 2019, 14:35

You need to add the RGB option to your PixelGetColor Command.

As is you're looking for a orange-ish color not a blue-ish one

As is, you're trying to match a orange-ish color to a blue-ish one

Code: Select all

PixelGetColor,pColor,x,y,RGB
User avatar
Xtra
Posts: 1446
Joined: 02 Oct 2015, 12:15

Re: Loading Google Chrome using Pixel Locator?  Topic is solved

06 Jun 2019, 18:40

After looking at your window spy image the color you should be looking for is:

Code: Select all

PixelGetColor,pColor,1037,292,RGB
if (pColor = "0x4986EA")
    msgbox, bingo
else
    msgbox, Color found was %pColor% not 0x4986EA
User avatar
eblanc
Posts: 67
Joined: 08 May 2019, 14:41

Re: Loading Google Chrome using Pixel Locator?

07 Jun 2019, 11:54

Xtra wrote:
06 Jun 2019, 18:40
After looking at your window spy image the color you should be looking for is:

Code: Select all

PixelGetColor,pColor,1037,292,RGB
if (pColor = "0x4986EA")
    msgbox, bingo
else
    msgbox, Color found was %pColor% not 0x4986EA
Yep. That fixed it. Clever to put in msgbox to find the actual color. Which was 0X4285F4

Just for me to understand more as closing this topic, Why did we have to add pColor and RGB to the command?

Thanks for the help!
User avatar
Xtra
Posts: 1446
Joined: 02 Oct 2015, 12:15

Re: Loading Google Chrome using Pixel Locator?

07 Jun 2019, 12:05

Click PixelGetColor in the codebox to bring up the ahk help file for proper usage/syntax of the pixelgetcolor command.
RGB is what window spy shows for color. (PixelGetColor uses BGR by default unless RGB is specified)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], DavidBevi, Henrik_Oe, hoppfrosch and 204 guests