Above version had some bugs which I fixed:
- it displayed "---/---" instead of "0/0" on startup if no tables detected
- it didn't count existing tables correctly on startup
- totals would disappear when exceeding 99
- update interval was too slow
Code:
#SingleInstance, force
#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 2
;============================================= CONFIG SECTION ===============================================
GuiPos = x1925 y5 ;position of GUI on screen
LoopInterval = 100 ;GUI's update interval in msec (1000 = 1sec)
CurrentLimit = 16 ;desired table limit (current)
TotalLimit = 100 ;desired table limit (total)
SumColor1 = 0000FF ;current table limit not reached
SumColor2 = 33FF33 ;current table limit reached
SoundBust = C:\Program Files (x86)\PokerStars\snd\bust.wav ;sound if table closes
SoundTotal = C:\Program Files (x86)\PokerStars\snd\snd12.wav ;sound if TotalLimit reached
SoundInterval = 10 ;SoundTotal replays after N additional tables
Stake1 = $2.50 ;eg. $2.50 or $0.25/$0.50
Color1 = FF66FF ;color for above stake
Stake2 = $3.50+R ;eg. $3.50+R or $0.50/$1
Color2 = 00AAFF ;color for above stake
Stake3 = $8.00 ;eg. $8.00 or $5/$10
Color3 = 9A2EFE ;color for above stake
;============================================================================================================
Gui -MaximizeBox -Resize -MinimizeBox +AlwaysOnTop +ToolWindow
Gui, Show, %GuiPos%
Gui, Show, W180 H120, TableCount
Gui, Color, 000000
Gui, Margin, 4, 2
Gui, Font, s18 c%SumColor1%, Verdana
Gui, Add, Text, vSum Center, 00000 / 00000
Gui, Margin,, -4
Gui, Font, s18 c%Color1%, Verdana
Gui, Add, Text, vStake1 Center, 00000 / 00000
Gui, Margin,, -12
Gui, Font, s18 c%Color2%, Verdana
Gui, Add, Text, vStake2 Center, 00000 / 00000
Gui, Margin,, -12
Gui, Font, s18 c%Color3%, Verdana
Gui, Add, Text, vStake3 Center, 00000 / 00000
r0 = 0
r1 = 0
r2 = 0
r3 = 0
t1 = 0
t2 = 0
t3 = 0
Loop
{
v1 := 0
v2 := 0
v3 := 0
c1 := 0
c2 := 0
c3 := 0
WinGet, v1, count, %Stake1% ahk_class PokerStarsTableFrameClass
WinGet, v2, count, %Stake2% ahk_class PokerStarsTableFrameClass
WinGet, v3, count, %Stake3% ahk_class PokerStarsTableFrameClass
Loop, %v1%
{
c1 += 1
}
Loop, %v2%
{
c2 += 1
}
Loop, %v3%
{
c3 += 1
}
if (t1 = 0)
{
GuiControl,, Stake1, 0 / 0
r1 = 0
}
if (t2 = 0)
{
GuiControl,, Stake2, 0 / 0
r2 = 0
}
if (t3 = 0)
{
GuiControl,, Stake3, 0 / 0
r3 = 0
}
if (t1 < c1)
{
t1 := c1 - 1
}
if (t2 < c2)
{
t2 := c2 - 1
}
if (t3 < c3)
{
t3 := c3 - 1
}
if (c1 > r1)
{
t1++
GuiControl,, Stake1, %c1% / %t1%
r1 = %c1%
}
else, if (c1 < r1)
{
GuiControl,, Stake1, %c1% / %t1%
r1 = %c1%
}
if (c2 > r2)
{
t2++
GuiControl,, Stake2, %c2% / %t2%
r2 = %c2%
}
else, if (c2 < r2)
{
GuiControl,, Stake2, %c2% / %t2%
r2 = %c2%
}
if (c3 > r3)
{
t3++
GuiControl,, Stake3, %c3% / %t3%
r3 = %c3%
}
else, if (c3 < r3)
{
GuiControl,, Stake3, %c3% / %t3%
r3 = %c3%
}
c0 := c1 + c2 + c3
t0 := t1 + t2 + t3
GuiControl,, Sum, %c0% / %t0%
if (c0 < r0)
{
GuiControl,, Sum, %c0% / %t0%
SoundPlay, %SoundBust%
}
r0 = %c0%
if (c0 < CurrentLimit)
{
Gui, Font, s22 c%SumColor1%, Verdana
GuiControl, Font, Sum
}
else, if (c0 >= CurrentLimit)
{
Gui, Font, s22 c%SumColor2%, Verdana
GuiControl, Font, Sum
}
if (t0 = TotalLimit)
{
GuiControl,, Sum, %c0% / %t0%
SoundPlay, %SoundTotal%
TotalLimit := t0 + SoundInterval
}
Sleep %LoopInterval%
}
return
^Q::ExitApp
GuiClose:
ExitApp