By Adde @ 2+2 forums (HstreamPoker at gmail dot com). The corresponding thread on 2+2 is here.


Chip Reloader

Reload chips on all Partypoker, Pokerstars, and Full Tilt tables with just one click.

The real use for this script is to make sure that you are bought in with maximum amount at NL and PL tables, but to some degree you can also use it at Limit. At Partypoker and Full Tilt Limit games you will rebuy the default amount (as given in the Buy-in dialog). At Pokerstars though, you will rebuy with all your bankroll on the first table, which makes the script quite useless for Pokerstars Limit games.

This script has Scriptpad support. Scriptpad is a tool where you can connect any number of scripts to a Scriptpad, a small pop-up window with buttons for all available commands in these scripts. You access the Scriptpad by clicking a hotkey, for instance the middle mouse button.

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. Save the script code below in a file named "ChipReloader.ahk"

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

  5. Run the script (double-click the file).

Default settings will reload Partypoker, Pokerstars, and Full Tilt tables when you press F9 on your keyboard. To reload only the active table press F10 on your keyboard.

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, choose "Reload this script".

Troubleshooting

If a dialog seems to get stuck, try to click it manually and see if the script continues as it should. If not, close all open dialogs and restart the script from the system tray.

Script Code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   Code begins here   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;------------------------------------------------------------------------------------------------
;       Chip Reloader v0.20
;------------------------------------------------------------------------------------------------
;       Date: 2007-01-21
;       AHK version: 1.0.44.12
;------------------------------------------------------------------------------------------------
;       Author(s): Adde @ 2+2 forums
;       Contact: HstreamPoker at gmail dot com
;       Contributions by APerfect10
;------------------------------------------------------------------------------------------------
;       Reload chips on all Partypoker and Pokerstars tables with just one click.
;       See web page for more details.
;
;       http://overcards.com/wiki/moin.cgi/ChipReloader
;
;       All rights reserved. Use at your own risk.
;------------------------------------------------------------------------------------------------

;________________________________________________________________________________________________
;
;       EDIT THESE SETTINGS
;________________________________________________________________________________________________

; Set what hotkeys should perform the reload. Leave blank to not use this function as a hotkey.
; List of available hotkeys: http://www.autohotkey.com/docs/KeyList.htm

cr_hotkey_reload_all = F9
cr_hotkey_reload_active = F10

; Set if Party and/or Stars reload should be performed (1) or not (0).

cr_reload_party = 0
cr_reload_stars = 1
cr_reload_fulltilt = 0

; Set if sound should be turned off during reload.

cr_sound_off = 0

; Set if mouse pointer should move back to original position

cr_reset_mouse_pointer = 1


;________________________________________________________________________________________________
;
;       DO NOT EDIT BELOW HERE
;________________________________________________________________________________________________

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   auto-execute   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#NoEnv
#SingleInstance Ignore
#Persistent

cr_scriptpad_command_header = Chip Reloader
cr_scriptpad_command_name = Reload All Tables
cr_scriptpad_command_label = CR_ReloadAll_Label
cr_scriptpad_command_enabled = 1

ahk_version = 1.0.44.07
if A_AhkVersion < %ahk_version%
{
        msgbox, 4, , This script needs AutoHotkey version %ahk_version% or newer (you are using version %A_AhkVersion%). Script will exit`n`nGo to web page and download new version now?
        IfMsgBox, Yes
                Run, http://www.autohotkey.com
        ExitApp
} 

cr_web_page = http://overcards.com/wiki/moin.cgi/PokerReloader

Hotkey, %cr_hotkey_reload_all%, CR_ReloadAll_Label, UseErrorLevel 
Hotkey, %cr_hotkey_reload_active%, CR_ReloadActive_Label, UseErrorLevel 

goto CR_Scriptpad_End   

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   labels   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CR_ReloadAll_Label:

        CR_ReloadAll()

        return

CR_ReloadActive_Label:



        CR_ReloadActiveTable(1)

        return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


CR_ToggleVolume(OnOff)
{
        static af_vol
        if (OnOff = "on")
                SoundSetWaveVolume, %af_vol%, 1
        else if (OnOff = "off")
        {
                SoundGetWaveVolume, af_vol, 1
                SoundSetWaveVolume, -100, 1
        }
} 

