If there is any other information you need, please feel free to ask.
thread.ahk
Code: Select all
#Persistent
#NoTrayIcon
#include, Gdip.ahk
#include, Vis2.ahk
SetBatchlines, -1
SetWorkingDir %A_ScriptDir%
CoordMode,Mouse,Window
CoordMode,Pixel,Window
pToken := Gdip_Startup()
stats := CriticalObject(A_Args[1])
SetTimer, update_stats, 250
update_stats:
if (!stats["user_pause"]) {
try {
start:=A_TickCount
WinGet, hwnd, ID, A
;pToken := Gdip_Startup()
bmpHaystack := Gdip_BitmapFromScreen( "hwnd:" hwnd )
stats["value1"] := OCR( bmpHaystack, , [100, 23, 50, 25] ) + 0
if !stats["value1"] {
stats["value1"] := .7
}
stats["value2"] := OCR( bmpHaystack, , [100, 42, 50, 25] ) + 0
if !stats["value2"] {
stats["value2"] := 90
}
difference:=A_TickCount-start
;gdip_Shutdown( pToken )
Gdip_DisposeImage(bmpHaystack)
;MsgBox, %difference%
}
}
SetTimer, update_stats, 250
return
Code: Select all
global stats := CriticalObject( {"value1":.7, "value2":90, "user_pause":1} )
global get_stats_thread := AhkThread( "GetStats.ahk", &stats "", true )