Open Side Menu Go to the Top
Register
AHK script:Stars Filtered SNG Opener AHK script:Stars Filtered SNG Opener

07-15-2019 , 11:45 AM
Hi,

I have been using this tool for a long time now and it is really great
Unfortunately it stopped working for me. It is just registering the game on top of the list but it does not scroll down through the complete list of games to register them all. I have "times to scroll down" on 10.

Does anyone know how to solve this? I have been trying for hours now but I am not really an expert in that matter. I tried the newest update on this page but it is still not working.
AHK script:Stars Filtered SNG Opener Quote
07-16-2019 , 12:18 AM
Same here, this fantastic tool used to work for me for years until recently when it stopped scrolling down.
AHK script:Stars Filtered SNG Opener Quote
07-24-2019 , 09:15 PM
Same as well!
Please someone save us!
AHK script:Stars Filtered SNG Opener Quote
07-26-2019 , 12:56 PM
+1 same here, didn't scrolling down
AHK script:Stars Filtered SNG Opener Quote
07-31-2019 , 05:14 AM
It is about changing table list control class in PS7list1= and PS7list2=, this version should work fine:

Code:
; Author:         Everlong@2p2 Code assembled from misc sources, thanks to _dave_, chris228, finnisher
; v.4.01e
; added: PS 7 support
; 4.0x version fixed by Max1mums 
#NoEnv
#SingleInstance, Force
#Persistent
#MaxMem 600
SendMode Input
SetWorkingDir %A_ScriptDir%
setwindelay,-1
setcontroldelay,-1
SetBatchLines, -1
SetTitleMatchMode, 2
SetTimer, register, off
SetTimer, safeguard, off
SetTimer, numcheck, 75
StringTrimRight, thisahk, A_ScriptName, 4
onexit,exitsub
IniRead, pspath, %thisahk%.ini, Settings, path


PS7list1=PokerStarsListClass15
PS7list2=PokerStarsListClass16
defaultregbutton:="PokerStarsButtonClass10"
customregbutton:="PokerStarsButtonClass10"


;;;;;;;;;;;SET YOUR pokerstars.log.0 file path below;;;;;;;;;;;;;;;
;;;;;;;;;;;eg: logfile:="c:\Program Files\PokerStars\pokerstars.log.0"
logfile:= pspath . "pokerstars.log.0" ;<-


