;~ Script: Table Cycler
;~ Author: Msim
;~ Cycle tables with up/down arrows, up will cycle to the top, down to the bottom. This hotkeys can easily be changed on the bottom of script.
SetTitleMatchMode regex ; lets you put any string that exists in title, to identify tables
SetWinDelay, 10
activeindex := 0
nexttocycle := 0
prevtocycle := 0
tabletitleregex = Play Money ; Used to identify table
casinotitle = Pokerstars Lobby ; used to avoid casino window
GroupAdd, Tables, %tabletitleregex%,,,%casinotitle%
opened := Object()
listgd :=
Loop
{
Sleep, 100
WinGet,listgd,list, %tabletitleregex%,,%casinotitle%
if listgd <> 0
{
if opened.GetCapacity() > 1
{
for index, element in opened
{
if check_pseudo(listgd, element) <> 1
{
RemovedValue := opened.Remove(index)
}
}
}
loop %listgd%
{
VarID := listgd%A_index%
If check_array(opened, VarID) = 0
{
opened.Insert(VarID)
}
}
}
}
check_array(array, winid)
{
for ind, ele in array
{
If ele = %winid%
{
return 1
}
}
return 0
}
check_pseudo(pseudoloop, winid)
{
loop %pseudoloop%
{
VarID := listgd%A_index%
if VarID = %winid%
{
return 1
}
}
return 0
}
get_active_index(array, winid)
{
for ind, ele in array
{
if ele = %winid%
{
global activeindex := A_Index
}
}
}
return
#IfWinActive, ahk_group Tables
Down::
if opened.GetCapacity() > 1
{
WinGet, active_id, ID, A
get_active_index(opened, active_id)
prevtocycle := global activeindex-1
idwin := opened[prevtocycle]
WinActivate, ahk_id %idwin%
}
return
Up::
if opened.GetCapacity() > 1
{
WinGet, active_id, ID, A
get_active_index(opened, active_id)
nexttocycle := global activeindex+1
idwin := opened[nexttocycle]
WinActivate, ahk_id %idwin%
}
return