Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Checking multiple Pixelgetcolor



  • Please log in to reply
2 replies to this topic
Birdy64
  • Members
  • 6 posts
  • Last active: Oct 10 2019 07:10 PM
  • Joined: 30 Oct 2013
I have tried the below script and it doesn't seem to work properly.  If I do just one Pixelgetcolor in the script, it works great.  Any ideas what I'm doing wrong?
 
 
Pixelgetcolor, Color, 1438, 1287
    if (Color = 0x0EC9FF) and
Pixelgetcolor, Color, 1095, 1283
    if (Color = 0x0EC9FF) and
Pixelgetcolor, Color, 995, 1283
    if (Color = 0x0EC9FF)
    {
        Sendinput {F5}
            }
else
Sendinput {F4}

 



MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
✓  Best Answer

You can't write an if-statement using commands (only functions).

Which means you have to perform those actions before checking their results.

Pixelgetcolor, Color1, 1438, 1287
Pixelgetcolor, Color2, 1095, 1283
Pixelgetcolor, Color3, 995, 1283
    if ((Color1 = 0x0EC9FF) AND (Color2 = 0x0EC9FF) AND (Color3 = 0x0EC9FF))
        Sendinput {F5}
    else
        Sendinput {F4}

Also, use the " Code <> " tag when posting code to the forum.


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio Fran├ža -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


Birdy64
  • Members
  • 6 posts
  • Last active: Oct 10 2019 07:10 PM
  • Joined: 30 Oct 2013

Ahh I see! Thanks so much!  I am still learning!