View Single Post
  #7  
Old 01-20-2007, 12:31 PM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Re: AHK script for Party Poker SNGs - ALL-IN

Here's my first attempt (I haven't worked out how to reuse the coloured chat box code yet though):

<font class="small">Code:</font><hr /><pre>;---------------------------------------------------------
;----------------- Party SNG Helper v1.00 ----------------
;---------------------------------------------------------
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: jukofyork (reused code and thanks to: _dave_ &amp; Roland!)

; Features:
; =========
; 1. Push with/without autobet using middle mouse mutton.
; 2. Check or fold (ie: check if we can, else fold) using right mouse button.
; 3. Scroll wheel moved bet amount up/down in big bets.
; 4. Auto-confirm and check the buying box so all that will be needed is to click on an empty seat to join a SNG.
; 5. Auto-timebank clicker.
; 6. Auto-confirm the "Would you like a summary sent" box after being knocked out of a SNG.

#Persistent
#NoEnv

SendMode Input

SetTitleMatchMode 2

; Start the timers.
SetTimer, AutoClickTimeBank, 500
SetTimer, AutoBuyin, 500
SetTimer, AutoRequestSummary, 500

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

~RButton::
CheckFold(getid())
return

~MButton::
Push(getid(),1)
return

~WheelUp::
AlterAmount(getid(),"up")
return

~WheelDown::
AlterAmount(getid(),"down")
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoClickTimeBank:

checkfield = AfxWnd42u37 ; AfxWnd42u37 is timebank control
LobbyWindowTitle = Poker Lobby ; identify poker lobby substring
TableWindowTitle = Buy-in. ; identify pokertable substring

WinGet, lobbyID, ID, %LobbyWindowTitle%

WinGet, pid, PID, ahk_id%lobbyID%
WinGet, rlist, LIST, %TableWindowTitle% ahk_pid%pid%
Loop %rlist%
{
this_id := rlist%a_index%
If this_id != %lobbyID%
{
WinGetTitle, name, ahk_id%this_id%
ControlGet, result, Visible, , %checkfield%, ahk_id%this_id%
if (result)
{
ControlClick %checkfield%, ahk_id%this_id% ;Click timebank
}
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoBuyin:

IfWinExist, ahk_class #32770, Tournament Buy-in
{
WinGet, idList, List, ahk_class #32770, Tournament Buy-in
Loop, %idList%
{
winID := idList%a_index%
ControlSend, Button2, {SPACE}, ahk_id%winID%
Sleep, 40
ControlSend, Button5, {SPACE}, ahk_id%winID%
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoRequestSummary:

IfWinExist, ahk_class #32770, Would you like a tournament summary
{
WinGet, idList, List, ahk_class #32770, Would you like a tournament summary
Loop, %idList%
{
winID := idList%a_index%
ControlSend, Button1, {ENTER}, ahk_id%winID%
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

getid()
{
id := ""
MouseGetPos, , , id
return id
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

; This will set the edit box to the maximum amount.
Push(id, autobet=0)
{
pot := 10000000
ControlSetText, Edit3, %pot%, ahk_id%id%
Sleep -1
Sleep 50
WinSet, Redraw,, ahk_id%id%
If(autobet)
{
ControlClick, AfxWnd42u19, ahk_id%id%
}
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

; Clicks fold0in-turn button if sees it, else clicks check if sees it, else clicks fold.
CheckFold(id)
{
ControlGet, v, Visible, , AfxWnd42u22, ahk_id%id%
if (v)
{
ControlFocus, AfxWnd42u22, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u22, ahk_id%id%
}
else
{
; Lets see if we can see the check button.
ControlGet, v, Visible, , AfxWnd42u18, ahk_id%id%
if (v)
{
ControlGetText, text, AfxWnd42u18, ahk_id%id%
IfInString, text, Check
{
ControlFocus, AfxWnd42u18, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u18, ahk_id%id%
return ; Check found/clicked so Done.
}
}

; lets try for fold then.
ControlGet, v, Visible, , AfxWnd42u17, ahk_id%id%
if (v)
{
ControlFocus, AfxWnd42u17, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u17, ahk_id%id%
}
}

}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AlterAmount(id, dir="")
{
WinGetTitle, title, ahk_id%id%
amount := 0

; Get the current BB amount.
if (InStr(title, "NL") &lt;&gt; 0 AND InStr(title, "Buy-in") &lt;&gt; 0)
{
ControlGetText, text, Static6, ahk_id%id%
IfNotInString, text, Blinds-Antes
{
StringMid, bb, text, InStr(text, "/") + 1, InStr(text, ")") - InStr(text, "/") - 1
}
else
{
StringMid, bb, text, InStr(text, "/") + 1, InStr(text, "-","",InStr(text, "/")) - InStr(text, "/") - 1
}
;msgbox, %bb%
}

amount := bb

if (dir="down")
{
amount := amount - (2*amount)
}

ControlGetText, t, Edit3, ahk_id%id%
t := t + amount
if (t &lt; 0)
{
t := 0
}
t := Round(t, 0)
ControlSetText, Edit3, %t%, ahk_id%id%
;WinSet, Redraw,, ahk_id%id%

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;</pre><hr />

(use "Quote" from the forum, then copy/paste the script from inside of it - this way it doesn't lose all the indentation).

[ QUOTE ]
Hey that script sounds fantastic. You might want to add (from DeMoster):

1. Auto-log-in to PP
2. PP pop-up killer
3. Auto-click-OK if you press fold when you can check

[/ QUOTE ]
After giving it a bit of a test I'll look into it - I was using like 4 scripts earlier, so my plan is to get all the bits useful for just Party SNGs into one script.

[ QUOTE ]
1. Auto close table (when you get knocked out)

[/ QUOTE ]
I agree, but I'm not sure how you can detect when you are no longer at the table? Any ideas (perhaps some of the checkboxes in the bottom left vanaish, so I could try that)?

[ QUOTE ]
2. Auto choose filter (Speed - Holdem - NL - Registering)

[/ QUOTE ]
Yep definitly, sick of setting those everytime why the [censored] can't Party just remember them?

[ QUOTE ]
3. Auto rate Villain's range using PO/PT's database and auto call/fold/push [img]/images/graemlins/wink.gif[/img]

[/ QUOTE ]
I wish - there are some AHK snippets over at overcards which lets you access a PGSQL DB, but I think thats a bit beyond my AHK/DB skill... [img]/images/graemlins/smirk.gif[/img]

Juk [img]/images/graemlins/smile.gif[/img]
Reply With Quote