CR_ReloadAll()
{
        global
        if (cr_reset_mouse_pointer)
                        AF_SaveMousePosition()
        if (cr_sound_off)
                        CR_ToggleVolume("off")
        
        if (cr_reload_party)



                CR_ReloadParty(1)


        if (cr_reload_stars)
                CR_ReloadStars()
        if( cr_reload_fulltilt )
                CR_ReloadFullTilt()
        
        if (cr_sound_off)
                CR_ToggleVolume("on")
        else
                SoundBeep, , 50
        if (cr_reset_mouse_pointer)
                        AF_RestoreMousePosition()
}

CR_ReloadParty(1)

{       
    SetTitleMatchMode, 2
        WinGet, idList, list, Good Luck ahk_class #32770,  , PartyPoker.com:
        Loop, %idList%
        {
                winID := idList%a_index%
                CR_ReloadPartyTable(winID)
        }
}



CR_ReloadActiveTable(1)


{
global cr_reset_mouse_pointer
        if (cr_reset_mouse_pointer)
                        AF_SaveMousePosition()
        WinGetActiveTitle, title
        WinGet, winID, ID, %title%
        WinGetClass, class, ahk_id %winID%
        if (class = "#32770")
                CR_ReloadPartyTable(winID)
        If( class = "FTC_TableViewFull")
                CR_ReloadFullTiltTable(winID)
        ps_class = Afx:400000:b:
        IfInString, class, %ps_class%
                CR_ReloadStarsTable(winID)  
        if (cr_reset_mouse_pointer)
                        AF_RestoreMousePosition()    

}

CR_ReloadPartyTable(winID)
{       
        ControlGet, result, Visible, , AfxWnd42u1, ahk_id %winID%
        if (not result)
                return
        ControlGet, result, Visible, , Button5, ahk_id %winID%
        if (not result)
                return
        ControlClick, AfxWnd42u1, ahk_id%winID%  
        sleep, 300      
        IfWinExist, PartyPoker.com ahk_class #32770, You can have maximum       
        {       
                WinClose, PartyPoker.com ahk_class #32770, You can have maximum 
                return  
        }

        WinWait, Buy-In ahk_class #32770, , 2
        if (ErrorLevel <> 0)
                return
        WinActivate, Buy-In ahk_class #32770
        ControlFocus, Button1, Buy-In ahk_class #32770
        SendInput {SPACE}       
        sleep 300
        
        IfWinExist, PartyPoker.com ahk_class #32770, Please enter an amount
        {
                WinClose, PartyPoker.com ahk_class #32770, Please enter an amount
                WinClose, Buy-In ahk_class #32770
                return
        }
        IfWinExist, PartyPoker.com ahk_class #32770, You can bring a maximum
        {
                WinClose, PartyPoker.com ahk_class #32770, You can bring a maximum
                WinClose, Buy-In ahk_class #32770
                return
        }
        IfWinExist, PartyPoker.com ahk_class #32770, Additional chips
        {
                WinClose, PartyPoker.com ahk_class #32770, Additional chips
                WinClose, Buy-In ahk_class #32770
                return
        }
        IfWinExist, PartyPoker.com ahk_class #32770, You do not have sufficient funds
        {
                WinClose, PartyPoker.com ahk_class #32770, You do not have sufficient funds
                WinClose, Buy-In ahk_class #32770
                return
        }

        WinWaitClose, Buy-In ahk_class #32770, , 2
        Loop  
        {
                IfWinNotExist, Buy-In ahk_class #32770
                        return
                WinActivate, Buy-In ahk_class #32770
                ControlFocus, Button1, Buy-In ahk_class #32770
                SendInput {SPACE}
                WinWaitClose, Buy-In ahk_class #32770, , 1
        }
        
        WinWait, PartyPoker.com, Additional chips, 1
        if (ErrorLevel <> 0)
                return
        ControlFocus, Button1, PartyPoker.com, Additional chips
        SendInput {SPACE}
        WinWaitClose, PartyPoker.com, Additional chips, 2
        Loop  
        {
                IfWinNotExist, PartyPoker.com, Additional chips
                        return           
                ControlFocus, Button1, PartyPoker.com, Additional chips
                SendInput {SPACE}
                WinWaitClose, PartyPoker.com, Additional chips, 2
        }
}

CR_ReloadStars()
{       
    SetTitleMatchMode, 2
    WinGet, idList, list, Logged In as, , PokerStars Lobby
        Loop, %idList%
        {
                winID := idList%a_index%
                CR_ReloadStarsTable(winID)
        }
}

