I need a little help here with WaitPixelColor...

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
loginphp
Newbie
Posts: 5
Joined: Sat Jul 06, 2013 7:04 am

I need a little help here with WaitPixelColor...

Post by loginphp » Sat Jul 06, 2013 7:16 am

First of all, I must say, this is easily the best macro software I have ever ran into lol I've downloaded and purchased countless of macro software and this one blows them all out of the water for heavy tasks.

On to my question.

I'm having a slight issue with something that probably has an easy fix.

I'm using WaitPixelColor, but the issue I'm running into is I need this command to recognize TWO colors on the same coordinate! Either one or the other I want to be recognized.

So I'm looking for a command that allows "this color code OR that color code". I need an 'either-or' action to be taken on this.

Look below to see what I mean.

WaitPixelColor>9479616,515,255,1
WaitPixelColor>10927853,515,255,1

As you can see, the coords are exactly the same on these two lines. However, the color code is different because it will depend on the application I'm using if either color code will appear ,and it's random.

So how do I incorporate these two color codes together? I need the macro to recognize either one or the other.

I tried this....

WaitPixelColor>9479616; 10927853,515,255,1 (this did not work)
WaitPixelColor>9479616-10927853,515,255,1 (this did not work)
WaitPixelColor>9479616/10927853,515,255,1 (this did not work)
WaitPixelColor>(9479616;10927853),515,255,1 (this did not work)

I can easily get the macro to recognize one color, but the application i'm working on has 2 different color codes at those coords and it's random whic one appears, yet I need to recognize either 1 or the other.

Thanks in advance!

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sat Jul 06, 2013 11:32 am

You could use GetPixelColor in a loop and have it monitor the X,Y position for the colors and then if either color is found go to a subroutine and perform whatever action you want. Or you could use the same loop and go to a Label instead of a subroutine. There is also image recognition but either one of my examples will work as long as the colors are always the same at the X,Y position.

Go to subroutine example:

Code: Select all

Label>WaitPixelColorLoop
Wait>0.1
GetPixelColor>515,255,PC
IF>{(%PC%=9479616)OR(%PC%=10927853)}
GoSub>ColorFound
ENDIF
Goto>WaitPixelColorLoop
  
SRT>ColorFound
  //Do Something

END>ColorFound

Go to label example:

Code: Select all

Label>WaitPixelColorLoop
Wait>0.1
GetPixelColor>515,255,PC
IF>{(%PC%=9479616)OR(%PC%=10927853)}
Goto>ColorFound
ENDIF
Goto>WaitPixelColorLoop
  
Label>ColorFound
  //Do Something

Goto>WaitPixelColorLoop

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sat Jul 06, 2013 1:26 pm

Perfect Examples By Rain There.
FIREFIGHTER

loginphp
Newbie
Posts: 5
Joined: Sat Jul 06, 2013 7:04 am

Post by loginphp » Sun Jul 07, 2013 12:53 am

Thanks a lot Rain :) You're obviously a script pro.

I'll try these examples in my script and see how they pan out =]

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Tue Jul 09, 2013 2:13 am

This is posted twice.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts