Jump to content

Help! Compare Pixelchecksum Resul Against Pre-Saved Checksum from file.


 Share

Recommended Posts

An exmple:

#include <Misc.au3>

Global Const $CHECKSUM_PATH = @ScriptDir & "\PixCheckSum.txt"
Global $INIT_TIME

While True
    If _IsPressed('20') Then    ;Press SPACEBAR for search PixelChecksum in file
        $POS = MouseGetPos()
        $CHECKSUM = PixelChecksum($POS[0]-10,$POS[1]-10,$POS[0]+10,$POS[1]+10)
        TrayTip("Check result",PixCheckSum($CHECKSUM),1)
    ElseIf _IsPressed('12') And ((TimerDiff($INIT_TIME)/1000) >= 3) Then    ;Press ALT for write current PixelChecksum in file
        $INIT_TIME = TimerInit()
        $POS = MouseGetPos()
        $CHECKSUM = PixelChecksum($POS[0]-10,$POS[1]-10,$POS[0]+10,$POS[1]+10)
        WriteCheckSum($CHECKSUM)
    EndIf
    Sleep(10)
WEnd

Func PixCheckSum($CHECKSUM)
    Local $FILE = FileOpen($CHECKSUM_PATH,0)
    Local $LINE, $COUNT = 1, $RESULT = False
    While True
        $LINE = FileReadLine($FILE,$COUNT)
        If @error Then ExitLoop
        $COUNT += 1
        If $CHECKSUM = $LINE Then
            $RESULT = True
            ExitLoop
        EndIf
    WEnd
    FileClose($FILE)
    Return $RESULT
EndFunc

Func WriteCheckSum($CHECKSUM)
    Local $FILE = FileOpen($CHECKSUM_PATH,1)
    FileWriteLine($FILE,$CHECKSUM)
    FileClose($FILE)
EndFunc
Edited by Andreik

When the words fail... music speaks.

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...