I made this the other day since I dunno of a similarly working TimeOut Helper. Added Auto-Timebank since I may as well since it's a sensible way to do it.
It reads the ps log file so timebank works for PF All-Ins (UrgentTable does not). Also no pixel scanning so should work on any theme. x/y coordinates may need edited for themes other than Hyper Simple / Classic, not sure. Works for tournaments and cash games.
I've not tested on anything but my own machine so there may be problems, try at your own risk and so on.
You can test if it'll sit you back in by joining a cash table and "sit out next hand" (don't have to have posted a blind yet).
It seems not to sit you back in if you choose "sit out next big blind" which is handy
Code:
#NoEnv
#Persistent
SetBatchLines -1
CheckTime := 500 ; Check every n MilliSeconds
sitin_x := 532
sitin_y := 468
timebank_x := 520
timebank_y := 460
_FILE := A_ProgramFiles . "\PokerStars\PokerStars.log.0"
;_FILE := "E:\sitout.txt"
SysGet, border, 32
SysGet, caption, 4
SetTimer, FILE_CHECK, %CheckTime%
return
FILE_CHECK:
If (_NEWLINES := CheckFile(_FILE))
{
;msgbox, %_NEWLINES%
Loop, Parse, _NEWLINES, `n
{
if(regExMatch(a_loopfield, "MSG_TABLE_SITTING_STATUS\s(\w{8})\s1", m))
{
;msgbox, %m1%
PostStarsClick(sitin_x, sitin_y, ("0x" . m1))
}
else if (regExMatch(a_loopfield, "MSG_TABLE_TIMEBANK\s(\w{8})\stime=", m))
{
;msgbox, %m1%
PostStarsClick(timebank_x, timebank_y, ("0x" . m1))
}
}
;msgbox, %m1%
}
Return
CheckFile(File) {
; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
Static CF := "" ; Current File
Static FP := 0 ; File Pointer
Static OPEN_EXISTING := 3
Static GENERIC_READ := 0x80000000
Static FILE_SHARE_READ := 1
Static FILE_SHARE_WRITE := 2
Static FILE_SHARE_DELETE := 4
Static FILE_BEGIN := 0
BatchLines := A_BatchLines
SetBatchLines, -1
If (File != CF) {
CF := File
FP := 0
}
hFile := DllCall("CreateFile"
, "Str", File
, "Uint", GENERIC_READ
, "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
, "Uint", 0
, "Uint", OPEN_EXISTING
, "Uint", 0
, "Uint", 0)
If (!hFile) {
CF := ""
FP := 0
SetBatchLines, %BatchLines%
Return False
}
DllCall("GetFileSizeEx"
, "Uint", hFile
, "Int64P", nSize)
If (FP = 0 Or nSize <= FP) {
FP := nSize
SetBatchLines, %BatchLines%
DllCall("CloseHandle", "Uint", hFile) ; close file
Return False
}
DllCall("SetFilePointerEx"
, "Uint", hFile
, "Int64", FP
, "Uint", 0
, "Uint", FILE_BEGIN)
VarSetCapacity(Tail, Length := nSize - FP, 0)
DllCall("ReadFile"
, "Uint", hFile
, "Str", Tail
, "Uint", Length
, "UintP", Length
, "Uint", 0)
DllCall("CloseHandle", "Uint", hFile)
VarSetCapacity(Tail, -1)
FP := nSize
SetBatchLines, %BatchLines%
Return Tail
}
relStarsClientPoint(id, ByRef x, ByRef y)
{
global border
global caption
rw := 792
rh := 546
WinGetPos, , , w, h, ahk_id%id%
w := w - (2*border)
h := h - (2*border) - caption
x := Floor( (x / rw ) * w )
y := Floor( (y / rh) * h )
}
;Juks rocks
PostLeftClick(x, y, table_id, activate=0) {
; ### JUK: Send the down left click, then the mouse-up messages.
; 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, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}
PostStarsClick(x, y, id)
{
relStarsClientPoint(id, x, y)
PostLeftClick(x, y, id)
}