Open Side Menu Go to the Top
Register
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

12-08-2010 , 01:49 AM
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)
}
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-08-2010 , 12:58 PM
This is great thanks
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-08-2010 , 09:33 PM
Yeah very cool, wish WA players could still play on stars
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 04:47 PM
Wow that's awesome, tyvm! Been looking for a working auto timebank for so long...

Auto sitback works perfectly, but unfortunately auto timebank does not. I tried replacing the modded button with the original one, and I also made sure the timebank_x and _y are correct, as follows:

I added MouseMove timebank_x, timebank_y right before PostStarsClick to verify the coordinates I put in, and the mouse is moved exactly over the timebank button - but it doesn't click it. I also tried the timebank coordinates the script came with since sitback works well despite of its coordinates being way off (didn't change these).

I am using a slightly modded Slick Base theme, and my OS is WinXP. Please let me know what other information you need, if any, in order to get the issue fixed.

TIA

Last edited by Baobhan-Sith; 12-09-2010 at 04:53 PM.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 05:58 PM
I'll take a look at slick base later on tonight - I figure if the sitback looks off to you but works, you're maybe getting the coordinates from a wrongly sized table? (it needs to be dafault size)
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 06:13 PM
Oh great, that did the trick, ty so much!
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 07:20 PM
_dave_ could this be modified to close the table when sitting out rather than sitting back in?
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 07:30 PM
easily I would think dangerous tho!
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 09:11 PM
How so? I usually play short sessions so the only time i sit out is to get on a new table or to end my session.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 09:19 PM
Well it's not really dangerous if that's the behaviour you want and expect. just like for example you are sat in a game with great position a big fish spewing money your way, and there is a waitlist - timing out would be instant loss of seat rather than just folding a hand.

If you change the coordinates of sitin_x and sitin_y to somewhere top-right of the table (where it will hit the "leave table" button), that'll do the job.

It unfortunately won't work if you use the "sit out next Big Blind" option, for some reason that produces a different message in the log file I'd have to identify (for auto sit-in but still being able to cleanly exit a table, it's quite handy to not flag these sit-outs. but for your purposes I think not)
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 09:33 PM
I generally use sit out next bb so I guess this wouldn't work anyways, Thanks tho.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-09-2010 , 09:41 PM
well not quite - all I'm saying there is changing the coordinates won't work - we need a different "trigger". I'll have a look later on and see if I can spot what message shows from "sitout next BB". I didn't look previously because I thought behaviour was reasonable as-is. If you want it to auto-close a table only after "sitout next BB", hopefully that is possible
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 12:24 AM
Ugh doesn't look too likely - the Stars table seems to post MSG_TABLE_FORCE_SITOUT after sitout next BB, but this also gets posted for a timeout. Difference is for the next BB option it is posted without the MSG_TABLE_SITTING_STATUS a moment later, which is what I'm looking for.

If you don't care how the sitout occurs it's easy to make it auto-close tables, if you only want that to happen after a "sitout next BB" selection that'll take more thinking

ETA: actually it posts "sitOutNextBigBlindCheck set to 1" to the log file, it is possible to keep a list of windows with that option set and auto-close only them if need be.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 12:26 PM
Awesome. I haven't gotten it working yet- my log files/hand histories are stored in a totally different directory than c:\program files\pokerstars- could that be the problem?
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 03:36 PM
The file PokerStars.log.0 is theonly one this script reads - if it isn't in Program Files (like you have PokerStars installed elsewhere, or maybe Win7 writes it elsewhere) line ~13 will need editing to the correct location.

Also if you uncomment (remove the ";") the first msgbox line, the script will alert you of any new lines in the log file, so simply starting pokerstars lobby will be enough to see if you have the right log file location.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 05:47 PM
Cool, got it working. Thanks _dave_
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 05:52 PM
Awesome was it something particular to your setup or something that affects all newer Windows systems that I should code for?
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-10-2010 , 08:34 PM
I may have changed where the hh files etc are stored from the default location at some point for HEM compatibility... I vaguely remember doing something like that... but in any case my comp is a few years old and running Vista, so I couldn't really speak for newer systems.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-11-2010 , 04:34 AM
Quote:
Originally Posted by _dave_
The file PokerStars.log.0 is theonly one this script reads - if it isn't in Program Files (like you have PokerStars installed elsewhere, or maybe Win7 writes it elsewhere) line ~13 will need editing to the correct location.

my log file is under users/myname/appdata/local/pokerstars

I dont know how to edit the line in the script to that location. Would really appreciate your help
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-11-2010 , 11:56 AM
Quote:
Originally Posted by Mikka
my log file is under users/myname/appdata/local/pokerstars

I dont know how to edit the line in the script to that location. Would really appreciate your help
Change this line:
Code:
_FILE := A_ProgramFiles . "\PokerStars\PokerStars.log.0"
to
Code:
_FILE := C . "\Users\Myname\AppData\Local\PokerStars\PokerStars.log.0"
(or whatever the appropriate path is, if the hard drive is D change the A to a D)

As _dave_ mentioned, you can uncomment the first msgbox line and that will tell you as soon as you open the lobby if the script is reading the log file by popping up some message boxes.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-11-2010 , 02:53 PM
works perfect.. thanks a lot to both of you
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
12-12-2010 , 03:03 AM
Quote:
Originally Posted by _dave_
Ugh doesn't look too likely - the Stars table seems to post MSG_TABLE_FORCE_SITOUT after sitout next BB, but this also gets posted for a timeout. Difference is for the next BB option it is posted without the MSG_TABLE_SITTING_STATUS a moment later, which is what I'm looking for.

If you don't care how the sitout occurs it's easy to make it auto-close tables, if you only want that to happen after a "sitout next BB" selection that'll take more thinking

ETA: actually it posts "sitOutNextBigBlindCheck set to 1" to the log file, it is possible to keep a list of windows with that option set and auto-close only them if need be.
For me it would be fine to auto close any table that i'm sitting out on, wouldn't necessarily have to be after next BB. Do you think it would be possible for you to make a version that does this? Would be very appreciated.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
01-21-2011 , 02:17 PM
Hey... the tool is working fine with me and Im like super excited because I finally have autotimebank clicking as TN wouldnt do this for me.
However could it be that your tool has some sort of a "never sit out" option running the whole time? could you tell me how to disable that?
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
02-19-2011 , 09:10 PM
I used tableninja's free 30daytrial this year and it ran out so I'm looking for a timeouthelper. I went to autohotkey.com and downloaded it, copied dave's code from post 1, saved it to notepad, called it timeouthelper.ahk and have run into problems getting it to work. I have the green H icon in the system tray. I've clicked run as administrator and/or run script and it still doesn't work. I'm using a laptop with windows 7. I am clueless when it comes to computer codes. The only thing I really enjoyed of tableninja was the autoclicking the timebank. Can anyone help me out?
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote
02-20-2011 , 12:16 AM
This is great! Thanks, _dave_.
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars Quote

      
m