Help with one script (pixel colour; if and some other action

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Lisa_fch
Newbie
Posts: 2
Joined: Sat Mar 07, 2009 6:12 pm

Help with one script (pixel colour; if and some other action

Post by Lisa_fch » Sat Mar 07, 2009 6:22 pm

Hi to every one. Before anything, i speak in spanish, so I´m sorry about my raw English. Now, to the querry:

I´m looking for a script that once it´s running do the following task every 5 minutes based on the system time:

- Get pixel color from some area (40 vertical,consecutive pixels); posible colours: blue, yellow and white. ( Color "ONE").

- Get pixel color from one pixel: Posible colours: Black, white and grey. (Colour "TWO")

- If Colour "ONE" is white, continue looking for the other colours ( blue or yellow). If all the 40 pixel are white, do nothing.

Then:

-If colour "ONE" is Blue and Colour "Two" is black: do nothing

-If colour "ONE" is blue and colour "two" is white: ACTION 1 ( a serie of mouse movements and clicking)

- If colour "one" is blue and colour "two" is grey: ACTION 2 ( a serie of key pressing and mouse movements and clicking).

- If colour "one" is yellow and colour "two" is black: ACTION 3 ( idem above)

- If colour "one" is yellow and colour "two" is white: Do nothing.

- If colour "one" is yellow and colour "two" is grey: ACTION 4 ( idem above )

Then, do the same every 5 min based on the system time.

Is this posible? Can this script affect my system performance?

Thanks to all for reading this.
Bye

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 07, 2009 7:22 pm

Yes, this is all possible.

You will need to define pixel positions.
You will need to define the colors by numbers vs. names

You have almost written the script already, good througt process and presentation.

You are looking for such a script, but you will not find it, you will need to create it. Plenty of help here to work with your scripting efforts.

Here is some untested stuff to get you started. You will probably change all of it. Read the HELP file and look at the examples in the Help file. Syntax help is shown at the bottom of the Editor ...
//==================================
// Forum 3/7/09

Code: Select all

// Set color variable values
Let>blue=some color number
Let>yellow=some color number
Let>white=some color number
Let>black=some color number
Let>grey=some color number

// Initialize counter and pixel positions
Let>vCount=0
Let>Xpos1=some point
Let>Ypos1=some point
Let>Xpos2=some point
Let>Xpos2=some point

Label>Start
Let>vCount=%vCount%+1

// Get pixel color from some area (40 vertical,consecutive pixels); posible colours: blue, yellow and white. ( Color "ONE").
GetPixelColor>Xpos1,Ypos1,vColor1

// Get pixel color from one pixel: Posible colours: Black, white and grey. (Colour "TWO")
GetPixelColor>Xpos2,Ypos2,vColor2

// If Colour "ONE" is white, continue looking for the other colours ( blue or yellow). If all the 40 pixel are white, do nothing.
If %vColor1%=%white%
    Let>Ypos1=%Ypos%+1
    GoTo>Start
EndIf
If %vColor1%=%blue%
    MessageModal>Pixel%vCount% is Blue
    Let>Ypos1=%Ypos%+1
    GoTo>Start
EndIf
If %vColor1%=%yellow%
    MessageModal>Pixel%vCount% is Yellow
    Let>Ypos1=%Ypos%+1
    GoTo>Start
EndIf

// Repeat for 40 pixels
If>%vCount%<41,Start


// If colour "ONE" is Blue and Colour "Two" is black: do nothing

// If colour "ONE" is blue and colour "two" is white: ACTION 1 ( a serie of mouse movements and clicking)

// If colour "one" is blue and colour "two" is grey: ACTION 2 ( a serie of key pressing and mouse movements and clicking).

// If colour "one" is yellow and colour "two" is black: ACTION 3 ( idem above)

// If colour "one" is yellow and colour "two" is white: Do nothing.

// If colour "one" is yellow and colour "two" is grey: ACTION 4 ( idem above )

//Then, do the same every 5 min based on the system time.
Wait>300
GoTo>Start
// Can this script affect my system performance?
Everything affects performance. Depends what else is happening, depends on what actions you perform on color matches. Depends on changing focus between windows? Too many unknowns, but I suspect this would be a minimal hit on performance.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lisa_fch
Newbie
Posts: 2
Joined: Sat Mar 07, 2009 6:12 pm

Post by Lisa_fch » Sun Mar 15, 2009 9:47 pm

Thanks for the reply. It gave me a lot of ideas. I changed and removed the "count" lines and it works.

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