Basically I am trying to make a script that checks if the screen is stopped by some error or popup of a flash game (in browser), checking some pixels on the screen and comparing if it is the same color some time later, if it is, send a command to refresh the browser.
I was part of the script however, I realize that the screen itself sometimes repeats the same pixels on occasion, which ends updating the page unnecessarily, which makes it necessary for this check sometimes (for example 3-5 times), I think I can Repeating the check inside the if several times, however, as I'm learning, I believe I have a way to wipe the script by doing a counter or something like that within a loop, in case I ask for this check many times before giving the refresh command, which would make the script very large and repetitive. Would you have some way to do the same check several times and if all positive or negative it leaves the loop?
As I said I'm new, I hope it was clear, I'm trying to improve myself, I thought the while loop could solve, however I could not implement the same script as I wanted, I do not think I understood its function correctly.
Thanks!
Code: Select all
Loop
{
PixelGetColor, initialcolour1, 250, 380, RGB ; Finds Colour
PixelGetColor, initialcolour2, 692, 385, RGB ; Finds Colour
PixelGetColor, initialcolour3, 1169, 450, RGB ; Finds Colour
PixelGetColor, initialcolour4, 770, 672, RGB ; Finds Colour
Sleep, 10000
PixelGetColor, currentcolour1, 250, 380, RGB ; Checks Colour
PixelGetColor, currentcolour2, 692, 385, RGB ; Checks Colour
PixelGetColor, currentcolour3, 1169, 450, RGB ; Checks Colour
PixelGetColor, currentcolour4, 770, 672, RGB ; Checks Colour
if (initialcolour1 = currentcolour1 && initialcolour2 = currentcolour2 && initialcolour3 = currentcolour3 && initialcolour4 = currentcolour4){
;here would be the command (send f5 or click in refresh)
}
else {
Sleep, 1000
}}
return