Jump to content

How to capture the change of a patch in screen?


C1628
 Share

Recommended Posts

Hi,

I would like to write a program to capture the change of TWO patches in the screen. I have the flow chart but do not know how to write the script. Can any experts here help me?

The problem and flow are as follows:

Problem:

Write a program to capture any change in color of TWO patches A and B in the screen. The size of each patch will be as small as 0.5cm x 0.5cm. Actually there are only two color status for each patch, A0 or A1, B0 or B1. And there will always be only three combinations of the two patches as shown in figure 1 to figure 3.

(e.g. The color of A0 is totally dark red, A1 is totally light red.)

Posted Image Figure 1 .Posted Image Figure 2

Posted Image Figure 3

Flow:

1. Initialize 2 variables Xa , Xb to be zero,

2. Display the two variables Xa , Xb in the screen,

3. Define the co-ordinates and size of the two patches A and B,

4. Define the initial status of patches A and B as combination 1,

5. Capture the change of the two fix patches A and B in the screen every 1 second,

6. If change from combination 1 to combination 2, then

Xa = Xa + 1; Xb = 0;

7. If change from combination 2 back to combination 1, then

Xa = Xa; Xb = Xb; (no change in variables)

8. If change from combination 1 to combination 3, then

Xa = 0; Xb = Xb +1;

9. If change from combination 3 back to combination 1, then

Xa = Xa; Xb = Xb; (no change in variables)

10. If change from combination 2 to combination 3, then

Xa = 0; Xb = Xb +1;

11. If change from combination 3 to combination 2, then

Xa = Xa + 1; Xb = 0;

12. If Xa > 6 then play the musical file C:/a.wav,

13. If Xb > 6 then play the musical file C:/b.wav,

14. Return to step 5.

Thank you for your kind assistance in advance!

Link to comment
Share on other sites

  • Moderators

This isn't the support forum, but look at PixelGetColor() or PixelCheckSum() in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...