This seems to be working OK:
Code:
Push(id, AutoBet=0)
{
; Lets set the box to a really big "all-in" value.
ControlSetText, Edit2, 10000000, ahk_id%id%
Sleep -1
Sleep 100
WinSet, Redraw,, ahk_id%id%
; Lets get the amount displayed on the raise button.
ControlGetText, text, AfxWnd90u20, ahk_id%id%
StringMid, amount, text, InStr(text, "Raise to ") + 9, InStr(text, " (") - (InStr(text, "Raise to ") + 8) - 1
amount := RemoveCommaInNumber(amount)
; Lets set the box to our actual maX value.
ControlSetText, Edit2, %amount%, ahk_id%id%
Sleep -1
Sleep 100
WinSet, Redraw,, ahk_id%id%
; Do we want to press the raise button too?
If(AutoBet)
{
; Lets see if we can see the "Raise X (All-In)" button.
ControlGet, v, Visible, , AfxWnd90u20, ahk_id%id%
if (v)
{
ControlGetText, text, AfxWnd90u20, ahk_id%id%
IfInString, text, All-In
{
ControlFocus, AfxWnd90u20, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd90u20, ahk_id%id%
return
}
}
; Lets see if we can see the "All-In" button.
ControlGet, v, Visible, , AfxWnd90u19, ahk_id%id%
if (v)
{
ControlGetText, text, AfxWnd90u19, ahk_id%id%
IfInString, text, All-In
{
ControlFocus, AfxWnd90u19, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd90u19, ahk_id%id%
return
}
}
}
}
Juk