PixelGetColor slow

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
defnotcracker

PixelGetColor slow

23 Jan 2017, 16:46

Hi, I'm using the PixelGetColor function to throw a color to a variable, for example:

PixelGetColor, Red, 0, 0
If red = 0xC0L0R
Send {}

Only one works very well, the problem is that when adding another PixelGetColor is in the same script or another is very slow and none of the 2 work correctly, is there any way to leave 2 or more PixelGetColor and that they run faster? For example, every 50ms at the most.

Thank you in advance
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: PixelGetColor slow

23 Jan 2017, 19:23

Your example does not show the problem you are having.Post the problem code and you will get an accurate answer.
defnotcracker

Re: PixelGetColor slow

23 Jan 2017, 19:34

Code: Select all

PixelGetColor, verde, 520, 630
PixelGetColor, vermelho, 596, 622
Loop
{

        if %verde% = 0x009800
        {
                      Send, {A}
        }
        if %vermelho% = 0x0000FF
        {
                      Send, {S}
        }
}

This is the code
Entropy42
Posts: 29
Joined: 11 Dec 2016, 12:34

Re: PixelGetColor slow

23 Jan 2017, 23:36

I posted a very similar problem just a day ago, see here:
https://autohotkey.com/boards/viewtopic.php?f=5&t=27098
The solution given worked for me, and was just updated today to fix a memory leak.
Last edited by Entropy42 on 24 Jan 2017, 12:35, edited 1 time in total.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: PixelGetColor slow

24 Jan 2017, 06:05

Remove all %.

Also, the PixelGetColor isn't inside the loop, so it will check both pixels once and then repeatedly send the keys based on that result.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, peter_ahk, Spawnova and 341 guests