Sign in to follow this  
Followers 0
mercessb

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

2 posts in this topic

Hi,

I need help in comparing the results obtained from pixelchecksum function against a list of checksums recorded/saved earlier in text file.

Pls Help

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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
Sign in to follow this  
Followers 0