Errious

Help on combining PixelSearch and PixelChecksum

1 post in this topic

#1 ·  Posted

Hello,

for observing changes in a specific area of my screen i used a script what gave me an visual reaction when changes occure, now i would like to use another script what can identify colors to do the same but i have some trouble to put it together and hope for some help.

 

This here is the script i used and this works fine so far:

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")

While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        Sleep(1000)

Local $iCheckSum = PixelChecksum(1688, 16, 1909, 207)

While $iCheckSum = PixelChecksum(1688, 16, 1909, 207)
    Sleep(500)
 WEnd

SplashTextOn ( "", "WATCH OUT !" , 125 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "", 1)
Sleep(2000)
SplashOff()

WEnd
EndFunc   ;==>ShowMe

This script is what i want to modify my old with:

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

Local $CoordsA, $CoordsB, $CoordsC

While 1
    $CoordsA = PixelSearch(1688, 16, 1909, 207, 0x401718, 7)
    $CoordsB = PixelSearch(1688, 16, 1909, 207, 0x602E2A, 5)
    $CoordsC = PixelSearch(1688, 16, 1909, 207, 0x3F4547, 0)

    If IsArray($CoordsA) Then
      ; The colour A was found
        SplashTextOn ( "", "RED !" , 125 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "", 1)
         Sleep(2000)
         SplashOff()
    Else
      ; The colour A was not found
   EndIf
   Sleep(100)
    If IsArray($CoordsB) Then
      ; The colour B was found
        SplashTextOn ( "", "ORANGE !" , 125 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "", 1)
         Sleep(2000)
         SplashOff()
    Else
      ; The colour B was not found
   EndIf
   Sleep(100)
       If IsArray($CoordsC) Then
      ; The colour C was found
        SplashTextOn ( "", "GREY !" , 125 , 50 , 1800 , 220 , $DLG_TEXTLEFT, "", 1)
        Sleep(2000)
        SplashOff()
    Else
      ; The colour C was not found
    EndIf
    Sleep(100)
WEnd

As you can see i try to let the new script do what the old one was doing, just the little SplachText when a specific color occurs in the area of my screen where the colored sign/pixel occurs.

 

Ideas?

Share this post


Link to post
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