Jump to content

Please explain how this works


Recommended Posts

If possible please add or edit the comments to explain how this works.

 

;includes functions from other things
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

;hotkeys
HotKeySet("{ESC}", _exit)
HotKeySet("{F1}", _scan)

;global variables
Global $win_title                    ;name of the window
Global $area_x                        ;
Global $area_y                        ;
Global $area_w                       ;
Global $area_h                        ;
Global $cursor                         ;
Global $rect_file                      ;
Global $hbmpscreen              ;
Global $i=  1043                      ;moves the rect
Global $ii=    378                      ;moves the rect
Global $x=1044                        ;inner rect offset
Global $y=501                          ;inner rect offset
Global $hbmprect                    ;image inside rect
Global $hscreen                        ;image whole screen
                                   
_GDIPlus_Startup()                    ;?

;display hotkeys on screen
ToolTip("Press F1 to scan | Press ESC to Exit",0,0)

                                    ;infinite loop to keep prog running
While 1
    Sleep(100)
WEnd

Func _scan()
;~ reads your screen area:
_read()
;~ converts screen captured into bmp
_convert()
;~ .  Loads converted bmp to be read
_loadBMP()
;~ compares the bmp of your scanned screen to the actual screen that is being displayed
_compare()
EndFunc
                                    ;reads screen
Func _read()
    $hscreen = _ScreenCapture_CaptureWnd("", WinGetHandle($win_title), $area_x, $area_y, $area_x + $area_w, $area_y + $area_h, $cursor)
EndFunc
                                    ;converts screen into bmp
Func _convert()
    _GDIPlus_BitmapCreateFromHBITMAP($hscreen)
EndFunc
                                    ;loads converted screen
Func _loadBMP()
_GDIPlus_BitmapCreateFromFile($rect_file)
EndFunc
                                    ;compares savedBMP to current screen
Func _compare()
;If(                              below code                                     ) = (                   below code           ) Then
If _GDIPlus_BitmapGetPixel($hbmpscreen, ($i + $x) - $area_x, ($ii + $y) - $area_y) = _GDIPlus_BitmapGetPixel($hbmprect, $x, $y) Then
;display message box titled found with a message of found
MsgBox("","","found")
;if above is not correct then

EndIf
EndFunc
                                    ;exit func
Func _exit()
    Exit
EndFunc

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

×
×
  • Create New...