oops, one more, we dont need to create the dllstruct a million times either, just once in the top...
Global $posx = 1715, $posy = 705, $result = "", $code[4], $capture, $pixels = DllStructCreate('dword[2816]')
.
.
.
.
Func Getnumber($result)
Local $code[4] = [0,0,0,0], $value = 64; dllstructcreate was here, moved to top
DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $capture, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels))
For $loop = 1 To 2816 Step 440
$code[0] += DllStructGetData($pixels, 1, $loop ) > 4278190080 ? $value:0
$code[1] += DllStructGetData($pixels, 1, $loop+29) > 4278190080 ? $value:0
$code[2] += DllStructGetData($pixels, 1, $loop+58) > 4278190080 ? $value:0
$code[3] += DllStructGetData($pixels, 1, $loop+87) > 4278190080 ? $value:0
$value /= 2
Next
Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) & String($digit[$code[3]])
EndFunc
For some reason we cant hardcode the dllstructgetsize and getptr, so they'll have to stay.