CR_ReloadStarsTable(winID)
{       
        WinGetPos, x, y, w, h, ahk_id%winID%
        px := Floor((w/800) * 400)
        py := Floor((h/573) * 80)
        WinActivate, ahk_id %winID%             
        CR_PostLeftClick(px, py, winID)
                
        SetTitleMatchMode, 2
        WinWait, Options, Add More Chips, 3
        WinGet, winID, ID, Options, Add More Chips              
        if (winID = "")
                return
        if CR_ButtonDisabled(winID,"Add More Chips")                    
                return
        ControlFocus, Add More Chips, ahk_id %winID%
        SendInput {SPACE}
                        
        stopTime := A_Now
        EnvAdd, stopTime, 5, seconds        
        loop
        {
                IfWinExist, PokerStars, Your rebuy cannot be processed
                {
                        WinClose, PokerStars, Your rebuy cannot be processed
                        return
                }
                IfWinExist, Buy-in
                        break
                if (A_Now > stopTime)
                        return                  
        }
        
        WinGet, winID, ID, Buy-in
        if (winID = "")
                return
                
        if CR_ButtonDisabled(winID, "Button1")                  
                return
        ControlFocus, Button1, ahk_id %winID%
        SendInput {SPACE}       
        sleep, 100
        
        if CR_ButtonDisabled(winID, "Button3")                  
                return  
        ControlFocus, Button3, ahk_id %winID%
        SendInput {SPACE}
        sleep, 300              
        
        IfWinExist, PokerStars, Your stack will be updated when the current hand is finished
                WinClose, PokerStars, Your stack will be updated when the current hand is finished
        IfWinExist, PokerStars, You are not able to rebuy
                WinClose, PokerStars, You are not able to rebuy
        IfWinExist, Buy-in, The minimum amount of chips required
                WinClose, Buy-in, The minimum amount of chips required
}

CR_ReloadFullTilt()
{
        SetTitleMatchMode, 2
        WinGet, idList, list,  Logged In As ahk_class FTC_TableViewFull
        Loop, %idList%
        {
                winID := idList%a_index%
                CR_ReloadFullTiltTable(winID)
        }
}

CR_ReloadFullTiltTable(winID)
{
        ControlGet, result, Visible, , FTCButton29, ahk_id %winID%
        If( !result )
                return

        Control, Enable, , FTCButton1, ahk_id%winID%
        Control, Check, , FTCButton1, ahk_id%winID%

        WinWait, Get Chips,,2
        If( ErrorLevel )
                return

        WinGet, chipID, ID, Get Chips
        WinGetText, winTxt, ahk_id%chipID%
        WinActivate, ahk_id%chipID%

        ControlGet, enabled, Enabled, ,BUtton2, ahk_id%chipID%
        If( enabled )
        {
                needle = No Limit Hold'em
                if( InStr(winTxt, needle) ){
                        Control, Check, , Button2, ahk_id%chipID%
                }else{
                        Control, Check, , Button1, ahk_id%chipID%
                }
        }
        Send {ENTER}
}

CR_ButtonDisabled(winID, buttonName)
{
        ControlGet, result, Enabled, , %buttonName%, ahk_id %winID%
        if (result = false)
                WinClose, ahk_id %winID%
        return (result=false)
}

CR_PostLeftClick(x, y, table_id)
{  ; ### 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!!!).   
   Postmessage 0x201, 0x0001, ((y*65536)+x), , ahk_id%table_id%
   Postmessage 0x202, 0, ((y*65536)+x), , ahk_id%table_id%
}

AF_SaveMousePosition()
{
        global AF_mouse_pos_x, AF_mouse_pos_y
        CoordMode, Mouse, Screen
        MouseGetPos, AF_mouse_pos_x, AF_mouse_pos_y
        CoordMode, Mouse, Relative
}

AF_RestoreMousePosition()
{
        global AF_mouse_pos_x, AF_mouse_pos_y
        CoordMode, Mouse, Screen
        MouseMove, AF_mouse_pos_x, AF_mouse_pos_y, 0
        CoordMode, Mouse, Relative
}  

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   scriptpad   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CR_Scriptpad_End:
        ; Do nothing. This is needed to work with Scriptpad.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   Code ends here   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

CategoryAutoHotKey

ChipReloader (last edited 2007-11-04 19:16:06 by MogobuTheFool)