Code:
;
; AutoHotkey Version: 1.0.47.1
; Language: English
; Platform: Win9x/NT
; Author: Everlong@2p2 Code assembled from misc sources, thanks to _dave_, chris228
;
; Script Function: PokerStars SNG opener (for use with the tournament filter filtering a specific type of SNG/MTT-Sng)
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
;======================================================
SetTitleMatchMode, 2
Settimer, register, off
SetTimer, safeguard, off
RegSofar=0
OpenTables=0
Sysget,mon, MonitorworkArea
fivesec=0
two=0
ddlist4=0|
Loop 48
{
fivesec:=fivesec+5
ddlist:=ddlist . A_index . "|"
ddlist2:=ddlist2 . fivesec . "|"
}
Loop 100
{
two:=two+2
ddlist3:=ddlist3 . two . "|"
}
Loop 15
{
ddlist4:=ddlist4 . A_index . "|"
}
Gui, add, checkbox, x10 gToggleRegister
Gui, add, text, yp xp+30, Auto-register for filtered SNG:?
Gui, add, text, x10, Close lobbies with Ctrl+E!
Gui, add, text, yp+20 x10, Register every:
Gui, add, dropdownlist, w60 yp-5 xp+80 vInterval1, %ddlist2%
Gui, add, text, xp+70 yp+3, seconds
Gui, add, text,x10, No of SNG:s to keep open:
Gui, add, dropdownlist, w40 yp-5 xp+140 vKeepOpen , %ddlist%
Gui, add, text,x10, Limit total SNG:s to:
Gui, add, dropdownlist, w40 yp-5 xp+140 vTotalLimit , %ddlist3%
Gui, add, text,x10, Disable if no user input (min):
Gui, add, dropdownlist, w40 yp-5 xp+140 vguardtimer , %ddlist4%
Gui, add, text, x10 w200 vRegSofar, SNG:s registered so far:
Gui, add, text, x10 w200 vOpenTables, SNG:s currently open:
Gui, add, button, gGetgui, &Submit settings
Gui, Add, Button, vOn disabled x10 w56 h20 center, &Resume
Gui, Add, Button, vOff w56 h20 yp xp+56 center, &Pause
Gui, +toolwindow
gui, show, , Stars Filtered SNG Opener
WinGetPos, x, y, w, h, Stars Filtered SNG
x:=monright-w
y:=monbottom-h
Gui, show, x%x% y%y%, Stars Filtered SNG Opener
return
ToggleRegister:
if register!=1
{
register=1
}
else
{
register=0
}
return
getgui:
Gui, submit, nohide
interval:=interval1*1000
killtime:=guardtimer*60000
if !interval
interval=off
if guardtimer=0
{
SetTimer, safeguard, off
}
else
{
SetTimer, safeguard, 10000
}
WinGet, OpenTables, list, ahk_class PokerStarsTableFrameClass
if OpenTables is not number
OpenTables=0
GuiControl, , OpenTables, SNG:s currently open: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, show, noactivate, Stars Filtered SNG Opener
if register=1
{
gosub, register
SetTimer, Register, %interval%
}
return
Safeguard:
if (A_TimeIdlePhysical > killtime)
gosub, ButtonPause
return
GuiClose:
ExitApp
return
^e::
SetTitleMatchMode, 2
WinGet, lobbylist, list, Lobby, , PokerStars Lobby
Loop % lobbylist
{
i:=lobbylist%A_index%
WinClose, ahk_id%i%
}
return
;====================================================================
ButtonResume:
Gui, submit, nohide
GuiControl, 1:Disable, Resume
GuiControl, 1:Enable, Pause
Register=1
gosub, register
SetTimer, Register, %Interval%
return
ButtonPause:
GuiControl, 1:Disable, Pause
GuiControl, 1:Enable, Resume
Register=0
SetTimer, Register, off
return
;=====================================================================
Register:
critical
WinGet, OpenTables, list, ahk_class PokerStarsTableFrameClass
if OpenTables is not number
OpenTables=0
GuiControl, , OpenTables, SNG:s currently open: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, show, noactivate, Stars Filtered SNG Opener
if (RegSofar >= TotalLimit)
{
return
}
if (OpenTables >= TotalLimit)
{
return
}
if (OpenTables >= KeepOpen)
{
return
}
else
{
SettitleMatchmode, 2
WinGet, LobbyID, id, PokerStars Lobby
RegSNGexec(LobbyID)
}
return
RegSNGexec(id) {
global RegSofar
clickdirectioncount=0
direction=0
Loop 16
{
ControlGet, v, Visible, , PokerStarsButtonClass7, ahk_id%id%
if (v = 0)
if (clickdirectioncount<=5) {
if (direction=0) {
ControlSend, PokerStarsListClass5, {NumpadDown}, ahk_id%id%
} else {
ControlSend, PokerStarsListClass5, {NumpadUp}, ahk_id%id%
}
clickdirectioncount:=clickdirectioncount+1
} else {
if (direction=0) {
direction:=1
} else {
direction:=0
}
clickdirectioncount:=0
}
Sleep 1000
if (v = 1)
break
}
if ( v = 1 ) {
ControlClick, PokerStarsButtonClass7, ahk_id%id%
WinWait, Tournament Registration ahk_class #32770, , 10
{
WinGet, regid, id
ControlFocus, Button1, ahk_id%regid%
Sleep, -1
ControlSend, Button1, {SPACE}, ahk_id%regid%
sleep, 10
ControlFocus, Button2, ahk_id%regid%
Sleep, -1
ControlSend, Button2, {SPACE}, ahk_id%regid%
RegSofar++
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
gui, show, noactivate, Stars Filtered SNG Opener
}
WinWait, Tournament Registration ahk_class #32770, , 10
{
WinGet, regid, id
ControlGetText, ctext, Button1, ahk_id%regid%
if ( cText = "OK" ) {
ControlFocus, Button1, ahk_id%regid%
Sleep, -1
ControlSend, Button1, {SPACE}, ahk_id%regid%
}
}
}
}
;=========================================================
~^!Q::
ExitApp