Code:
#SingleInstance, Force
#NoEnv
Settitlematchmode, 2
OnExit exitSub
time_x:=0.9093
time_y:=0.7200
t1:=0xdedbde
v:=25
once:=true
loop
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
FTP := ErrorLevel
Process, Priority, %FTP%, High
SetAffinity(FTP)
}
if once
{
id:=WinExist("Logged In ahk_class QWidget","","Full Tilt")
if id
{
t2:=PixelColorA(time_x,time_y,id)
once:=false
}
}
check(time_x,time_y)
sleep,1000
}
;-----------------------------------------------------------------------------------------------------
check(tx,ty)
{
global time_x,time_y,t1,t2,v
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(time_x,time_y,id)
if (CompareColors(t,t1,v)=false) & (CompareColors(t,t2,v)=false)
{
relFTClientPoint(id, tx, ty)
DllCall("SetCapture","Uint",id)
PostLeftDoubleClick(tx, ty, id, 0)
DllCall("ReleaseCapture")
}
}
}
return
;-----------------------------------------------------------------------------------------------------
relFTClientPoint(id, ByRef x, ByRef y)
{
SysGet, xbord, 32
SysGet, ybord, 33
SysGet, cap, 4
WinGetPos, , , w, h, ahk_id%id%
w := w - (2*xbord)
h := h - (2*ybord) - cap
Transform, X, Floor, W*x
Transform, Y, Floor, H*y
}
return
;-----------------------------------------------------------------------------------------------------
PostLeftDoubleClick(x, y, table_id, activate=1) {
; ### Max1mums: Send the double left click, then the mouse-up messages,
; some windows can get activated on the down left click so we will use
; left doubleclick instead, don't use on objects which have any functions
; binded to doubleclick unless you want to make doubleclick on them
; NOTE: This is relative to the top left of the client area and NOT the top left of the
; window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
WinActivate, ahk_id%table_id%
PostMessage, 0x203 , 0, ((y<<16)^x), , ahk_id%table_id% ; without 0x001 as lparam which is Lbutton down
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colxa,colya,id)
{
critical
SysGet, xbord, 32
SysGet, ybord, 33
SysGet, cap, 4
; Set up a DC
hdc_frame := DllCall( "GetDC", UInt, id )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame)
WinGetPos, X, Y, W, H, ahk_id %id%
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,w, Int,h)
DllCall( "gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer)
DllCall( "PrintWindow", "UInt" , id , "UInt" , hdc_buffer , "UInt" , 0 )
WinGetPos, X, Y, W, H, ahk_id %id%
;Dllcall("Invalidatergn", "uint", id, "uint",Dllcall("SetWindowRgn", "uint", id, "uint",DllCall("gdi32.dll", "uint", "setRectRgn", "uint", x, "uint", y, "uint", w, "uint", h), "uint", 1), "uint", 1)
WinGet,ctrls,ControlList,ahk_id %id%
Loop,Parse,ctrls,`n
{
class:=A_LoopField
ControlGet,ctrlid,Hwnd,,%class%,ahk_id %id%
ControlGet,visible,Visible,,,ahk_id %ctrlid%
If visible=1
{
; ControlGetPos,ctrlx,ctrly,ctrlw,ctrlh,%class%,ahk_id %id%
; Dllcall("Invalidatergn", "uint", ctrlid, "uint",Dllcall("SetWindowRgn", "uint", ctrlid, "uint",DllCall("gdi32.dll", "uint", "setRectRgn", "uint", ctrlx, "uint", ctrly, "uint", ctrlw, "uint", ctrlh), "uint", 1), "uint", 1)
; WinSet, Redraw, , ahk_id%ctrlid%
DllCall("RedrawWindow",uint,ctrlid,uint,0,uint,0,uint, 1|2|64|256|1024)
}
}
;WinSet, Redraw, , ahk_id%id%
DllCall("RedrawWindow",uint,id,uint,0,uint,0,uint, 1|2|64|256|1024)
w := w - (2*xbord)
h := h - (2*ybord) - cap
Transform, X, Floor, W*colxa
Transform, Y, Floor, H*colya
pixel_x := x + xbord
pixel_y := y + ybord + cap
pix := DllCall("GetPixel", UInt, hdc_buffer, Int, pixel_x , Int, pixel_y)
SetFormat, IntegerFast, hex
pix += 0 ; (Sets Var which previously contained 11 to be 0xb)
pix .= "" ; Necessary due to the "fast" mode.
SetFormat, IntegerFast, d
DllCall( "gdi32.dll\DeleteObject", "uint", hbm_buffer )
DllCall( "gdi32.dll\ReleaseDC" , "uint", hdc_frame )
DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_frame )
DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_buffer )
return pix
}
;-----------------------------------------------------------------------------------------------------
CompareColors(ByRef bgr1, ByRef bgr2, ByRef variation) {
c1 := bgr1 & 0xff
c2 := bgr2 & 0xff
if (abs(c1 - c2) > variation)
return false
c1 := (bgr1 >> 8) & 0xff
c2 := (bgr2 >> 8) & 0xff
if (abs(c1 - c2) > variation)
return false
c1 := (bgr1 >> 16) & 0xff
c2 := (bgr2 >> 16) & 0xff
if (abs(c1 - c2) > variation)
return false
return true
}
;-----------------------------------------------------------------------------------------------------
SetAffinity(pid, cpu=1)
{
h := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", pid)
DllCall("SetProcessAffinityMask", "UInt", h, "UInt", cpu)
DllCall("CloseHandle", "UInt" h)
return
}
;-----------------------------------------------------------------------------------------------------
exitSub:
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
FTP := ErrorLevel
Process, Priority, %FTP%, Normal
SetAffinity(FTP)
}
exitApp
;-----------------------------------------------------------------------------------------------------