By HalvSame. The corresponding thread on FTR is here,the corresponding thread on 2+2 is here.


PrimaAutoReloader

This script automatically reloads stacks to whatever amount hero bought in with. To automatically buy in for a set amount on all tables, edit the AutoBuyinAmount variable at the top of the script. Only tested properly at NL, but should work for FL as well.

Supported poker sites: Prima network

How To Use This Script

  1. Read instructions for AutoHotkey, and make sure you have the latest version installed.

  2. Read all instructions on this page.

  3. Download the script below to your computer (right-click, save as)

  4. Open the file in a text editor and edit settings.

  5. Run the script by double clicking the file.

A green AHK icon will show in the system tray as long as the script is running. Right-click this icon and choose "Exit" to exit the script. If the script seems to have gone wild, right click and choose "Reload This Script".

As always, test at microstakes first!

Changelog

* 1.0 August 16th 2007: Initial release

Download

PrimaAutoReloader-1.0.ahk

Script Code

AutoBuyinAmount = 0 ;amount to auto-buy in with. Multiples of the big blind for NL tables, multiples of the min buyin for FL. Set to 0 to buy in manually.

#persistent
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SysGet, border, 32
SysGet, caption, 4
caption := border + caption
tableSize := 0

If AutoBuyinAmount
  SetTimer, AutoBuyin, 50

SetTimer, CloseDialogs, 50

SetTimer, UpdateTables, 1500
return

UpdateTables:
winget, tables, list, ahk_class POPUP_INT_DLG_WINDOW
loop, %tables%
{
        id := tables%a_index%

        ;don't work on minimized windows
        WinGet, maximized, MinMax, ahk_id %id%
        if (maximized = -1)
                return

        tablesize := GetTableSize(id)

        amount := GetAmount(id)

        if amount > 0
        {
          Reload(id, amount)
        }
}
return

AutoBuyin:
WinWait, Sit Down at Table ahk_class #32770

max := min := available := wanted := 0

;available credits
ControlGetText, available, Static11, Sit Down at Table ahk_class #32770
StringReplace, available, available, `,
StringReplace, available, available, $

;minimum buyin
ControlGetText, min, Static4, Sit Down at Table ahk_class #32770
StringReplace, min, min, `,
StringReplace, min, min, $

ControlGet, vis, visible, , Static9, Sit Down at Table ahk_class #32770
if vis
{
        ;NL/PL table, get maximum buyin
        ControlGetText, max, Static9, Sit Down at Table ahk_class #32770
        StringReplace, max, max, `,
        StringReplace, max, max, $

        wanted := (max/100) * AutoBuyinAmount

        if (wanted > max)
           wanted := max
}

else
  ;fixed limit table
  wanted := min * AutoBuyinAmount

if (wanted < min)
   wanted := min        
if (wanted > available)
   wanted := available

ControlSetText, Edit1, %wanted%, Sit Down at Table ahk_class #32770
ControlClick, Button1, Sit Down at Table ahk_class #32770
return

CloseDialogs:
WinClose, Could not Bring chips to Table ahk_class #32770
WinClose, Chips Received ahk_class #32770
WinClose, Request Received ahk_class #32770
WinClose, Cannot Bring-in Chips ahk_class #32770
return

Reload(id, amount)
{
        global border, caption, tableSize, activate

        if (tableSize = 1)
        {
                PostLeftClick(80, 500, id, 0)
        }
        
        else if (tableSize = 2)
        {
                PostLeftClick(30, 330, id, 0)
        }

        WinWait, Bring More Chips to the Table ahk_class #32770,, 2
        ControlGetText, max, Static2, Bring More Chips to the Table ahk_class #32770,, 2
        StringReplace, max, max, `,
        StringReplace, max, max, $

        if(amount > max)
           amount := max

        ControlSetText, Edit1, %amount%, Bring More Chips to the Table ahk_class #32770
        ControlClick, Button1, Bring More Chips to the Table ahk_class #32770
}

GetAmount(id)
{
  lost = called for $,raised for $,bet for $,went all-in for $,posted small blind,posted big blind,posted to play
  gained = wins $, brought $,> Extra chips returned to
  sum := 0

  WinGetTitle, title, ahk_id%id%
  StringMid, hero, title, InStr(title, " - Blinds ")-1, , L
  StringTrimLeft, hero, hero, InStr(hero, " - ", true, 0)+2

  Loop, 10
  {
    ControlGetText, hh, RichEdit20W3, ahk_id%id%
    If hh
    {
      break
    }
    Sleep, 80
  }

  StringLeft, hh, hh, InStr(hh, "posted small blind", 1, 0) -1
  IfNotInString, hh, %hero%
        return

  Loop, Parse, hh, `n
  {
    IfInString, a_loopfield, %hero%
    {
          StringMid, amount, a_loopfield, InStr(a_loopfield, "$")+1

          IfInString, amount, %a_space%
                StringLeft, amount, amount, InStr(amount, " ")

          StringReplace, amount, amount, `)
          Stringreplace, amount, amount, `,,, All

        if a_loopfield contains %lost%
        {
          sum += amount
        }
        else if a_loopfield contains %gained%
        {
            sum -= amount
        }
        amount := 0
     }
  }
return Round(sum, 2)
}

;returns 1 if normal table, 2 if mini table, 0 if size can't be determined
GetTableSize(id)
{
        WinGetPos, , , w, , ahk_id %id%

        if (w >= 800)
                return 1

        else if (w >= 512)
                return 2

        else return 0
}

;Juks rocks
PostLeftClick(x, y, table_id, activate=1) {
; ### 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%
}

CategoryAutoHotKey

PrimaAutoReloader (last edited 2007-08-16 22:24:06 by ti541210a080-4527)