Jump to content

Create a PixelChecksum using MouseClicks


jvanegmond
 Share

Recommended Posts

Quick and Dirty.

#include <GUIConstants.au3>
#include <Misc.au3>

$Form1 = GUICreate("CheckGen", 187, 118, 193, 115)
$Label1 = GUICtrlCreateLabel("Top", 96, 11, 23, 21)
$Label2 = GUICtrlCreateLabel("0", 48, 8, 36, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("Left", 8, 11, 22, 21)
$Label5 = GUICtrlCreateLabel("0", 48, 32, 36, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("Right", 8, 32, 29, 21)
$Label7 = GUICtrlCreateLabel("0", 144, 8, 36, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Label6 = GUICtrlCreateLabel("Bottom", 96, 35, 37, 21)
$Label8 = GUICtrlCreateLabel("0", 144, 32, 36, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Label9 = GUICtrlCreateLabel("Checksum", 8, 67, 54, 21)
$Label10 = GUICtrlCreateLabel("0", 72, 64, 108, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("If .. Then", 8, 96, 75, 17, 0)
$Button2 = GUICtrlCreateButton("Reset!", 96, 96, 75, 17, 0)
GUISetState(@SW_SHOW)
WinSetOnTop($Form1,"",1)

Dim $State = 0

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $State > 1 Then
                InputBox("CheckGen", "Copy and Paste box", 'If PixelChecksum(' & GUICtrlRead($Label2) & ', '& GUICtrlRead($Label7) & ', '& $Pos[0] & ', '& $Pos[1] & ') == ' & GUICtrlRead($Label10) & ' Then' )
            EndIf
        Case $Button2
            $State = 0
            GUICtrlSetData($Label5,0)
            GUICtrlSetData($Label8,0)
            GUICtrlSetData($Label10,0)
    EndSwitch
    Switch $State
        Case 0
            $Pos = MouseGetPos()
            GUICtrlSetData($Label2,$Pos[0])
            GUICtrlSetData($Label7,$Pos[1])
        Case 1
            $Pos = MouseGetPos()
            GUICtrlSetData($Label5,$Pos[0])
            GUICtrlSetData($Label8,$Pos[1])
            GUICtrlSetData($Label10, PixelChecksum(GUICtrlRead($Label2),GUICtrlRead($Label7),$Pos[0],$Pos[1]) )
    EndSwitch
    If _IsPressed(0x01) Then
        $State += 1
        While _IsPressed(0x01)
            Sleep(50)
        WEnd
    EndIf
WEnd
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...