IfNotExist,%logfile%
{
Loop, %A_ProgramFiles%\* , 2
{
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
IfNotExist,%logfile%
Loop, %A_AppData%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
IfNotExist,%logfile%
{
StringReplace,logfile,A_AppData,Roaming,Local
Loop, %logfile%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
}
IfNotExist,%logfile%
{
logfile:= pspath . "pokerstars.log.0"
IfNotExist,%logfile%
msgbox, PokerStars.log.0 file path is probably incorrect, recheck the configuration
}
IniRead, Targetnum, %thisahk%.ini, Settings, Targetnum
if Targetnum is not number
Targetnum:=0
;==============================================================
RegSofar=0
OpenTables=0
trows=17
SysGet,mon, MonitorworkArea
fivesec=0
ft:=0
two=0
ddlist4=Off|
ddlist5=Off|
ddlist6=Off|
ddlist7=Off|
LobbyList=Default|Black|
ddlist2:=ddlist2 . 1 . "|"
ddlist2:=ddlist2 . 2 . "|"
Loop 100
{
two:=two+2
ddlist3:=ddlist3 . two . "|"
ddlist:=ddlist . A_index . "|"
If (A_index<51)
{
fivesec:=fivesec+5
ddlist2:=ddlist2 . fivesec . "|"
ddlist6:=ddlist6 . fivesec . "|"
If (A_index<22)
{
ddlist7:=ddlist7 . A_Index . "|"
If (A_index<16)
{
ddlist4:=ddlist4 . A_index . "|"
}
}
}
else
{
ft:=ft+15
ddlist5:=ddlist5 . ft . "|"
}
}
ddlist3:=ddlist3 . 9999 . "|"
Gosub, deletelog
Gosub, BuildGui
Return
;==============================================================
;==============================================================

BuildGui:
Gui, color, white
Gui, font, cOlive
Gui, add, tab, h340 w240, General|Advanced Settings
Gui, add, text, , Auto-register
Gui, add, Checkbox, yp xp+80 Check3 Checked-1 vRegister
Gui, add, text, yp xp+30, Reg. next if full?
Gui, add, Checkbox, yp xp+80 VAutoifFull


Gui, add, text,xp-190 yp+30 , Register every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vInterval1, %ddlist2%
Gui, add, text, xp-140 yp+30, No of SNG:s to keep open:
Gui, add, DropDownList, w50 yp-5 xp+140 vKeepOpen , %ddlist%
Gui, add, text,xp-140 yp+30, Limit total SNG:s to:
Gui, add, DropDownList, w50 yp-5 xp+140 vTotalLimit , %ddlist3%
Gui, add, text,xp-140 yp+30, Limit total time to (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vLimitTime , %ddlist5%

Gui, add, text, xp-140 yp+30 cred vcdown w200
Gui, add, text, xp  yp+30 w200 vRegSofar, SNG:s registered so far:
Gui, add, text,  w200 vOpenTables, Tables open/waiting:
Gui, add, text, w200 cRed vStatus, Status: Idle
Gui, add, Button, w68 ggetgui, &Submit+Run
Gui, add, text, xp+72 yp+5, (Autosaves your settings)
Gui, Add, Button, Disabled xp-72 yp+20 w48 h20 Center , &Resume
Gui, Add, Button, Disabled  w45 h20 yp xp+48 Center , &Pause
Gui, Add, Button, w80 h20 yp xp+45 Center globbyrestore, &Lobby restore
Gui, Add, Button, w40 h20 yp xp+80 Center greset, Reset
Gui, tab, 2

Gui, add, Text, x25 y65 , Lobby Theme:
Gui, add, DropDownList, w65 yp-5 xp+140 vLobby, %LobbyList%
Gui, add, text,xp-140 yp+30 , Close lobbies every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vCloseInterv, %ddlist6%
Gui, add, text, xp-140 yp+18 , (manually Close with ctrl+e)
Gui, add, text, yp+30, Disable if no user Input (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vGuardtimer Choose1 , %ddlist4%
Gui, add, text, xp-140 yp+30 ,Batch-register?
Gui, add, Checkbox,yp xp+140 vBatchReg
Gui, add, text, yp+20 xp-140 ,SetReg* mode?
Gui, add, Checkbox,yp xp+140 vSetReg
Gui, add, text, yp+20 xp-140 ,Minimize lobby?
Gui, add, Checkbox,yp xp+140 vMinlob
Gui, add, Text, xp-140 yp+30, Times to scroll down:
Gui, add, DropDownList, w50 yp-5 xp+140 vscrldwn, %ddlist7%
Gui, add, Text, xp-140 yp+25, Always start at top of lobby?
Gui, add, Checkbox, yp xp+140 vTopReturn
Gui, show, w256, %thisahk%
WinGetPos, x, y, w, h, SFSO
;x:=monRight-w
;y:=monBottom-h
x:=monLeft
y:=monTop
Gosub, GetIni
Gui, show, x%x% y%y%, %thisahk%
Return

reset:
RegSofar:=0
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, Submit, NoHide
return

deletelog:
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
return

getgui:
GuiControl,, Register, -1
Register = 1
Gui, Submit, NoHide
displayedTime=
If (lobby="Default")
{
regButton:=defaultregbutton
}
Else If (lobby="Black" or lobby="Custom*")
{
regButton:=customregbutton
}
Gosub, MakeIni
PausedTime:=LimitTime
Gosub, TimeLimit
interval:=interval1*1000
If interval is not Number
interval=off
If guardtimer is not Number
{
SetTimer, safeguard, off
}
Else
{
killtime:=guardtimer*60000
SetTimer, safeguard, 1000
}
if CloseInterv is not number
SetTimer, NukeLobbies, off
else
{
lobclose:=CloseInterv*1000
SetTimer, NukeLobbies, %lobclose%
}
register=1
sleep,-1
Gosub, ButtonResume
Return

Safeguard:
If (A_TimeIdle > killtime)
{
Gosub, ButtonPause
GuiControl, , cdown, Stopped  due to inactivity!!! %displayedTime%
}
Return

TimeLimit:
If LimitTime is Number
{
allowedMinutes := LimitTime
endTime := A_Now
endTime += %allowedMinutes%, Minutes
SetTimer, CountDown, 1000
}
Else
{
SetTimer, CountDown, off
sleep,-1
GuiControl, , cdown, Time Limit off
}
Return

Countdown:
remainingTime := endTime
EnvSub remainingTime, %A_Now%, Seconds
m := remainingTime // 60
s := Mod(remainingTime, 60)
displayedTime := Format3Digits(m) ":" Format2Digits(s)
GuiControl, , cdown, Running another (mm:ss): %displayedTime%
If (A_now > endTime)
{
SetTimer, Countdown, off
Gosub, ButtonPause
GuiControl, , cdown, Time Limit reached.
}
Return

GuiClose:
Gui, Submit
Gosub, MakeIni
ExitApp
Return

ButtonResume:
Gui, Submit, NoHide
GuiControl, Disable, &Resume
GuiControl, Enable, &Pause
if LimitTime is Number
If PausedTime is Number
LimitTime:=PausedTime
Gosub, TimeLimit
GuiControl, , Register, -1
Register:=1
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament
wingettitle,lobbytitle,ahk_id%LobbyID%
if !instr(lobbytitle,"Logged In")>0
{
WinGet,ctrls,ControlList,ahk_id%LobbyID%
Loop,Parse,ctrls,`n
{
 controlgettext,text,%A_LoopField%,ahk_id%LobbyID%
 ;if text=Register
 if text=Play Now
 {
 ControlGet,v,Visible,,%A_LoopField%,ahk_id%LobbyID%
 if v
 regButton:=A_LoopField
 }
}
}
settimer, AutoReg,37
OpenTables:=0
tables=
OpenTables:=CountTourneys(1)
Gosub,Register
SetTimer, Register, %Interval%
sleep,-1
Return

ButtonPause:
Critical
Gui, Submit, NoHide
if LimitTime is Number
PausedTime:=remainingTime/60
Register:=0
settimer, AutoReg,off
SetTimer, Countdown, off
SetTimer, Register, off
GuiControl, Disable, Pause
GuiControl, Enable, Resume
GuiControl, , Register, 0
GuiControl, , cdown, Manually Paused %displayedTime%
GuiControl, , Status, Status: Waiting ;TEST
Return

Register:
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament
If !LobbyID
{
Gosub, ButtonPause
GuiControl,, Status, Status: PokerStars Lobby not found
Gui, show, NoActivate, %thisahk%
Return
}
If (TopReturn=1)
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%lobbyid%
}
WinGet, PhysicalTables, list,Table ahk_class PokerStarsTableFrameClass
If PhysicalTables is not Number
PhysicalTables:=0
If (PhysicalTables >= KeepOpen)
{
GuiControl,, Status, Set Full waiting
Return
}
OpenTables:=CountTourneys()
If OpenTables is not Number
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
If (RegSofar >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables>=KeepOpen)
{
GuiControl, , OpenTables, Tables open/waiting: %OpenTables% (Set full)
GuiControl, , Status, Status: Waiting ;TEST
Return
}
Else
{
If (BatchReg=1)
{
Times:= KeepOpen - OpenTables
RegSNGexec(LobbyID, Times, scrldwn)
}
Else
{
RegSNGexec(LobbyID, 1, scrldwn)
}
}
Return

MakeIni:
IniWrite, %AutoIfFull%, %thisahk%.ini, Settings, AutoIfFull
IniWrite, %TopReturn%, %thisahk%.ini, Settings, TopReturn
IniWrite, %scrldwn%, %thisahk%.ini, Settings, scrldwn
IniWrite, %Lobby%, %thisahk%.ini, Settings, Lobby
IniWrite, %BatchReg%, %thisahk%.ini, Settings, BatchReg
IniWrite, %Setreg%, %thisahk%.ini, Settings, SetReg
IniWrite, %Minlob%, %thisahk%.ini, Settings, MinLob
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %CloseInterv%, %thisahk%.ini, Settings, CloseInterv
IniWrite, %KeepOpen%, %thisahk%.ini, Settings, KeepOpen
IniWrite, %TotalLimit%, %thisahk%.ini, Settings, TotalLimit
IniWrite, %GuardTimer%, %thisahk%.ini, Settings, GuardTimer
IniWrite, %LimitTime%, %thisahk%.ini, Settings, LimitTime
Return

GetIni:
IfExist, %thisahk%.ini
{
IniRead, AutoIfFull, %thisahk%.ini, Settings, AutoIfFull
IniRead, TopReturn, %thisahk%.ini, Settings, TopReturn,0
IniRead, scrldwn, %thisahk%.ini, Settings, scrldwn
IniRead, Lobby, %thisahk%.ini, Settings, Lobby
IniRead, BatchReg, %thisahk%.ini, Settings, BatchReg
IniRead, SetReg, %thisahk%.ini, Settings, SetReg, 1
IniRead, MinLob, %thisahk%.ini, Settings, MinLob, 0
IniRead, Interval1, %thisahk%.ini, Settings, Interval1
IniRead, CloseInterv, %thisahk%.ini, Settings, CloseInterv
IniRead, KeepOpen, %thisahk%.ini, Settings, KeepOpen
IniRead, TotalLimit, %thisahk%.ini, Settings, TotalLimit
IniRead, GuardTimer, %thisahk%.ini, Settings, GuardTimer, Off
IniRead, LimitTime, %thisahk%.ini, Settings, LimitTime, Off
GuiControl, , AutoIfFull, %AutoIfFull%
StringReplace, ddlist7, ddlist7, %scrldwn%, %scrldwn%|
GuiControl, , scrldwn, |%ddlist7%
StringReplace, LobbyList, LobbyList, %Lobby%, %Lobby%|
GuiControl, , Lobby, |%LobbyList%
GuiControl, , BatchReg, %BatchReg%
GuiControl, , SetReg, %SetReg%
GuiControl, , MinLob, %MinLob%
GuiControl, , TopReturn, %TopReturn%
StringReplace, ddlist2, ddlist2, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist2%
StringReplace, ddlist6, ddlist6, %CloseInterv%, %CloseInterv%|
GuiControl, , CloseInterv, |%ddlist6%
StringReplace, ddlist, ddlist, %KeepOpen%, %KeepOpen%|
GuiControl, , KeepOpen, |%ddlist%
StringReplace, ddlist3, ddlist3, %TotalLimit%, %TotalLimit%|,
GuiControl, , TotalLimit, |%ddlist3%
StringReplace, ddlist4, ddlist4, %GuardTimer%, %GuardTimer%|
GuiControl, , GuardTimer, |%ddlist4%
StringReplace, ddlist5, ddlist5, %LimitTime%, %LimitTime%|
GuiControl, , LimitTime, |%ddlist5%
}
Return

#e::
gosub,NukeLobbies
Return

NukeLobbies:
SetTitleMatchMode, 2
GroupAdd, TLobbies, Lobby ahk_class PokerStarsTableFrameClass,,, PokerStars Lobby
GroupClose, TLobbies, A
Return

#H::
WinHide, %thisahk%
return

#S::
WinShow, %thisahk%
return


Format2Digits(_val) {
_val :=Round(_val) + 100
StringRight _val, _val, 2
Return _val
}

Format3Digits(_val) {
_val :=Round(_val) + 1000
StringRight _val, _val, 3
StringTrimRight, FirstZ, _val, 2
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
StringTrimRight, FirstZ, _val, 1
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
Return _val
}

LobbyRestore:
WinGet, lobbyid, id, PokerStars Lobby
WinShow, ahk_id%lobbyid%
WinMove, ahk_id%lobbyid%,,0,0
return

RegSNGexec(id, times, scrldwn) {
global RegSofar
global Register
global OpenTables
global KeepOpen
global TotalLimit
global RegButton
global AutoIfFull
global list,lobbytitle,lobbyid,PS7list1,PS7list2

Loop %times%
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%id%
If (OpenTables >= KeepOpen)
Exit
If (OpenTables >= TotalLimit)
Exit
ClickdirectionCount=0
direction=0
GuiControl, , Status, Status: Registering ;TEST
Loop 16
{
If (Register=0)
{
GuiControl, , Status, Status: Idle ;TEST
Exit
}
ControlGet, v, Visible, , %regButton%, ahk_id%id%
If (v = 0)
If (scrldwn!="Off")
{
If (ClickdirectionCount<scrldwn) {
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
If (direction=0) {
ControlSend, %list%, {Blind}{NumpadDown}, ahk_id%id%
} Else {
ControlSend, %list%, {Blind}{NumpadUp}, ahk_id%id%
}
ClickdirectionCount:=ClickdirectionCount+1
} Else {
If (direction=0) {
direction:=1
} Else {
direction:=0
}
ClickdirectionCount:=0
}
Sleep,1000
}
If ( v = 1 ) {
wingetclass,class,A
SetTitleMatchMode, 2
ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
controlget,vis,visible,,%autobtn%,ahk_id%regid%
if vis
{
 If (AutoIfFull = 1)
 {
 Control,Check,,%autobtn%, ahk_id%regid%
 ;ControlSend, %autobtn%, {Blind}{Space}, ahk_id%regid%
 Sleep, 30
 }
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%regid%
}
}
sleep,30
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
controlget,vis,visible,,Button2,ahk_id%regid%
controlget,vis1,visible,,PokerStarsButtonClass3,ahk_id%regid%
if !vis && !vis1
winclose,ahk_id%regid%
;ControlSend, PokerStarsButtonClass1, {Blind}{Space}, ahk_id%regid%
}
GuiControl, , Status, Status: Waiting ;TEST
;if class=PokerStarsTableFrameClass
;winactivate,ahk_class PokerStarsTableFrameClass
Break
}
}
}
}
return

AutoReg:
AutoReg()
return

AutoReg()
{
global AutoIfFull
setwindelay,-1
settitlematchmode,2
IfWinExist, Tournament Registration ahk_class #32770
{
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
winget,id,id,
controlget,vis,visible,,%autobtn%,ahk_id%id%
if vis
{
If (AutoIfFull = 1)
{
ControlFocus, %autobtn%, ahk_id%id%
Sleep, -1
ControlSend, %autobtn%, {Blind}{Space}, ahk_id%id%
Sleep, 30
}
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
}
else
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
;winclose,ahk_id%id%
}
}
return

CountTourneys(mode=0) {
global logfile,RegSofar,regtourneys,tables,Targetnum
If (SetReg=1)
Return 0
log := CheckFile(logfile,mode)
Loop, Parse, log, `n,
{
tnumber=
if (instr(A_loopField,"RT add")>0)
{
 tnumber:=RegExReplace(A_loopField, "RT add ", "")
 if instr(tnumber,A_space)
 StringLeft, tnumber, tnumber, instr(tnumber,A_space)-1
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if !instr(tables,tnumber) && ((Targetnum=0) || ((Targetnum>0) && (tnumber>=(Targetnum-50000)) && (tnumber<(Targetnum+150000))))
 listadd(tables,tnumber)
}
else
If (instr(A_loopField,"RT remove")>0)
{
 stringtrimleft,tnumber,A_loopField,instr(A_loopField,A_space,"",0)
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if instr(tables,tnumber)
 listDelItem(tables,tnumber)
}
}
log=
tcount:=0
Loop, Parse, tables, -,
{
if A_Loopfield is number
{
tcount++
if !(instr(regtourneys,A_Loopfield)>0)
{
listadd(regtourneys,A_Loopfield)
if mode=0
RegSofar++
}
}
}
return tcount
}

numcheck:
winget,nlist,list,Table ahk_class PokerStarsTableFrameClass
loop %nlist%
{
id:=nlist%A_index%
wingettitle,title,ahk_id%id%
stringtrimleft,num,title,instr(title,A_space,"",instr(title,"Tournament"))
stringleft,num,num,instr(num,A_space)-1
if num is not number
num:=0
if (num>targetnum)
targetnum:=num
StringReplace,targetnum,targetnum,A_space,,All
StringReplace,targetnum,targetnum,`n,,All
StringReplace,targetnum,targetnum,`r,,All
}
return

Ansi2Unicode(sString, CP = 0)
{
	  nSize := DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", 0
		, "int",  0)

	VarSetCapacity(wString, nSize * 2)

	DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", &wString
		, "int",  nSize)
return wstring
}

ReplaceByte( hayStackAddr, hayStackSize, ByteFrom=0, ByteTo=1, StartOffset=0, NumReps=-1)
{	Static fun
	IfEqual,fun,
	{
		h=
		( LTrim join
			5589E553515256579C8B4D0C8B451831D229C17E25837D1C00741F8B7D0801C70FB6451
			00FB65D14FCF2AE750D885FFF42FF4D1C740409C975EF9D89D05F5E5A595BC9C21800
		)
		VarSetCapacity(fun,StrLen(h)//2)
		Loop % StrLen(h)//2
			NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
	}
	Return DllCall(&fun
		, "uint",haystackAddr, "uint",hayStackSize, "short",ByteFrom, "short",ByteTo
		, "uint",StartOffset, "int",NumReps)
}

CheckFile(File, mode=0) {
   ; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
   Static CF := ""   ; Current File
   Static FP := 0    ; File Pointer
   Static OPEN_EXISTING := 3
   Static GENERIC_READ := 0x80000000
   Static FILE_SHARE_READ := 1
   Static FILE_SHARE_WRITE := 2
   Static FILE_SHARE_DELETE := 4
   Static FILE_BEGIN := 0
   BatchLines := A_BatchLines
   SetBatchLines, -1
   If (File != CF) {
      CF := File
      FP := 0
   }
   hFile := DllCall("CreateFile"
                  , "Str",  File
                  , "Uint", GENERIC_READ
                  , "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
                  , "Uint", 0
                  , "Uint", OPEN_EXISTING
                  , "Uint", 0
                  , "Uint", 0)
   If (!hFile) {
      CF := ""
      FP := 0
      SetBatchLines, %BatchLines%
      Return False
   }
   DllCall("GetFileSizeEx"
         , "Uint",   hFile
         , "Int64P", nSize)
   if mode=1
   FP:=1
   If (FP = 0 Or nSize <= FP) {
      FP := nSize
      SetBatchLines, %BatchLines%
      DllCall("CloseHandle", "Uint", hFile) ; close file
     Return False
   }
   DllCall("SetFilePointerEx"
         , "Uint",  hFile
         , "Int64", FP
         , "Uint",  0
         , "Uint",  FILE_BEGIN)
   VarSetCapacity(Tail, Length := nSize - FP, 0)
   DllCall("ReadFile"
         , "Uint",  hFile
         , "Str",   Tail
         , "Uint",  Length
         , "UintP", Length
         , "Uint",  0)
   DllCall("CloseHandle", "Uint", hFile)
   FP := nSize
   if A_IsUnicode
   {
   tail:=Ansi2Unicode(tail)
   Length:=strlen(tail)
   }
   ReplaceByte(&Tail, Length)
   VarSetCapacity(Tail, -1)
   SetBatchLines, %BatchLines%
   Return Tail
}

listAdd( byRef list, item, del="-" ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}

listDelItem( byRef list, item, del="-") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %del%%item%%del%,%del%,All
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}

lobbyStars() {
SetTitleMatchMode 2
WinGet, id, id, PokerStars Lobby ahk_class #32770,,Tournament
Return id
}

exitsub:
if Targetnum>0
IniWrite, %Targetnum%, %thisahk%.ini, Settings, Targetnum
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
exitapp
return
AHK script:Stars Filtered SNG Opener Quote
07-31-2019 , 03:41 PM
Awesome man, it works again! Thanks for fixing it
AHK script:Stars Filtered SNG Opener Quote
08-02-2019 , 10:59 PM
Hey Max1mums - thank you sooooo much!!! It's working again, spasibo!
AHK script:Stars Filtered SNG Opener Quote
08-11-2019 , 03:09 PM
Thanks Max1mums.It's working great again
AHK script:Stars Filtered SNG Opener Quote
10-28-2019 , 08:29 PM
Max1mums привет. А есть возможность доработать скрипт, что бы он работал сразу при двух запущенных клиентах PS.COM и PS.ES?
AHK script:Stars Filtered SNG Opener Quote
11-11-2019 , 12:24 AM
Hey. Is it possible to add a function to the script so that after the number of tables equal to No of SNG to keep OPEN is opened, the registration is canceled in tournaments in which they also managed to register, but have not started yet?
The problem is that a large number of tournaments are filtered out in the lobby and, for example, with No of SNG to keep OPEN = 8, a larger number of tables can open - 10-12.

Привет. Возможно ли добавить функцию в скрипт, чтобы после того, как открылось количество столов, равное No of SNG to keep OPEN, происходила отмена регистрации в турнирах, в которых также успели зарегистрироваться, но еще не запущены?
Проблема в том, что в лобби отфильтровано большое количество турниров и, например при No of SNG to keep OPEN = 8, может открыться большее кол-во столов - 10-12.
AHK script:Stars Filtered SNG Opener Quote
11-11-2019 , 02:35 AM
No of SNG to keep OPEN includes not started yet tables, so it won't register to 10-12 with keep open = 8. Try setting pokerstars.log.0 file path manually at the script beginning if table count doesn't work for you.
AHK script:Stars Filtered SNG Opener Quote
11-12-2019 , 03:50 AM
Registered in the 9th line of the script:
logfile: = "C: \ Users \ *** \ AppData \ Local \ PokerStars \ Pokerstars.log.0"; <-
But it did not help. As before, after the opening of the number of tables equal to No of SNG to keep OPEN, registration in the CIS is terminated, but the registration of already registered but not yet launched trainers is not canceled. In total, I have filtered out 5 tournaments in the lobby. Also add that I have 2 clients running simultaneously: PS. COM and PS.ES.

Прописал в 9 строчке скрипта:
logfile:="C:\Users\***\AppData\Local\PokerStars\Po kerstars.log.0" ;<-
Но это не помогло. По-прежнему после открытия количества столов, равное No of SNG to keep OPEN, регистрация в СНГ преращается, но отмена регистрации уже зарегистрированных, но еще не запущенных трунирах не производится. Всего в лобби у меня отфильтровано 5 турниров. Также добавлю, что у меня одновремено запущены 2 клиента: PS. COM и PS.ES.
AHK script:Stars Filtered SNG Opener Quote
11-12-2019 , 05:06 AM
Tournament unregistration is not supported, but registration should stop when number of registered tables = number of keep open, not number of open tables. Does table count stay at 0 all the time in GUI for you? Try this version maybe
Code:
; Author:         Everlong@2p2 Code assembled from misc sources, thanks to _dave_, chris228, finnisher
; v.4.01e
; added: PS 7 support
; 4.0x version fixed by Max1mums 
#NoEnv
#SingleInstance, Force
#Persistent
#MaxMem 600
SendMode Input
SetWorkingDir %A_ScriptDir%
setwindelay,-1
setcontroldelay,-1
SetBatchLines, -1
SetTitleMatchMode, 2
SetTimer, register, off
SetTimer, safeguard, off
SetTimer, numcheck, 75
StringTrimRight, thisahk, A_ScriptName, 4
onexit,exitsub
IniRead, pspath, %thisahk%.ini, Settings, path


PS7list1=PokerStarsListClass15
PS7list2=PokerStarsListClass16
defaultregbutton:="PokerStarsButtonClass10"
customregbutton:="PokerStarsButtonClass10"


;;;;;;;;;;;SET YOUR pokerstars.log.0 file path below;;;;;;;;;;;;;;;
;;;;;;;;;;;eg: logfile:="c:\Program Files\PokerStars\pokerstars.log.0"


logfile:= pspath . "pokerstars.log.0" ;<-


IfNotExist,%logfile%
{
Loop, %A_ProgramFiles%\* , 2
{
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
IfNotExist,%logfile%
Loop, %A_AppData%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
IfNotExist,%logfile%
{
StringReplace,logfile,A_AppData,Roaming,Local
Loop, %logfile%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
}
IfNotExist,%logfile%
{
logfile:= pspath . "pokerstars.log.0"
IfNotExist,%logfile%
msgbox, PokerStars.log.0 file path is probably incorrect, recheck the configuration
}
IniRead, Targetnum, %thisahk%.ini, Settings, Targetnum
if Targetnum is not number
Targetnum:=0
;==============================================================
RegSofar=0
OpenTables=0
trows=17
SysGet,mon, MonitorworkArea
fivesec=0
ft:=0
two=0
ddlist4=Off|
ddlist5=Off|
ddlist6=Off|
ddlist7=Off|
LobbyList=Default|Black|
ddlist2:=ddlist2 . 1 . "|"
ddlist2:=ddlist2 . 2 . "|"
Loop 100
{
two:=two+2
ddlist3:=ddlist3 . two . "|"
ddlist:=ddlist . A_index . "|"
If (A_index<51)
{
fivesec:=fivesec+5
ddlist2:=ddlist2 . fivesec . "|"
ddlist6:=ddlist6 . fivesec . "|"
If (A_index<22)
{
ddlist7:=ddlist7 . A_Index . "|"
If (A_index<16)
{
ddlist4:=ddlist4 . A_index . "|"
}
}
}
else
{
ft:=ft+15
ddlist5:=ddlist5 . ft . "|"
}
}
ddlist3:=ddlist3 . 9999 . "|"
Gosub, deletelog
Gosub, BuildGui
Return
;==============================================================
;==============================================================

BuildGui:
Gui, color, white
Gui, font, cOlive
Gui, add, tab, h340 w240, General|Advanced Settings
Gui, add, text, , Auto-register
Gui, add, Checkbox, yp xp+80 Check3 Checked-1 vRegister
Gui, add, text, yp xp+30, Reg. next if full?
Gui, add, Checkbox, yp xp+80 VAutoifFull


Gui, add, text,xp-190 yp+30 , Register every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vInterval1, %ddlist2%
Gui, add, text, xp-140 yp+30, No of SNG:s to keep open:
Gui, add, DropDownList, w50 yp-5 xp+140 vKeepOpen , %ddlist%
Gui, add, text,xp-140 yp+30, Limit total SNG:s to:
Gui, add, DropDownList, w50 yp-5 xp+140 vTotalLimit , %ddlist3%
Gui, add, text,xp-140 yp+30, Limit total time to (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vLimitTime , %ddlist5%

Gui, add, text, xp-140 yp+30 cred vcdown w200
Gui, add, text, xp  yp+30 w200 vRegSofar, SNG:s registered so far:
Gui, add, text,  w200 vOpenTables, Tables open/waiting:
Gui, add, text, w200 cRed vStatus, Status: Idle
Gui, add, Button, w68 ggetgui, &Submit+Run
Gui, add, text, xp+72 yp+5, (Autosaves your settings)
Gui, Add, Button, Disabled xp-72 yp+20 w48 h20 Center , &Resume
Gui, Add, Button, Disabled  w45 h20 yp xp+48 Center , &Pause
Gui, Add, Button, w80 h20 yp xp+45 Center globbyrestore, &Lobby restore
Gui, Add, Button, w40 h20 yp xp+80 Center greset, Reset
Gui, tab, 2

Gui, add, Text, x25 y65 , Lobby Theme:
Gui, add, DropDownList, w65 yp-5 xp+140 vLobby, %LobbyList%
Gui, add, text,xp-140 yp+30 , Close lobbies every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vCloseInterv, %ddlist6%
Gui, add, text, xp-140 yp+18 , (manually Close with ctrl+e)
Gui, add, text, yp+30, Disable if no user Input (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vGuardtimer Choose1 , %ddlist4%
Gui, add, text, xp-140 yp+30 ,Batch-register?
Gui, add, Checkbox,yp xp+140 vBatchReg
Gui, add, text, yp+20 xp-140 ,SetReg* mode?
Gui, add, Checkbox,yp xp+140 vSetReg
Gui, add, text, yp+20 xp-140 ,Minimize lobby?
Gui, add, Checkbox,yp xp+140 vMinlob
Gui, add, Text, xp-140 yp+30, Times to scroll down:
Gui, add, DropDownList, w50 yp-5 xp+140 vscrldwn, %ddlist7%
Gui, add, Text, xp-140 yp+25, Always start at top of lobby?
Gui, add, Checkbox, yp xp+140 vTopReturn
Gui, show, w256, %thisahk%
WinGetPos, x, y, w, h, SFSO
;x:=monRight-w
;y:=monBottom-h
x:=monLeft
y:=monTop
Gosub, GetIni
Gui, show, x%x% y%y%, %thisahk%
Return

reset:
RegSofar:=0
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, Submit, NoHide
return

deletelog:
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
return

getgui:
GuiControl,, Register, -1
Register = 1
Gui, Submit, NoHide
displayedTime=
If (lobby="Default")
{
regButton:=defaultregbutton
}
Else If (lobby="Black" or lobby="Custom*")
{
regButton:=customregbutton
}
Gosub, MakeIni
PausedTime:=LimitTime
Gosub, TimeLimit
interval:=interval1*1000
If interval is not Number
interval=off
If guardtimer is not Number
{
SetTimer, safeguard, off
}
Else
{
killtime:=guardtimer*60000
SetTimer, safeguard, 1000
}
if CloseInterv is not number
SetTimer, NukeLobbies, off
else
{
lobclose:=CloseInterv*1000
SetTimer, NukeLobbies, %lobclose%
}
register=1
sleep,-1
Gosub, ButtonResume
Return

Safeguard:
If (A_TimeIdle > killtime)
{
Gosub, ButtonPause
GuiControl, , cdown, Stopped  due to inactivity!!! %displayedTime%
}
Return

TimeLimit:
If LimitTime is Number
{
allowedMinutes := LimitTime
endTime := A_Now
endTime += %allowedMinutes%, Minutes
SetTimer, CountDown, 1000
}
Else
{
SetTimer, CountDown, off
sleep,-1
GuiControl, , cdown, Time Limit off
}
Return

Countdown:
remainingTime := endTime
EnvSub remainingTime, %A_Now%, Seconds
m := remainingTime // 60
s := Mod(remainingTime, 60)
displayedTime := Format3Digits(m) ":" Format2Digits(s)
GuiControl, , cdown, Running another (mm:ss): %displayedTime%
If (A_now > endTime)
{
SetTimer, Countdown, off
Gosub, ButtonPause
GuiControl, , cdown, Time Limit reached.
}
Return

GuiClose:
Gui, Submit
Gosub, MakeIni
ExitApp
Return

ButtonResume:
Gui, Submit, NoHide
GuiControl, Disable, &Resume
GuiControl, Enable, &Pause
if LimitTime is Number
If PausedTime is Number
LimitTime:=PausedTime
Gosub, TimeLimit
GuiControl, , Register, -1
Register:=1
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament

WinGet,ctrls,ControlList,ahk_id%LobbyID%
Loop,Parse,ctrls,`n
{
 controlgettext,text,%A_LoopField%,ahk_id%LobbyID%
 ;if text=Register
 if (text="Play Now")
 {
 ControlGet,v,Visible,,%A_LoopField%,ahk_id%LobbyID%
 if v
 regButton:=A_LoopField
 }
}

settimer, AutoReg,37
OpenTables:=0
tables=
OpenTables:=CountTourneys(1)
Gosub,Register
SetTimer, Register, %Interval%
sleep,-1
Return

ButtonPause:
Critical
Gui, Submit, NoHide
if LimitTime is Number
PausedTime:=remainingTime/60
Register:=0
settimer, AutoReg,off
SetTimer, Countdown, off
SetTimer, Register, off
GuiControl, Disable, Pause
GuiControl, Enable, Resume
GuiControl, , Register, 0
GuiControl, , cdown, Manually Paused %displayedTime%
GuiControl, , Status, Status: Waiting ;TEST
Return

Register:
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament
If !LobbyID
{
Gosub, ButtonPause
GuiControl,, Status, Status: PokerStars Lobby not found
Gui, show, NoActivate, %thisahk%
Return
}
If (TopReturn=1)
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%lobbyid%
}
WinGet, PhysicalTables, list,Table ahk_class PokerStarsTableFrameClass
If PhysicalTables is not Number
PhysicalTables:=0
If (PhysicalTables >= KeepOpen)
{
GuiControl,, Status, Set Full waiting
Return
}
OpenTables:=CountTourneys()
If OpenTables is not Number
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
If (RegSofar >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables>=KeepOpen)
{
GuiControl, , OpenTables, Tables open/waiting: %OpenTables% (Set full)
GuiControl, , Status, Status: Waiting ;TEST
Return
}
Else
{
If (BatchReg=1)
{
Times:= KeepOpen - OpenTables
RegSNGexec(LobbyID, Times, scrldwn)
}
Else
{
RegSNGexec(LobbyID, 1, scrldwn)
}
}
Return

MakeIni:
IniWrite, %AutoIfFull%, %thisahk%.ini, Settings, AutoIfFull
IniWrite, %TopReturn%, %thisahk%.ini, Settings, TopReturn
IniWrite, %scrldwn%, %thisahk%.ini, Settings, scrldwn
IniWrite, %Lobby%, %thisahk%.ini, Settings, Lobby
IniWrite, %BatchReg%, %thisahk%.ini, Settings, BatchReg
IniWrite, %Setreg%, %thisahk%.ini, Settings, SetReg
IniWrite, %Minlob%, %thisahk%.ini, Settings, MinLob
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %CloseInterv%, %thisahk%.ini, Settings, CloseInterv
IniWrite, %KeepOpen%, %thisahk%.ini, Settings, KeepOpen
IniWrite, %TotalLimit%, %thisahk%.ini, Settings, TotalLimit
IniWrite, %GuardTimer%, %thisahk%.ini, Settings, GuardTimer
IniWrite, %LimitTime%, %thisahk%.ini, Settings, LimitTime
Return

GetIni:
IfExist, %thisahk%.ini
{
IniRead, AutoIfFull, %thisahk%.ini, Settings, AutoIfFull
IniRead, TopReturn, %thisahk%.ini, Settings, TopReturn,0
IniRead, scrldwn, %thisahk%.ini, Settings, scrldwn
IniRead, Lobby, %thisahk%.ini, Settings, Lobby
IniRead, BatchReg, %thisahk%.ini, Settings, BatchReg
IniRead, SetReg, %thisahk%.ini, Settings, SetReg, 1
IniRead, MinLob, %thisahk%.ini, Settings, MinLob, 0
IniRead, Interval1, %thisahk%.ini, Settings, Interval1
IniRead, CloseInterv, %thisahk%.ini, Settings, CloseInterv
IniRead, KeepOpen, %thisahk%.ini, Settings, KeepOpen
IniRead, TotalLimit, %thisahk%.ini, Settings, TotalLimit
IniRead, GuardTimer, %thisahk%.ini, Settings, GuardTimer, Off
IniRead, LimitTime, %thisahk%.ini, Settings, LimitTime, Off
GuiControl, , AutoIfFull, %AutoIfFull%
StringReplace, ddlist7, ddlist7, %scrldwn%, %scrldwn%|
GuiControl, , scrldwn, |%ddlist7%
StringReplace, LobbyList, LobbyList, %Lobby%, %Lobby%|
GuiControl, , Lobby, |%LobbyList%
GuiControl, , BatchReg, %BatchReg%
GuiControl, , SetReg, %SetReg%
GuiControl, , MinLob, %MinLob%
GuiControl, , TopReturn, %TopReturn%
StringReplace, ddlist2, ddlist2, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist2%
StringReplace, ddlist6, ddlist6, %CloseInterv%, %CloseInterv%|
GuiControl, , CloseInterv, |%ddlist6%
StringReplace, ddlist, ddlist, %KeepOpen%, %KeepOpen%|
GuiControl, , KeepOpen, |%ddlist%
StringReplace, ddlist3, ddlist3, %TotalLimit%, %TotalLimit%|,
GuiControl, , TotalLimit, |%ddlist3%
StringReplace, ddlist4, ddlist4, %GuardTimer%, %GuardTimer%|
GuiControl, , GuardTimer, |%ddlist4%
StringReplace, ddlist5, ddlist5, %LimitTime%, %LimitTime%|
GuiControl, , LimitTime, |%ddlist5%
}
Return

#e::
gosub,NukeLobbies
Return

NukeLobbies:
SetTitleMatchMode, 2
GroupAdd, TLobbies, Lobby ahk_class PokerStarsTableFrameClass,,, PokerStars Lobby
GroupClose, TLobbies, A
Return

#H::
WinHide, %thisahk%
return

#S::
WinShow, %thisahk%
return


Format2Digits(_val) {
_val :=Round(_val) + 100
StringRight _val, _val, 2
Return _val
}

Format3Digits(_val) {
_val :=Round(_val) + 1000
StringRight _val, _val, 3
StringTrimRight, FirstZ, _val, 2
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
StringTrimRight, FirstZ, _val, 1
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
Return _val
}

LobbyRestore:
WinGet, lobbyid, id, PokerStars Lobby
WinShow, ahk_id%lobbyid%
WinMove, ahk_id%lobbyid%,,0,0
return

RegSNGexec(id, times, scrldwn) {
global RegSofar
global Register
global OpenTables
global KeepOpen
global TotalLimit
global RegButton
global AutoIfFull
global list,lobbytitle,lobbyid,PS7list1,PS7list2

Loop %times%
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%id%
If (OpenTables >= KeepOpen)
Exit
If (OpenTables >= TotalLimit)
Exit
ClickdirectionCount=0
direction=0
GuiControl, , Status, Status: Registering ;TEST
Loop 16
{
If (Register=0)
{
GuiControl, , Status, Status: Idle ;TEST
Exit
}
ControlGet, v, Visible, , %regButton%, ahk_id%id%
If (v = 0)
If (scrldwn!="Off")
{
If (ClickdirectionCount<scrldwn) {
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
If (direction=0) {
ControlSend, %list%, {Blind}{NumpadDown}, ahk_id%id%
} Else {
ControlSend, %list%, {Blind}{NumpadUp}, ahk_id%id%
}
ClickdirectionCount:=ClickdirectionCount+1
} Else {
If (direction=0) {
direction:=1
} Else {
direction:=0
}
ClickdirectionCount:=0
}
Sleep,1000
}
If ( v = 1 ) {
wingetclass,class,A
SetTitleMatchMode, 2
ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
;ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
controlget,vis,visible,,%autobtn%,ahk_id%regid%
if vis
{
 If (AutoIfFull = 1)
 {
 Control,Check,,%autobtn%, ahk_id%regid%
 ;ControlSend, %autobtn%, {Blind}{Space}, ahk_id%regid%
 Sleep, 30
 }
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%regid%
}
}
sleep,30
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
controlget,vis,visible,,Button2,ahk_id%regid%
controlget,vis1,visible,,PokerStarsButtonClass3,ahk_id%regid%
if !vis && !vis1
winclose,ahk_id%regid%
;ControlSend, PokerStarsButtonClass1, {Blind}{Space}, ahk_id%regid%
}
GuiControl, , Status, Status: Waiting ;TEST
;if class=PokerStarsTableFrameClass
;winactivate,ahk_class PokerStarsTableFrameClass
Break
}
}
}
}
return

AutoReg:
AutoReg()
return

AutoReg()
{
global AutoIfFull
setwindelay,-1
settitlematchmode,2
IfWinExist, Tournament Registration ahk_class #32770
{
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
winget,id,id,
controlget,vis,visible,,%autobtn%,ahk_id%id%
if vis
{
If (AutoIfFull = 1)
{
ControlFocus, %autobtn%, ahk_id%id%
Sleep, -1
ControlSend, %autobtn%, {Blind}{Space}, ahk_id%id%
Sleep, 30
}
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
}
else
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
;winclose,ahk_id%id%
}
}
return

CountTourneys(mode=0) {
global logfile,RegSofar,regtourneys,tables,Targetnum
If (SetReg=1)
Return 0
log := CheckFile(logfile,mode)
Loop, Parse, log, `n,
{
tnumber=
if (instr(A_loopField,"RT add")>0)
{
 tnumber:=RegExReplace(A_loopField, "RT add ", "")
 if instr(tnumber,A_space)>0
 StringLeft, tnumber, tnumber, instr(tnumber,A_space)-1
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if !(instr(tables,tnumber)>0) ;&& ((Targetnum=0) || ((Targetnum>0) && (tnumber>=(Targetnum-50000)) && (tnumber<(Targetnum+150000))))
 listadd(tables,tnumber)
}
else
If (instr(A_loopField,"RT remove")>0)
{
 stringtrimleft,tnumber,A_loopField,instr(A_loopField,A_space,"",0)
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if instr(tables,tnumber)>0
 listDelItem(tables,tnumber)
}
}
log=
tcount:=0
Loop, Parse, tables, -,
{
if A_Loopfield is number
{
tcount++
if !(instr(regtourneys,A_Loopfield)>0)
{
listadd(regtourneys,A_Loopfield)
if mode=0
RegSofar++
}
}
}

return tcount
}

numcheck:
winget,nlist,list,Table ahk_class PokerStarsTableFrameClass
loop %nlist%
{
id:=nlist%A_index%
wingettitle,title,ahk_id%id%
stringtrimleft,num,title,instr(title,A_space,"",instr(title,"Tournament"))
stringleft,num,num,instr(num,A_space)-1
if num is not number
num:=0
if (num>targetnum)
targetnum:=num
StringReplace,targetnum,targetnum,A_space,,All
StringReplace,targetnum,targetnum,`n,,All
StringReplace,targetnum,targetnum,`r,,All
}
return

Ansi2Unicode(sString, CP = 0)
{
	  nSize := DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", 0
		, "int",  0)

	VarSetCapacity(wString, nSize * 2)

	DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", &wString
		, "int",  nSize)
return wstring
}

ReplaceByte( hayStackAddr, hayStackSize, ByteFrom=0, ByteTo=1, StartOffset=0, NumReps=-1)
{	Static fun
	IfEqual,fun,
	{
		h=
		( LTrim join
			5589E553515256579C8B4D0C8B451831D229C17E25837D1C00741F8B7D0801C70FB6451
			00FB65D14FCF2AE750D885FFF42FF4D1C740409C975EF9D89D05F5E5A595BC9C21800
		)
		VarSetCapacity(fun,StrLen(h)//2)
		Loop % StrLen(h)//2
			NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
	}
	Return DllCall(&fun
		, "uint",haystackAddr, "uint",hayStackSize, "short",ByteFrom, "short",ByteTo
		, "uint",StartOffset, "int",NumReps)
}

CheckFile(File, mode=0) {
   ; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
   Static CF := ""   ; Current File
   Static FP := 0    ; File Pointer
   Static OPEN_EXISTING := 3
   Static GENERIC_READ := 0x80000000
   Static FILE_SHARE_READ := 1
   Static FILE_SHARE_WRITE := 2
   Static FILE_SHARE_DELETE := 4
   Static FILE_BEGIN := 0
   BatchLines := A_BatchLines
   SetBatchLines, -1
   If (File != CF) {
      CF := File
      FP := 0
   }
   hFile := DllCall("CreateFile"
                  , "Str",  File
                  , "Uint", GENERIC_READ
                  , "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
                  , "Uint", 0
                  , "Uint", OPEN_EXISTING
                  , "Uint", 0
                  , "Uint", 0)
   If (!hFile) {
      CF := ""
      FP := 0
      SetBatchLines, %BatchLines%
      Return False
   }
   DllCall("GetFileSizeEx"
         , "Uint",   hFile
         , "Int64P", nSize)
   if mode=1
   FP:=1
   If (FP = 0 Or nSize <= FP) {
      FP := nSize
      SetBatchLines, %BatchLines%
      DllCall("CloseHandle", "Uint", hFile) ; close file
     Return False
   }
   DllCall("SetFilePointerEx"
         , "Uint",  hFile
         , "Int64", FP
         , "Uint",  0
         , "Uint",  FILE_BEGIN)
   VarSetCapacity(Tail, Length := nSize - FP, 0)
   DllCall("ReadFile"
         , "Uint",  hFile
         , "Str",   Tail
         , "Uint",  Length
         , "UintP", Length
         , "Uint",  0)
   DllCall("CloseHandle", "Uint", hFile)
   FP := nSize
   if A_IsUnicode
   {
   tail:=Ansi2Unicode(tail)
   Length:=strlen(tail)
   }
   ReplaceByte(&Tail, Length)
   VarSetCapacity(Tail, -1)
   SetBatchLines, %BatchLines%
   Return Tail
}

listAdd( byRef list, item, del="-" ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}

listDelItem( byRef list, item, del="-") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %del%%item%%del%,%del%,All
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}

lobbyStars() {
SetTitleMatchMode 2
WinGet, id, id, PokerStars Lobby ahk_class #32770,,Tournament
Return id
}

exitsub:
if Targetnum>0
IniWrite, %Targetnum%, %thisahk%.ini, Settings, Targetnum
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
exitapp
return
AHK script:Stars Filtered SNG Opener Quote
11-12-2019 , 11:54 PM
Quote:
Originally Posted by Max1mums
Tournament unregistration is not supported, but registration should stop when number of registered tables = number of keep open, not number of open tables. Does table count stay at 0 all the time in GUI for you? Try this version maybe
Code:
; Author:         Everlong@2p2 Code assembled from misc sources, thanks to _dave_, chris228, finnisher
; v.4.01e
; added: PS 7 support
; 4.0x version fixed by Max1mums 
#NoEnv
#SingleInstance, Force
#Persistent
#MaxMem 600
SendMode Input
SetWorkingDir %A_ScriptDir%
setwindelay,-1
setcontroldelay,-1
SetBatchLines, -1
SetTitleMatchMode, 2
SetTimer, register, off
SetTimer, safeguard, off
SetTimer, numcheck, 75
StringTrimRight, thisahk, A_ScriptName, 4
onexit,exitsub
IniRead, pspath, %thisahk%.ini, Settings, path


PS7list1=PokerStarsListClass15
PS7list2=PokerStarsListClass16
defaultregbutton:="PokerStarsButtonClass10"
customregbutton:="PokerStarsButtonClass10"


;;;;;;;;;;;SET YOUR pokerstars.log.0 file path below;;;;;;;;;;;;;;;
;;;;;;;;;;;eg: logfile:="c:\Program Files\PokerStars\pokerstars.log.0"


logfile:= pspath . "pokerstars.log.0" ;<-


IfNotExist,%logfile%
{
Loop, %A_ProgramFiles%\* , 2
{
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
IfNotExist,%logfile%
Loop, %A_AppData%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
IfNotExist,%logfile%
{
StringReplace,logfile,A_AppData,Roaming,Local
Loop, %logfile%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
}
IfNotExist,%logfile%
{
logfile:= pspath . "pokerstars.log.0"
IfNotExist,%logfile%
msgbox, PokerStars.log.0 file path is probably incorrect, recheck the configuration
}
IniRead, Targetnum, %thisahk%.ini, Settings, Targetnum
if Targetnum is not number
Targetnum:=0
;==============================================================
RegSofar=0
OpenTables=0
trows=17
SysGet,mon, MonitorworkArea
fivesec=0
ft:=0
two=0
ddlist4=Off|
ddlist5=Off|
ddlist6=Off|
ddlist7=Off|
LobbyList=Default|Black|
ddlist2:=ddlist2 . 1 . "|"
ddlist2:=ddlist2 . 2 . "|"
Loop 100
{
two:=two+2
ddlist3:=ddlist3 . two . "|"
ddlist:=ddlist . A_index . "|"
If (A_index<51)
{
fivesec:=fivesec+5
ddlist2:=ddlist2 . fivesec . "|"
ddlist6:=ddlist6 . fivesec . "|"
If (A_index<22)
{
ddlist7:=ddlist7 . A_Index . "|"
If (A_index<16)
{
ddlist4:=ddlist4 . A_index . "|"
}
}
}
else
{
ft:=ft+15
ddlist5:=ddlist5 . ft . "|"
}
}
ddlist3:=ddlist3 . 9999 . "|"
Gosub, deletelog
Gosub, BuildGui
Return
;==============================================================
;==============================================================

BuildGui:
Gui, color, white
Gui, font, cOlive
Gui, add, tab, h340 w240, General|Advanced Settings
Gui, add, text, , Auto-register
Gui, add, Checkbox, yp xp+80 Check3 Checked-1 vRegister
Gui, add, text, yp xp+30, Reg. next if full?
Gui, add, Checkbox, yp xp+80 VAutoifFull


Gui, add, text,xp-190 yp+30 , Register every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vInterval1, %ddlist2%
Gui, add, text, xp-140 yp+30, No of SNG:s to keep open:
Gui, add, DropDownList, w50 yp-5 xp+140 vKeepOpen , %ddlist%
Gui, add, text,xp-140 yp+30, Limit total SNG:s to:
Gui, add, DropDownList, w50 yp-5 xp+140 vTotalLimit , %ddlist3%
Gui, add, text,xp-140 yp+30, Limit total time to (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vLimitTime , %ddlist5%

Gui, add, text, xp-140 yp+30 cred vcdown w200
Gui, add, text, xp  yp+30 w200 vRegSofar, SNG:s registered so far:
Gui, add, text,  w200 vOpenTables, Tables open/waiting:
Gui, add, text, w200 cRed vStatus, Status: Idle
Gui, add, Button, w68 ggetgui, &Submit+Run
Gui, add, text, xp+72 yp+5, (Autosaves your settings)
Gui, Add, Button, Disabled xp-72 yp+20 w48 h20 Center , &Resume
Gui, Add, Button, Disabled  w45 h20 yp xp+48 Center , &Pause
Gui, Add, Button, w80 h20 yp xp+45 Center globbyrestore, &Lobby restore
Gui, Add, Button, w40 h20 yp xp+80 Center greset, Reset
Gui, tab, 2

Gui, add, Text, x25 y65 , Lobby Theme:
Gui, add, DropDownList, w65 yp-5 xp+140 vLobby, %LobbyList%
Gui, add, text,xp-140 yp+30 , Close lobbies every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vCloseInterv, %ddlist6%
Gui, add, text, xp-140 yp+18 , (manually Close with ctrl+e)
Gui, add, text, yp+30, Disable if no user Input (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vGuardtimer Choose1 , %ddlist4%
Gui, add, text, xp-140 yp+30 ,Batch-register?
Gui, add, Checkbox,yp xp+140 vBatchReg
Gui, add, text, yp+20 xp-140 ,SetReg* mode?
Gui, add, Checkbox,yp xp+140 vSetReg
Gui, add, text, yp+20 xp-140 ,Minimize lobby?
Gui, add, Checkbox,yp xp+140 vMinlob
Gui, add, Text, xp-140 yp+30, Times to scroll down:
Gui, add, DropDownList, w50 yp-5 xp+140 vscrldwn, %ddlist7%
Gui, add, Text, xp-140 yp+25, Always start at top of lobby?
Gui, add, Checkbox, yp xp+140 vTopReturn
Gui, show, w256, %thisahk%
WinGetPos, x, y, w, h, SFSO
;x:=monRight-w
;y:=monBottom-h
x:=monLeft
y:=monTop
Gosub, GetIni
Gui, show, x%x% y%y%, %thisahk%
Return

reset:
RegSofar:=0
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, Submit, NoHide
return

deletelog:
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
return

getgui:
GuiControl,, Register, -1
Register = 1
Gui, Submit, NoHide
displayedTime=
If (lobby="Default")
{
regButton:=defaultregbutton
}
Else If (lobby="Black" or lobby="Custom*")
{
regButton:=customregbutton
}
Gosub, MakeIni
PausedTime:=LimitTime
Gosub, TimeLimit
interval:=interval1*1000
If interval is not Number
interval=off
If guardtimer is not Number
{
SetTimer, safeguard, off
}
Else
{
killtime:=guardtimer*60000
SetTimer, safeguard, 1000
}
if CloseInterv is not number
SetTimer, NukeLobbies, off
else
{
lobclose:=CloseInterv*1000
SetTimer, NukeLobbies, %lobclose%
}
register=1
sleep,-1
Gosub, ButtonResume
Return

Safeguard:
If (A_TimeIdle > killtime)
{
Gosub, ButtonPause
GuiControl, , cdown, Stopped  due to inactivity!!! %displayedTime%
}
Return

TimeLimit:
If LimitTime is Number
{
allowedMinutes := LimitTime
endTime := A_Now
endTime += %allowedMinutes%, Minutes
SetTimer, CountDown, 1000
}
Else
{
SetTimer, CountDown, off
sleep,-1
GuiControl, , cdown, Time Limit off
}
Return

Countdown:
remainingTime := endTime
EnvSub remainingTime, %A_Now%, Seconds
m := remainingTime // 60
s := Mod(remainingTime, 60)
displayedTime := Format3Digits(m) ":" Format2Digits(s)
GuiControl, , cdown, Running another (mm:ss): %displayedTime%
If (A_now > endTime)
{
SetTimer, Countdown, off
Gosub, ButtonPause
GuiControl, , cdown, Time Limit reached.
}
Return

GuiClose:
Gui, Submit
Gosub, MakeIni
ExitApp
Return

ButtonResume:
Gui, Submit, NoHide
GuiControl, Disable, &Resume
GuiControl, Enable, &Pause
if LimitTime is Number
If PausedTime is Number
LimitTime:=PausedTime
Gosub, TimeLimit
GuiControl, , Register, -1
Register:=1
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament

WinGet,ctrls,ControlList,ahk_id%LobbyID%
Loop,Parse,ctrls,`n
{
 controlgettext,text,%A_LoopField%,ahk_id%LobbyID%
 ;if text=Register
 if (text="Play Now")
 {
 ControlGet,v,Visible,,%A_LoopField%,ahk_id%LobbyID%
 if v
 regButton:=A_LoopField
 }
}

settimer, AutoReg,37
OpenTables:=0
tables=
OpenTables:=CountTourneys(1)
Gosub,Register
SetTimer, Register, %Interval%
sleep,-1
Return

ButtonPause:
Critical
Gui, Submit, NoHide
if LimitTime is Number
PausedTime:=remainingTime/60
Register:=0
settimer, AutoReg,off
SetTimer, Countdown, off
SetTimer, Register, off
GuiControl, Disable, Pause
GuiControl, Enable, Resume
GuiControl, , Register, 0
GuiControl, , cdown, Manually Paused %displayedTime%
GuiControl, , Status, Status: Waiting ;TEST
Return

Register:
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament
If !LobbyID
{
Gosub, ButtonPause
GuiControl,, Status, Status: PokerStars Lobby not found
Gui, show, NoActivate, %thisahk%
Return
}
If (TopReturn=1)
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%lobbyid%
}
WinGet, PhysicalTables, list,Table ahk_class PokerStarsTableFrameClass
If PhysicalTables is not Number
PhysicalTables:=0
If (PhysicalTables >= KeepOpen)
{
GuiControl,, Status, Set Full waiting
Return
}
OpenTables:=CountTourneys()
If OpenTables is not Number
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
If (RegSofar >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables>=KeepOpen)
{
GuiControl, , OpenTables, Tables open/waiting: %OpenTables% (Set full)
GuiControl, , Status, Status: Waiting ;TEST
Return
}
Else
{
If (BatchReg=1)
{
Times:= KeepOpen - OpenTables
RegSNGexec(LobbyID, Times, scrldwn)
}
Else
{
RegSNGexec(LobbyID, 1, scrldwn)
}
}
Return

MakeIni:
IniWrite, %AutoIfFull%, %thisahk%.ini, Settings, AutoIfFull
IniWrite, %TopReturn%, %thisahk%.ini, Settings, TopReturn
IniWrite, %scrldwn%, %thisahk%.ini, Settings, scrldwn
IniWrite, %Lobby%, %thisahk%.ini, Settings, Lobby
IniWrite, %BatchReg%, %thisahk%.ini, Settings, BatchReg
IniWrite, %Setreg%, %thisahk%.ini, Settings, SetReg
IniWrite, %Minlob%, %thisahk%.ini, Settings, MinLob
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %CloseInterv%, %thisahk%.ini, Settings, CloseInterv
IniWrite, %KeepOpen%, %thisahk%.ini, Settings, KeepOpen
IniWrite, %TotalLimit%, %thisahk%.ini, Settings, TotalLimit
IniWrite, %GuardTimer%, %thisahk%.ini, Settings, GuardTimer
IniWrite, %LimitTime%, %thisahk%.ini, Settings, LimitTime
Return

GetIni:
IfExist, %thisahk%.ini
{
IniRead, AutoIfFull, %thisahk%.ini, Settings, AutoIfFull
IniRead, TopReturn, %thisahk%.ini, Settings, TopReturn,0
IniRead, scrldwn, %thisahk%.ini, Settings, scrldwn
IniRead, Lobby, %thisahk%.ini, Settings, Lobby
IniRead, BatchReg, %thisahk%.ini, Settings, BatchReg
IniRead, SetReg, %thisahk%.ini, Settings, SetReg, 1
IniRead, MinLob, %thisahk%.ini, Settings, MinLob, 0
IniRead, Interval1, %thisahk%.ini, Settings, Interval1
IniRead, CloseInterv, %thisahk%.ini, Settings, CloseInterv
IniRead, KeepOpen, %thisahk%.ini, Settings, KeepOpen
IniRead, TotalLimit, %thisahk%.ini, Settings, TotalLimit
IniRead, GuardTimer, %thisahk%.ini, Settings, GuardTimer, Off
IniRead, LimitTime, %thisahk%.ini, Settings, LimitTime, Off
GuiControl, , AutoIfFull, %AutoIfFull%
StringReplace, ddlist7, ddlist7, %scrldwn%, %scrldwn%|
GuiControl, , scrldwn, |%ddlist7%
StringReplace, LobbyList, LobbyList, %Lobby%, %Lobby%|
GuiControl, , Lobby, |%LobbyList%
GuiControl, , BatchReg, %BatchReg%
GuiControl, , SetReg, %SetReg%
GuiControl, , MinLob, %MinLob%
GuiControl, , TopReturn, %TopReturn%
StringReplace, ddlist2, ddlist2, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist2%
StringReplace, ddlist6, ddlist6, %CloseInterv%, %CloseInterv%|
GuiControl, , CloseInterv, |%ddlist6%
StringReplace, ddlist, ddlist, %KeepOpen%, %KeepOpen%|
GuiControl, , KeepOpen, |%ddlist%
StringReplace, ddlist3, ddlist3, %TotalLimit%, %TotalLimit%|,
GuiControl, , TotalLimit, |%ddlist3%
StringReplace, ddlist4, ddlist4, %GuardTimer%, %GuardTimer%|
GuiControl, , GuardTimer, |%ddlist4%
StringReplace, ddlist5, ddlist5, %LimitTime%, %LimitTime%|
GuiControl, , LimitTime, |%ddlist5%
}
Return

#e::
gosub,NukeLobbies
Return

NukeLobbies:
SetTitleMatchMode, 2
GroupAdd, TLobbies, Lobby ahk_class PokerStarsTableFrameClass,,, PokerStars Lobby
GroupClose, TLobbies, A
Return

#H::
WinHide, %thisahk%
return

#S::
WinShow, %thisahk%
return


Format2Digits(_val) {
_val :=Round(_val) + 100
StringRight _val, _val, 2
Return _val
}

Format3Digits(_val) {
_val :=Round(_val) + 1000
StringRight _val, _val, 3
StringTrimRight, FirstZ, _val, 2
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
StringTrimRight, FirstZ, _val, 1
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
Return _val
}

LobbyRestore:
WinGet, lobbyid, id, PokerStars Lobby
WinShow, ahk_id%lobbyid%
WinMove, ahk_id%lobbyid%,,0,0
return

RegSNGexec(id, times, scrldwn) {
global RegSofar
global Register
global OpenTables
global KeepOpen
global TotalLimit
global RegButton
global AutoIfFull
global list,lobbytitle,lobbyid,PS7list1,PS7list2

Loop %times%
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%id%
If (OpenTables >= KeepOpen)
Exit
If (OpenTables >= TotalLimit)
Exit
ClickdirectionCount=0
direction=0
GuiControl, , Status, Status: Registering ;TEST
Loop 16
{
If (Register=0)
{
GuiControl, , Status, Status: Idle ;TEST
Exit
}
ControlGet, v, Visible, , %regButton%, ahk_id%id%
If (v = 0)
If (scrldwn!="Off")
{
If (ClickdirectionCount<scrldwn) {
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
If (direction=0) {
ControlSend, %list%, {Blind}{NumpadDown}, ahk_id%id%
} Else {
ControlSend, %list%, {Blind}{NumpadUp}, ahk_id%id%
}
ClickdirectionCount:=ClickdirectionCount+1
} Else {
If (direction=0) {
direction:=1
} Else {
direction:=0
}
ClickdirectionCount:=0
}
Sleep,1000
}
If ( v = 1 ) {
wingetclass,class,A
SetTitleMatchMode, 2
ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
;ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
controlget,vis,visible,,%autobtn%,ahk_id%regid%
if vis
{
 If (AutoIfFull = 1)
 {
 Control,Check,,%autobtn%, ahk_id%regid%
 ;ControlSend, %autobtn%, {Blind}{Space}, ahk_id%regid%
 Sleep, 30
 }
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%regid%
}
}
sleep,30
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
controlget,vis,visible,,Button2,ahk_id%regid%
controlget,vis1,visible,,PokerStarsButtonClass3,ahk_id%regid%
if !vis && !vis1
winclose,ahk_id%regid%
;ControlSend, PokerStarsButtonClass1, {Blind}{Space}, ahk_id%regid%
}
GuiControl, , Status, Status: Waiting ;TEST
;if class=PokerStarsTableFrameClass
;winactivate,ahk_class PokerStarsTableFrameClass
Break
}
}
}
}
return

AutoReg:
AutoReg()
return

AutoReg()
{
global AutoIfFull
setwindelay,-1
settitlematchmode,2
IfWinExist, Tournament Registration ahk_class #32770
{
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
winget,id,id,
controlget,vis,visible,,%autobtn%,ahk_id%id%
if vis
{
If (AutoIfFull = 1)
{
ControlFocus, %autobtn%, ahk_id%id%
Sleep, -1
ControlSend, %autobtn%, {Blind}{Space}, ahk_id%id%
Sleep, 30
}
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
}
else
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
;winclose,ahk_id%id%
}
}
return

CountTourneys(mode=0) {
global logfile,RegSofar,regtourneys,tables,Targetnum
If (SetReg=1)
Return 0
log := CheckFile(logfile,mode)
Loop, Parse, log, `n,
{
tnumber=
if (instr(A_loopField,"RT add")>0)
{
 tnumber:=RegExReplace(A_loopField, "RT add ", "")
 if instr(tnumber,A_space)>0
 StringLeft, tnumber, tnumber, instr(tnumber,A_space)-1
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if !(instr(tables,tnumber)>0) ;&& ((Targetnum=0) || ((Targetnum>0) && (tnumber>=(Targetnum-50000)) && (tnumber<(Targetnum+150000))))
 listadd(tables,tnumber)
}
else
If (instr(A_loopField,"RT remove")>0)
{
 stringtrimleft,tnumber,A_loopField,instr(A_loopField,A_space,"",0)
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if instr(tables,tnumber)>0
 listDelItem(tables,tnumber)
}
}
log=
tcount:=0
Loop, Parse, tables, -,
{
if A_Loopfield is number
{
tcount++
if !(instr(regtourneys,A_Loopfield)>0)
{
listadd(regtourneys,A_Loopfield)
if mode=0
RegSofar++
}
}
}

return tcount
}

numcheck:
winget,nlist,list,Table ahk_class PokerStarsTableFrameClass
loop %nlist%
{
id:=nlist%A_index%
wingettitle,title,ahk_id%id%
stringtrimleft,num,title,instr(title,A_space,"",instr(title,"Tournament"))
stringleft,num,num,instr(num,A_space)-1
if num is not number
num:=0
if (num>targetnum)
targetnum:=num
StringReplace,targetnum,targetnum,A_space,,All
StringReplace,targetnum,targetnum,`n,,All
StringReplace,targetnum,targetnum,`r,,All
}
return

Ansi2Unicode(sString, CP = 0)
{
	  nSize := DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", 0
		, "int",  0)

	VarSetCapacity(wString, nSize * 2)

	DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", &wString
		, "int",  nSize)
return wstring
}

ReplaceByte( hayStackAddr, hayStackSize, ByteFrom=0, ByteTo=1, StartOffset=0, NumReps=-1)
{	Static fun
	IfEqual,fun,
	{
		h=
		( LTrim join
			5589E553515256579C8B4D0C8B451831D229C17E25837D1C00741F8B7D0801C70FB6451
			00FB65D14FCF2AE750D885FFF42FF4D1C740409C975EF9D89D05F5E5A595BC9C21800
		)
		VarSetCapacity(fun,StrLen(h)//2)
		Loop % StrLen(h)//2
			NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
	}
	Return DllCall(&fun
		, "uint",haystackAddr, "uint",hayStackSize, "short",ByteFrom, "short",ByteTo
		, "uint",StartOffset, "int",NumReps)
}

CheckFile(File, mode=0) {
   ; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
   Static CF := ""   ; Current File
   Static FP := 0    ; File Pointer
   Static OPEN_EXISTING := 3
   Static GENERIC_READ := 0x80000000
   Static FILE_SHARE_READ := 1
   Static FILE_SHARE_WRITE := 2
   Static FILE_SHARE_DELETE := 4
   Static FILE_BEGIN := 0
   BatchLines := A_BatchLines
   SetBatchLines, -1
   If (File != CF) {
      CF := File
      FP := 0
   }
   hFile := DllCall("CreateFile"
                  , "Str",  File
                  , "Uint", GENERIC_READ
                  , "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
                  , "Uint", 0
                  , "Uint", OPEN_EXISTING
                  , "Uint", 0
                  , "Uint", 0)
   If (!hFile) {
      CF := ""
      FP := 0
      SetBatchLines, %BatchLines%
      Return False
   }
   DllCall("GetFileSizeEx"
         , "Uint",   hFile
         , "Int64P", nSize)
   if mode=1
   FP:=1
   If (FP = 0 Or nSize <= FP) {
      FP := nSize
      SetBatchLines, %BatchLines%
      DllCall("CloseHandle", "Uint", hFile) ; close file
     Return False
   }
   DllCall("SetFilePointerEx"
         , "Uint",  hFile
         , "Int64", FP
         , "Uint",  0
         , "Uint",  FILE_BEGIN)
   VarSetCapacity(Tail, Length := nSize - FP, 0)
   DllCall("ReadFile"
         , "Uint",  hFile
         , "Str",   Tail
         , "Uint",  Length
         , "UintP", Length
         , "Uint",  0)
   DllCall("CloseHandle", "Uint", hFile)
   FP := nSize
   if A_IsUnicode
   {
   tail:=Ansi2Unicode(tail)
   Length:=strlen(tail)
   }
   ReplaceByte(&Tail, Length)
   VarSetCapacity(Tail, -1)
   SetBatchLines, %BatchLines%
   Return Tail
}

listAdd( byRef list, item, del="-" ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}

listDelItem( byRef list, item, del="-") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %del%%item%%del%,%del%,All
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}

lobbyStars() {
SetTitleMatchMode 2
WinGet, id, id, PokerStars Lobby ahk_class #32770,,Tournament
Return id
}

exitsub:
if Targetnum>0
IniWrite, %Targetnum%, %thisahk%.ini, Settings, Targetnum
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
exitapp
return
I tried this version, but the situation did not change. Problem still exists.

Попробовал эту версию, но ситуация не изменилась. Проблема осталась.
AHK script:Stars Filtered SNG Opener Quote
11-20-2019 , 02:30 AM
Hey. There is still the following problem: when two PS.COM and PS.ES clients are running simultaneously, the script periodically gets confused in the clients lobby, can start registration in the PS.COM client, and then continue in the PS.ES client. How to make the script work only with the lobby of the PS.COM client?

Привет. Еще есть следующая проблема: при одновременно запущенных двух клиентах PS.COM и PS.ES скрипт периодически путается в лобби клиентов, может начать регистрацию в клиенте PS.COM, а затем продолжить в клиенте PS.ES. Как сделать так, чтоб скрипт работал только с лобби клиента PS.COM?
AHK script:Stars Filtered SNG Opener Quote
03-07-2020 , 09:55 AM
Quote:
Originally Posted by Max1mums
Tournament unregistration is not supported, but registration should stop when number of registered tables = number of keep open, not number of open tables. Does table count stay at 0 all the time in GUI for you? Try this version maybe
Code:
; Author:         Everlong@2p2 Code assembled from misc sources, thanks to _dave_, chris228, finnisher
; v.4.01e
; added: PS 7 support
; 4.0x version fixed by Max1mums 
#NoEnv
#SingleInstance, Force
#Persistent
#MaxMem 600
SendMode Input
SetWorkingDir %A_ScriptDir%
setwindelay,-1
setcontroldelay,-1
SetBatchLines, -1
SetTitleMatchMode, 2
SetTimer, register, off
SetTimer, safeguard, off
SetTimer, numcheck, 75
StringTrimRight, thisahk, A_ScriptName, 4
onexit,exitsub
IniRead, pspath, %thisahk%.ini, Settings, path


PS7list1=PokerStarsListClass15
PS7list2=PokerStarsListClass16
defaultregbutton:="PokerStarsButtonClass10"
customregbutton:="PokerStarsButtonClass10"


;;;;;;;;;;;SET YOUR pokerstars.log.0 file path below;;;;;;;;;;;;;;;
;;;;;;;;;;;eg: logfile:="c:\Program Files\PokerStars\pokerstars.log.0"


logfile:= pspath . "pokerstars.log.0" ;<-


IfNotExist,%logfile%
{
Loop, %A_ProgramFiles%\* , 2
{
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
IfNotExist,%logfile%
Loop, %A_AppData%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
IfNotExist,%logfile%
{
StringReplace,logfile,A_AppData,Roaming,Local
Loop, %logfile%\* , 2
if instr(A_LoopFileName,"PokerStars")>0
logfile:=A_LoopFileFullPath . "\PokerStars.log.0"
}
}
IfNotExist,%logfile%
{
logfile:= pspath . "pokerstars.log.0"
IfNotExist,%logfile%
msgbox, PokerStars.log.0 file path is probably incorrect, recheck the configuration
}
IniRead, Targetnum, %thisahk%.ini, Settings, Targetnum
if Targetnum is not number
Targetnum:=0
;==============================================================
RegSofar=0
OpenTables=0
trows=17
SysGet,mon, MonitorworkArea
fivesec=0
ft:=0
two=0
ddlist4=Off|
ddlist5=Off|
ddlist6=Off|
ddlist7=Off|
LobbyList=Default|Black|
ddlist2:=ddlist2 . 1 . "|"
ddlist2:=ddlist2 . 2 . "|"
Loop 100
{
two:=two+2
ddlist3:=ddlist3 . two . "|"
ddlist:=ddlist . A_index . "|"
If (A_index<51)
{
fivesec:=fivesec+5
ddlist2:=ddlist2 . fivesec . "|"
ddlist6:=ddlist6 . fivesec . "|"
If (A_index<22)
{
ddlist7:=ddlist7 . A_Index . "|"
If (A_index<16)
{
ddlist4:=ddlist4 . A_index . "|"
}
}
}
else
{
ft:=ft+15
ddlist5:=ddlist5 . ft . "|"
}
}
ddlist3:=ddlist3 . 9999 . "|"
Gosub, deletelog
Gosub, BuildGui
Return
;==============================================================
;==============================================================

BuildGui:
Gui, color, white
Gui, font, cOlive
Gui, add, tab, h340 w240, General|Advanced Settings
Gui, add, text, , Auto-register
Gui, add, Checkbox, yp xp+80 Check3 Checked-1 vRegister
Gui, add, text, yp xp+30, Reg. next if full?
Gui, add, Checkbox, yp xp+80 VAutoifFull


Gui, add, text,xp-190 yp+30 , Register every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vInterval1, %ddlist2%
Gui, add, text, xp-140 yp+30, No of SNG:s to keep open:
Gui, add, DropDownList, w50 yp-5 xp+140 vKeepOpen , %ddlist%
Gui, add, text,xp-140 yp+30, Limit total SNG:s to:
Gui, add, DropDownList, w50 yp-5 xp+140 vTotalLimit , %ddlist3%
Gui, add, text,xp-140 yp+30, Limit total time to (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vLimitTime , %ddlist5%

Gui, add, text, xp-140 yp+30 cred vcdown w200
Gui, add, text, xp  yp+30 w200 vRegSofar, SNG:s registered so far:
Gui, add, text,  w200 vOpenTables, Tables open/waiting:
Gui, add, text, w200 cRed vStatus, Status: Idle
Gui, add, Button, w68 ggetgui, &Submit+Run
Gui, add, text, xp+72 yp+5, (Autosaves your settings)
Gui, Add, Button, Disabled xp-72 yp+20 w48 h20 Center , &Resume
Gui, Add, Button, Disabled  w45 h20 yp xp+48 Center , &Pause
Gui, Add, Button, w80 h20 yp xp+45 Center globbyrestore, &Lobby restore
Gui, Add, Button, w40 h20 yp xp+80 Center greset, Reset
Gui, tab, 2

Gui, add, Text, x25 y65 , Lobby Theme:
Gui, add, DropDownList, w65 yp-5 xp+140 vLobby, %LobbyList%
Gui, add, text,xp-140 yp+30 , Close lobbies every (sec):
Gui, add, DropDownList, w50 yp-5 xp+140  vCloseInterv, %ddlist6%
Gui, add, text, xp-140 yp+18 , (manually Close with ctrl+e)
Gui, add, text, yp+30, Disable if no user Input (min):
Gui, add, DropDownList, w50 yp-5 xp+140 vGuardtimer Choose1 , %ddlist4%
Gui, add, text, xp-140 yp+30 ,Batch-register?
Gui, add, Checkbox,yp xp+140 vBatchReg
Gui, add, text, yp+20 xp-140 ,SetReg* mode?
Gui, add, Checkbox,yp xp+140 vSetReg
Gui, add, text, yp+20 xp-140 ,Minimize lobby?
Gui, add, Checkbox,yp xp+140 vMinlob
Gui, add, Text, xp-140 yp+30, Times to scroll down:
Gui, add, DropDownList, w50 yp-5 xp+140 vscrldwn, %ddlist7%
Gui, add, Text, xp-140 yp+25, Always start at top of lobby?
Gui, add, Checkbox, yp xp+140 vTopReturn
Gui, show, w256, %thisahk%
WinGetPos, x, y, w, h, SFSO
;x:=monRight-w
;y:=monBottom-h
x:=monLeft
y:=monTop
Gosub, GetIni
Gui, show, x%x% y%y%, %thisahk%
Return

reset:
RegSofar:=0
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
Gui, Submit, NoHide
return

deletelog:
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
return

getgui:
GuiControl,, Register, -1
Register = 1
Gui, Submit, NoHide
displayedTime=
If (lobby="Default")
{
regButton:=defaultregbutton
}
Else If (lobby="Black" or lobby="Custom*")
{
regButton:=customregbutton
}
Gosub, MakeIni
PausedTime:=LimitTime
Gosub, TimeLimit
interval:=interval1*1000
If interval is not Number
interval=off
If guardtimer is not Number
{
SetTimer, safeguard, off
}
Else
{
killtime:=guardtimer*60000
SetTimer, safeguard, 1000
}
if CloseInterv is not number
SetTimer, NukeLobbies, off
else
{
lobclose:=CloseInterv*1000
SetTimer, NukeLobbies, %lobclose%
}
register=1
sleep,-1
Gosub, ButtonResume
Return

Safeguard:
If (A_TimeIdle > killtime)
{
Gosub, ButtonPause
GuiControl, , cdown, Stopped  due to inactivity!!! %displayedTime%
}
Return

TimeLimit:
If LimitTime is Number
{
allowedMinutes := LimitTime
endTime := A_Now
endTime += %allowedMinutes%, Minutes
SetTimer, CountDown, 1000
}
Else
{
SetTimer, CountDown, off
sleep,-1
GuiControl, , cdown, Time Limit off
}
Return

Countdown:
remainingTime := endTime
EnvSub remainingTime, %A_Now%, Seconds
m := remainingTime // 60
s := Mod(remainingTime, 60)
displayedTime := Format3Digits(m) ":" Format2Digits(s)
GuiControl, , cdown, Running another (mm:ss): %displayedTime%
If (A_now > endTime)
{
SetTimer, Countdown, off
Gosub, ButtonPause
GuiControl, , cdown, Time Limit reached.
}
Return

GuiClose:
Gui, Submit
Gosub, MakeIni
ExitApp
Return

ButtonResume:
Gui, Submit, NoHide
GuiControl, Disable, &Resume
GuiControl, Enable, &Pause
if LimitTime is Number
If PausedTime is Number
LimitTime:=PausedTime
Gosub, TimeLimit
GuiControl, , Register, -1
Register:=1
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament

WinGet,ctrls,ControlList,ahk_id%LobbyID%
Loop,Parse,ctrls,`n
{
 controlgettext,text,%A_LoopField%,ahk_id%LobbyID%
 ;if text=Register
 if (text="Play Now")
 {
 ControlGet,v,Visible,,%A_LoopField%,ahk_id%LobbyID%
 if v
 regButton:=A_LoopField
 }
}

settimer, AutoReg,37
OpenTables:=0
tables=
OpenTables:=CountTourneys(1)
Gosub,Register
SetTimer, Register, %Interval%
sleep,-1
Return

ButtonPause:
Critical
Gui, Submit, NoHide
if LimitTime is Number
PausedTime:=remainingTime/60
Register:=0
settimer, AutoReg,off
SetTimer, Countdown, off
SetTimer, Register, off
GuiControl, Disable, Pause
GuiControl, Enable, Resume
GuiControl, , Register, 0
GuiControl, , cdown, Manually Paused %displayedTime%
GuiControl, , Status, Status: Waiting ;TEST
Return

Register:
SetTitleMatchMode, 2
WinGet, LobbyID, id, PokerStars Lobby,,Tournament
If !LobbyID
{
Gosub, ButtonPause
GuiControl,, Status, Status: PokerStars Lobby not found
Gui, show, NoActivate, %thisahk%
Return
}
If (TopReturn=1)
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%lobbyid%
}
WinGet, PhysicalTables, list,Table ahk_class PokerStarsTableFrameClass
If PhysicalTables is not Number
PhysicalTables:=0
If (PhysicalTables >= KeepOpen)
{
GuiControl,, Status, Set Full waiting
Return
}
OpenTables:=CountTourneys()
If OpenTables is not Number
OpenTables:=0
GuiControl, , OpenTables, Tables open/waiting: %OpenTables%
GuiControl, , RegSofar, SNG:s registered so far: %RegSofar%
If (RegSofar >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables >= TotalLimit)
{
Gosub, ButtonPause
GuiControl, , cdown, SNG Total Limit reached
GuiControl, , Status, Status: Idle ;TEST
Return
}
If (OpenTables>=KeepOpen)
{
GuiControl, , OpenTables, Tables open/waiting: %OpenTables% (Set full)
GuiControl, , Status, Status: Waiting ;TEST
Return
}
Else
{
If (BatchReg=1)
{
Times:= KeepOpen - OpenTables
RegSNGexec(LobbyID, Times, scrldwn)
}
Else
{
RegSNGexec(LobbyID, 1, scrldwn)
}
}
Return

MakeIni:
IniWrite, %AutoIfFull%, %thisahk%.ini, Settings, AutoIfFull
IniWrite, %TopReturn%, %thisahk%.ini, Settings, TopReturn
IniWrite, %scrldwn%, %thisahk%.ini, Settings, scrldwn
IniWrite, %Lobby%, %thisahk%.ini, Settings, Lobby
IniWrite, %BatchReg%, %thisahk%.ini, Settings, BatchReg
IniWrite, %Setreg%, %thisahk%.ini, Settings, SetReg
IniWrite, %Minlob%, %thisahk%.ini, Settings, MinLob
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %CloseInterv%, %thisahk%.ini, Settings, CloseInterv
IniWrite, %KeepOpen%, %thisahk%.ini, Settings, KeepOpen
IniWrite, %TotalLimit%, %thisahk%.ini, Settings, TotalLimit
IniWrite, %GuardTimer%, %thisahk%.ini, Settings, GuardTimer
IniWrite, %LimitTime%, %thisahk%.ini, Settings, LimitTime
Return

GetIni:
IfExist, %thisahk%.ini
{
IniRead, AutoIfFull, %thisahk%.ini, Settings, AutoIfFull
IniRead, TopReturn, %thisahk%.ini, Settings, TopReturn,0
IniRead, scrldwn, %thisahk%.ini, Settings, scrldwn
IniRead, Lobby, %thisahk%.ini, Settings, Lobby
IniRead, BatchReg, %thisahk%.ini, Settings, BatchReg
IniRead, SetReg, %thisahk%.ini, Settings, SetReg, 1
IniRead, MinLob, %thisahk%.ini, Settings, MinLob, 0
IniRead, Interval1, %thisahk%.ini, Settings, Interval1
IniRead, CloseInterv, %thisahk%.ini, Settings, CloseInterv
IniRead, KeepOpen, %thisahk%.ini, Settings, KeepOpen
IniRead, TotalLimit, %thisahk%.ini, Settings, TotalLimit
IniRead, GuardTimer, %thisahk%.ini, Settings, GuardTimer, Off
IniRead, LimitTime, %thisahk%.ini, Settings, LimitTime, Off
GuiControl, , AutoIfFull, %AutoIfFull%
StringReplace, ddlist7, ddlist7, %scrldwn%, %scrldwn%|
GuiControl, , scrldwn, |%ddlist7%
StringReplace, LobbyList, LobbyList, %Lobby%, %Lobby%|
GuiControl, , Lobby, |%LobbyList%
GuiControl, , BatchReg, %BatchReg%
GuiControl, , SetReg, %SetReg%
GuiControl, , MinLob, %MinLob%
GuiControl, , TopReturn, %TopReturn%
StringReplace, ddlist2, ddlist2, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist2%
StringReplace, ddlist6, ddlist6, %CloseInterv%, %CloseInterv%|
GuiControl, , CloseInterv, |%ddlist6%
StringReplace, ddlist, ddlist, %KeepOpen%, %KeepOpen%|
GuiControl, , KeepOpen, |%ddlist%
StringReplace, ddlist3, ddlist3, %TotalLimit%, %TotalLimit%|,
GuiControl, , TotalLimit, |%ddlist3%
StringReplace, ddlist4, ddlist4, %GuardTimer%, %GuardTimer%|
GuiControl, , GuardTimer, |%ddlist4%
StringReplace, ddlist5, ddlist5, %LimitTime%, %LimitTime%|
GuiControl, , LimitTime, |%ddlist5%
}
Return

#e::
gosub,NukeLobbies
Return

NukeLobbies:
SetTitleMatchMode, 2
GroupAdd, TLobbies, Lobby ahk_class PokerStarsTableFrameClass,,, PokerStars Lobby
GroupClose, TLobbies, A
Return

#H::
WinHide, %thisahk%
return

#S::
WinShow, %thisahk%
return


Format2Digits(_val) {
_val :=Round(_val) + 100
StringRight _val, _val, 2
Return _val
}

Format3Digits(_val) {
_val :=Round(_val) + 1000
StringRight _val, _val, 3
StringTrimRight, FirstZ, _val, 2
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
StringTrimRight, FirstZ, _val, 1
If FirstZ=0
{
StringTrimLeft, _val, _val, 1
}
Return _val
}

LobbyRestore:
WinGet, lobbyid, id, PokerStars Lobby
WinShow, ahk_id%lobbyid%
WinMove, ahk_id%lobbyid%,,0,0
return

RegSNGexec(id, times, scrldwn) {
global RegSofar
global Register
global OpenTables
global KeepOpen
global TotalLimit
global RegButton
global AutoIfFull
global list,lobbytitle,lobbyid,PS7list1,PS7list2

Loop %times%
{
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
ControlSend, %list%, {Blind}{NumpadUp 20}, ahk_id%id%
If (OpenTables >= KeepOpen)
Exit
If (OpenTables >= TotalLimit)
Exit
ClickdirectionCount=0
direction=0
GuiControl, , Status, Status: Registering ;TEST
Loop 16
{
If (Register=0)
{
GuiControl, , Status, Status: Idle ;TEST
Exit
}
ControlGet, v, Visible, , %regButton%, ahk_id%id%
If (v = 0)
If (scrldwn!="Off")
{
If (ClickdirectionCount<scrldwn) {
ControlGet,vis,visible,,%PS7list1%,ahk_id%lobbyid%
if vis
list:=PS7list1
else
list:=PS7list2
If (direction=0) {
ControlSend, %list%, {Blind}{NumpadDown}, ahk_id%id%
} Else {
ControlSend, %list%, {Blind}{NumpadUp}, ahk_id%id%
}
ClickdirectionCount:=ClickdirectionCount+1
} Else {
If (direction=0) {
direction:=1
} Else {
direction:=0
}
ClickdirectionCount:=0
}
Sleep,1000
}
If ( v = 1 ) {
wingetclass,class,A
SetTitleMatchMode, 2
ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
;ControlSend, %regButton%, {Blind}{Space}, ahk_id%id%
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
controlget,vis,visible,,%autobtn%,ahk_id%regid%
if vis
{
 If (AutoIfFull = 1)
 {
 Control,Check,,%autobtn%, ahk_id%regid%
 ;ControlSend, %autobtn%, {Blind}{Space}, ahk_id%regid%
 Sleep, 30
 }
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%regid%
}
}
sleep,30
WinWait, Tournament Registration ahk_class #32770,,1
{
WinGet, regid, id, Tournament Registration ahk_class #32770
controlget,vis,visible,,Button2,ahk_id%regid%
controlget,vis1,visible,,PokerStarsButtonClass3,ahk_id%regid%
if !vis && !vis1
winclose,ahk_id%regid%
;ControlSend, PokerStarsButtonClass1, {Blind}{Space}, ahk_id%regid%
}
GuiControl, , Status, Status: Waiting ;TEST
;if class=PokerStarsTableFrameClass
;winactivate,ahk_class PokerStarsTableFrameClass
Break
}
}
}
}
return

AutoReg:
AutoReg()
return

AutoReg()
{
global AutoIfFull
setwindelay,-1
settitlematchmode,2
IfWinExist, Tournament Registration ahk_class #32770
{
wingettext,text,
if instr(text,"Confirm")>0
{
autobtn=PokerStarsButtonClass3
okbtn=PokerStarsButtonClass2
}
else
{
autobtn=Button2
okbtn=PokerStarsButtonClass1
}
winget,id,id,
controlget,vis,visible,,%autobtn%,ahk_id%id%
if vis
{
If (AutoIfFull = 1)
{
ControlFocus, %autobtn%, ahk_id%id%
Sleep, -1
ControlSend, %autobtn%, {Blind}{Space}, ahk_id%id%
Sleep, 30
}
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
}
else
ControlSend, %okbtn%, {Blind}{Space}, ahk_id%id%
;winclose,ahk_id%id%
}
}
return

CountTourneys(mode=0) {
global logfile,RegSofar,regtourneys,tables,Targetnum
If (SetReg=1)
Return 0
log := CheckFile(logfile,mode)
Loop, Parse, log, `n,
{
tnumber=
if (instr(A_loopField,"RT add")>0)
{
 tnumber:=RegExReplace(A_loopField, "RT add ", "")
 if instr(tnumber,A_space)>0
 StringLeft, tnumber, tnumber, instr(tnumber,A_space)-1
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if !(instr(tables,tnumber)>0) ;&& ((Targetnum=0) || ((Targetnum>0) && (tnumber>=(Targetnum-50000)) && (tnumber<(Targetnum+150000))))
 listadd(tables,tnumber)
}
else
If (instr(A_loopField,"RT remove")>0)
{
 stringtrimleft,tnumber,A_loopField,instr(A_loopField,A_space,"",0)
 tnumber:=RegExReplace(tnumber, "[`n,`r]", "")
 tnumber:=Floor(tnumber)
 if instr(tables,tnumber)>0
 listDelItem(tables,tnumber)
}
}
log=
tcount:=0
Loop, Parse, tables, -,
{
if A_Loopfield is number
{
tcount++
if !(instr(regtourneys,A_Loopfield)>0)
{
listadd(regtourneys,A_Loopfield)
if mode=0
RegSofar++
}
}
}

return tcount
}

numcheck:
winget,nlist,list,Table ahk_class PokerStarsTableFrameClass
loop %nlist%
{
id:=nlist%A_index%
wingettitle,title,ahk_id%id%
stringtrimleft,num,title,instr(title,A_space,"",instr(title,"Tournament"))
stringleft,num,num,instr(num,A_space)-1
if num is not number
num:=0
if (num>targetnum)
targetnum:=num
StringReplace,targetnum,targetnum,A_space,,All
StringReplace,targetnum,targetnum,`n,,All
StringReplace,targetnum,targetnum,`r,,All
}
return

Ansi2Unicode(sString, CP = 0)
{
	  nSize := DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", 0
		, "int",  0)

	VarSetCapacity(wString, nSize * 2)

	DllCall("MultiByteToWideChar"
		, "Uint", CP
		, "Uint", 0
		, "Uint", &sString
		, "int",  -1
		, "Uint", &wString
		, "int",  nSize)
return wstring
}

ReplaceByte( hayStackAddr, hayStackSize, ByteFrom=0, ByteTo=1, StartOffset=0, NumReps=-1)
{	Static fun
	IfEqual,fun,
	{
		h=
		( LTrim join
			5589E553515256579C8B4D0C8B451831D229C17E25837D1C00741F8B7D0801C70FB6451
			00FB65D14FCF2AE750D885FFF42FF4D1C740409C975EF9D89D05F5E5A595BC9C21800
		)
		VarSetCapacity(fun,StrLen(h)//2)
		Loop % StrLen(h)//2
			NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
	}
	Return DllCall(&fun
		, "uint",haystackAddr, "uint",hayStackSize, "short",ByteFrom, "short",ByteTo
		, "uint",StartOffset, "int",NumReps)
}

CheckFile(File, mode=0) {
   ; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
   Static CF := ""   ; Current File
   Static FP := 0    ; File Pointer
   Static OPEN_EXISTING := 3
   Static GENERIC_READ := 0x80000000
   Static FILE_SHARE_READ := 1
   Static FILE_SHARE_WRITE := 2
   Static FILE_SHARE_DELETE := 4
   Static FILE_BEGIN := 0
   BatchLines := A_BatchLines
   SetBatchLines, -1
   If (File != CF) {
      CF := File
      FP := 0
   }
   hFile := DllCall("CreateFile"
                  , "Str",  File
                  , "Uint", GENERIC_READ
                  , "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
                  , "Uint", 0
                  , "Uint", OPEN_EXISTING
                  , "Uint", 0
                  , "Uint", 0)
   If (!hFile) {
      CF := ""
      FP := 0
      SetBatchLines, %BatchLines%
      Return False
   }
   DllCall("GetFileSizeEx"
         , "Uint",   hFile
         , "Int64P", nSize)
   if mode=1
   FP:=1
   If (FP = 0 Or nSize <= FP) {
      FP := nSize
      SetBatchLines, %BatchLines%
      DllCall("CloseHandle", "Uint", hFile) ; close file
     Return False
   }
   DllCall("SetFilePointerEx"
         , "Uint",  hFile
         , "Int64", FP
         , "Uint",  0
         , "Uint",  FILE_BEGIN)
   VarSetCapacity(Tail, Length := nSize - FP, 0)
   DllCall("ReadFile"
         , "Uint",  hFile
         , "Str",   Tail
         , "Uint",  Length
         , "UintP", Length
         , "Uint",  0)
   DllCall("CloseHandle", "Uint", hFile)
   FP := nSize
   if A_IsUnicode
   {
   tail:=Ansi2Unicode(tail)
   Length:=strlen(tail)
   }
   ReplaceByte(&Tail, Length)
   VarSetCapacity(Tail, -1)
   SetBatchLines, %BatchLines%
   Return Tail
}

listAdd( byRef list, item, del="-" ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}

listDelItem( byRef list, item, del="-") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %del%%item%%del%,%del%,All
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}

lobbyStars() {
SetTitleMatchMode 2
WinGet, id, id, PokerStars Lobby ahk_class #32770,,Tournament
Return id
}

exitsub:
if Targetnum>0
IniWrite, %Targetnum%, %thisahk%.ini, Settings, Targetnum
ifwinnotexist,ahk_class PokerStarsTableFrameClass
filedelete,%logfile%
exitapp
return
the script does not work
AHK script:Stars Filtered SNG Opener Quote
03-07-2020 , 03:32 PM
futxxx, works fine for me for the latest PS update. The script works for the "Game view" only, compile it to .exe using rightclick menu, run .exe file as admin.
AHK script:Stars Filtered SNG Opener Quote
03-07-2020 , 08:21 PM
Quote:
Originally Posted by Max1mums
futxxx, works fine for me for the latest PS update. The script works for the "Game view" only, compile it to .exe using rightclick menu, run .exe file as admin.
Tournament scrolling does not work. He is registered only in the first tournament. The settings in the program are all set correctly. If I select the second tournament with the mouse, registration will occur. I can’t understand why this is not an automatic descent through the list of tournaments. sorry for my bad english.
AHK script:Stars Filtered SNG Opener Quote
03-08-2020 , 05:33 AM
Set "Times to scroll down" on the Advanced tab to the number you want, check "Always start from top of lobby" checkbox, select "Game view" in the PokerStars client, run the script as admin.
AHK script:Stars Filtered SNG Opener Quote
03-30-2020 , 06:24 AM
Hello everyone!
After stars has forbidden the registration on colour tags, popular programms for autoregistration like sharkyscanner for example became super expenive for what they do (just reg everything in the lobby). I ve been trying to find something cheapper with no luck so far, when i stumbled onto this thread. So basically this programm is still working? How do i test it? i dont see download link in first post or anyting explaining how to actually try it, can you maybe clear that up? Also, is it possible to use it while playing 2 stars rooms at the same time?
Also, any other soft (including paid) examples that can autoreg stars sngs would be apreciated
Thank you!
AHK script:Stars Filtered SNG Opener Quote
03-30-2020 , 03:31 PM
The script works fine for the latest PokerStars client version. Install Autohotkey http://www.autohotkey.com/download/A...05_Install.exe ,save code from post 1188 of this thread as .ahk file and run it. Compile .ahk file to .exe using rightclick menu and run .exe file you get as admin in case the script doesn't press "Play Now" button.
AHK script:Stars Filtered SNG Opener Quote
04-03-2020 , 12:49 PM
THx for the reply!
OK i get now, its kindanot a programm but a script.
What about two PS rooms at the same time, which lobby will it prioritize, can it be controlled, can it do both at the same time?
AHK script:Stars Filtered SNG Opener Quote
04-03-2020 , 03:28 PM
People told me it was switching there and forth between lobbies, but i can't test that situation out.
AHK script:Stars Filtered SNG Opener Quote
04-03-2020 , 11:41 PM
hello max1munss, script working fine to me untill last update, i did what u told and its solve a little, the only problem still is a pop up when starting, its say "Pokerstars.log.0 file path is probably incorrect, recheck the configuration" after this popup, script stop counting how many games i played on my session, and if i put to keep 20 tables, sometimes it opens 23 tables. need some help here. thanks for all
AHK script:Stars Filtered SNG Opener Quote
04-04-2020 , 04:47 AM
Set Pokerstars.log.0 path manually at the script beginning instead of logfile:= pspath . "pokerstars.log.0", example is shown in eg: line.
AHK script:Stars Filtered SNG Opener Quote

      
m