Open Side Menu Go to the Top
Register
Table Counter AHK for PokerStars Table Counter AHK for PokerStars

11-08-2013 , 02:04 PM
For 9mans you should be ready to go with those changes. However, you might want to delete dispensable counters and make some other changes to the GUI. I suck at explaining things tbh but I'll give it a try with some general advice on customizing the script:

Firstly, open a SNG (or cash*) table and view its exact title with window spy. Turbos generally include the term Turbo in the title, which makes it easy to count those tables with a single WinGet command. Here's an example for 9man SNG:

The title:
Code:
$3.50 NL Hold'em [Turbo]  - Blinds $300/$600 Ante $50
Anything past the term [Turbo] is meaningless, except the ahk_class. Therefore, this is the relevant WinGet command:
Code:
WinGet, v7, count, %Stake7% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
* For cash tables and those whose title doesn't begin with the stake, you'll have to change the SetTitleMatchMode value (line 4) from 1 to 2.

You'll see that right after the term [Turbo] there are random numbers of blank spaces, ranging from 1 to 5 (the max I've counted but there might be even more). This is where it becomes tricky for regspeed tourneys. For regspeeds, a single WinGet command won't suffice, although theoretically it should be by making use of the ExcludeTitle option. However, I never got that to work, so my workaround is to use 5 different WinGet commands, one for each number of blanks, as shown in this example:

Some titles:
Code:
$3.50 NL Hold'em - Blinds $75/$150
$3.50 NL Hold'em   - Blinds $100/$200 Ante $25
$3.50 NL Hold'em    - Blinds $100/$200
Again, anything past the term Blinds (actually, past the "-" symbol) is meaningless for our purpose.

The relevant code to sum up the number of regspeeds within one variable (v4):
Code:
    WinGet, v41,count, %Stake4% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v42,count, %Stake4% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v43,count, %Stake4% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v44,count, %Stake4% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v45,count, %Stake4% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v4 := v41 + v42 + v43 + v44 + v45
Make sure you set each variable to zero prior to calling the WinGet command:
Code:
v4 := 0
    v41 := 0
    v42 := 0
    v43 := 0
    v44 := 0
    v45 := 0
Once you've got that taken care of, open some games as observer and test the script. The best way is to do so one by one, ie. open a game, close it, open the next, etc. If it counts as many stakes as you wish without flaws (ie. it doesn't miss nor double-count games), the next step is to remove all the remaining counters you don't need. It will suffice to remove (or comment) the relevant bit in the GUI section:
Code:
;Gui, Font, s16 c%Color8%, Verdana			
;Gui, Add, Text, x20 y418 vStake8 Center, 00000 / 00000
I'm not sure about this without testing but maybe you also have to edit those 2 lines in the TOTALS section according to the number of counters you want to have, ie. if you want only 2 stakes counted, remove the blue parts here:
Code:
    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9
Lastly, if you deleted some counters (eg. after reducing the script to count only two stakes) there's a bit of trial and error involved for moving the clock and stuff up, as well as for the heigth of the GUI window. You'll find all the coords within the GUI section. The "H" and "y" coords are the relevant ones.

I hope this guide helps a bit with customizing the script yourself; however, if you struggle, feel free to PM me with details about the games you want to play and I'm happy to assist.

FWIW, this site should help with understanding commands I didn't mention: http://www.autohotkey.com/docs/commands.htm

Last edited by Baobhan-Sith; 11-08-2013 at 02:34 PM.
Table Counter AHK for PokerStars Quote
11-09-2013 , 02:20 PM
lowskill,

since I really disliked the fugly layout of your version, how about this?



Spoiler:
Code:
#SingleInstance, force
;#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1					;1=start 2=contain 3=exact match

;======================================================= CONFIG SECTION =========================================================

SoundBust = C:\Program Files (x86)\PokerStars\snd\bust.wav			;sound if table closes
SoundAchieve = C:\Program Files (x86)\PokerStars\snd\ding.wav		;sound if TotalLimit reached

GuiPos = x4 y4						;position of GUI on screen 
										;move the window where you want it to be, then use WindowSpy to grab its coords
										
LoopInterval = 100						;counter update interval in msec (1000 = 1sec, default = 100)

Stake1 = $15.00							
Stake2 = $30.00							
Stake3 = $60.00							
Stake4 = $15.00							
Stake5 = $30.00							
Stake6 = $60.00							
Stake7 = $15.00							
Stake8 = $30.00							
Stake9 = $60.00							

Stake1VPP = 6.66					
Stake2VPP = 13.31						
Stake3VPP = 26.62					
Stake4VPP = 7.15											
Stake5VPP = 14.30					
Stake6VPP = 28.60						
Stake7VPP = 6.11					
Stake8VPP = 12.21											
Stake9VPP = 24.42				

Color1 = FF0000 						;color for table counter - stake1 
Color2 = FF0000							;color for table counter - stake2 
Color3 = FF0000							;color for table counter - stake3 
Color4 = 00FF00 						;color for table counter - stake4 
Color5 = 00FF00 						;color for table counter - stake5
Color6 = 00FF00							;color for table counter - stake6 
Color7 = 0000FF							;color for table counter - stake7 
Color8 = 0000FF 						;color for table counter - stake8 
Color9 = 0000FF 						;color for table counter - stake9

CurrentLimit = 14						;desired table limit (current)
TotalLimit = 100						;desired table limit (session)
SoundInterval = 25						;SoundAchieve replays after "TotalLimit" + N tables
SessionTimeLimit = 6:00					;desired session time limit (h:mm)
MaxABI = 30								;maximum desired ABI (current & session)
MaxInvest = 3000						;maximum desired investment (session)

LimitColor = 33FF33						;color of 'SessionTime' and 'TotalTables' counters after reaching their set limits 
ClockColorBreak = FF0000				;clock color indicating sync tourney break (999999 to disable this option)

;----------------------------------------------------------
SlotA1x := 304							;F1
SlotA1y := 0

SlotA2x := 1112							;F2
SlotA2y := 0

SlotA3x := 1920							;F3
SlotA3y := 0

SlotA4x := 2728							;F4
SlotA4y := 0
;----------------------------------------------------------
SlotC1x := 304							;F5
SlotC1y := 299

SlotC2x := 1112							;F6
SlotC2y := 299

SlotC3x := 1920							;F7
SlotC3y := 299

SlotC4x := 2728							;F8
SlotC4y := 299
;----------------------------------------------------------
SlotB1x := 304							;F9
SlotB1y := 584

SlotB2x := 1112							;F10
SlotB2y := 584

SlotB3x := 1920							;F11
SlotB3y := 584

SlotB4x := 2728							;F12
SlotB4y := 584
;----------------------------------------------------------
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIG HOTKEYS AT BOTTOM OF THE SCRIPT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


;================================================================================================================================
;========================================================= GUI SECTION ==========================================================

Gui -MaximizeBox -Resize +AlwaysOnTop +ToolWindow -MinimizeBox
Gui, Show, W382 H264 %GuiPos%, SessionMan 2.2.1	
Gui, Color, 000000		
;................................................................................................................................
;........................................................... TOP GUI ............................................................
Gui, Font, s10 cCCCCCC, Verdana					
Gui, Add, Text, x38 y10 Center, VPP
Gui, Font, s11 c999999, Verdana					
Gui, Add, Text, x17 y24 vVPP Center, 0000.00 

Gui, Font, s10 cCCCCCC, Verdana					
Gui, Add, Text, x300 y10 Center, Duration
Gui, Font, s11 c999999, Verdana					
Gui, Add, Text, x305 y24 vSessionTime Center, 00:00	
						
Gui, Font, s22 cCCCCCC, Verdana					
Gui, Add, Text, x111 y6 vTotalTables Center, 000 / 0000	

;................................................................................................................................								
Gui, Font, s10 cCCCCCC, Verdana					
Gui, Add, Text, x6 y50 Center, ---- 6-max ----------- 9-max ---------- 9-max (t) ---		
;................................................................................................................................
;......................................................... CENTER GUI ...........................................................		
;........................................................... STAKE 1 ............................................................
						
Gui, Font, s8 c%Color1%, Verdana				
Gui, Add, Text, x38 y70 vControl1 Center, $000.00
								
Gui, Font, s16 c%Color1%, Verdana				
Gui, Add, Text, x3 y82 vStake1 Center, 000 / 0000		
;........................................................... STAKE 2 ............................................................
								
Gui, Font, s8 c%Color2%, Verdana				
Gui, Add, Text, x38 y114 vControl2 Center, $000.00
								
Gui, Font, s16 c%Color2%, Verdana				
Gui, Add, Text, x3 y126 vStake2 Center, 000 / 0000		
;........................................................... STAKE 3 ............................................................
								
Gui, Font, s8 c%Color3%, Verdana				
Gui, Add, Text, x38 y158 vControl3 Center, $000.00
								
Gui, Font, s16 c%Color3%, Verdana				
Gui, Add, Text, x3 y170 vStake3 Center, 000 / 0000		
;................................................................................................................................		
;........................................................... STAKE 4 ............................................................
								
Gui, Font, s8 c%Color4%, Verdana				
Gui, Add, Text, x166 y70 vControl4 Center, $000.00
								
Gui, Font, s16 c%Color4%, Verdana			
Gui, Add, Text, x131 y82 vStake4 Center, 000 / 0000			
;........................................................... STAKE 5 ............................................................
								
Gui, Font, s8 c%Color5%, Verdana				
Gui, Add, Text, x166 y114 vControl5 Center, $000.00
								
Gui, Font, s16 c%Color5%, Verdana			
Gui, Add, Text, x131 y126 vStake5 Center, 000 / 0000		
;........................................................... STAKE 6 ............................................................
								
Gui, Font, s8 c%Color6%, Verdana				
Gui, Add, Text, x166 y158 vControl6 Center, $000.00
								
Gui, Font, s16 c%Color6%, Verdana				
Gui, Add, Text, x132 y170 vStake6 Center, 000 / 0000		
;................................................................................................................................				
;........................................................... STAKE 7 ............................................................
								
Gui, Font, s8 c%Color7%, Verdana				
Gui, Add, Text, x294 y70 vControl7 Center, $000.00
								
Gui, Font, s16 c%Color7%, Verdana				
Gui, Add, Text, x259 y82 vStake7 Center, 000 / 0000		
;........................................................... STAKE 8 ............................................................
								
Gui, Font, s8 c%Color8%, Verdana				
Gui, Add, Text, x294 y114 vControl8 Center, $000.00
								
Gui, Font, s16 c%Color8%, Verdana			
Gui, Add, Text, x259 y126 vStake8 Center, 000 / 0000			
;........................................................... STAKE 9 ............................................................
								
Gui, Font, s8 c%Color9%, Verdana				
Gui, Add, Text, x294 y158 vControl9 Center, $000.00
								
Gui, Font, s16 c%Color9%, Verdana			
Gui, Add, Text, x259 y170 vStake9 Center, 000 / 0000	
;................................................................................................................................
;......................................................... BOTTOM GUI ...........................................................
	
Gui, Font, s10 cCCCCCC, Verdana					
Gui, Add, Text, x6 y203 Center, -------- ABI / Invest ------------------- Time -------

Gui, Font, s11 c999999, Verdana					
Gui, Add, Text, x16 y220 vDollars Center, $0000.00 / $0000.00 (C)	
								
Gui, Font, s11 c999999, Verdana					
Gui, Add, Text, x16 y240 vTotalABI Center, $0000.00 / $0000.00 (T)

Gui, Font, s20 c999999, Verdana					
Gui, Add, Text, x265 y220 vClock Center, 00000		

;================================================================================================================================
;================================================================================================================================	
GuiControl,, Control1, %Stake1%
GuiControl,, Control2, %Stake2%
GuiControl,, Control3, %Stake3%
GuiControl,, Control4, %Stake4%
GuiControl,, Control5, %Stake5%
GuiControl,, Control6, %Stake6%
GuiControl,, Control7, %Stake7%
GuiControl,, Control8, %Stake8%
GuiControl,, Control9, %Stake9%
;.................................................................................................................................

Buyin_Total := 0.00
Buyin_Total_TournamentCounter := 0

H = 0
M1 = 0
M2 = -1

r0 = 0
r1 = 0
r2 = 0
r3 = 0
r4 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r9 = 0

t1 = 0
t2 = 0
t3 = 0
t4 = 0
t5 = 0
t6 = 0
t7 = 0
t8 = 0
t9 = 0

VPP1 = 0
VPP2 = 0
VPP3 = 0
VPP4 = 0
VPP5 = 0
VPP6 = 0
VPP7 = 0
VPP8 = 0
VPP9 = 0

P = 0

;................................................................................................................................


Loop
{
;------------------------------------------------------------ STAKE 1 -----------------------------------------------------------
  
    v1 := 0
    c1 := 0

    WinGet, v1, count, %Stake1% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v1%
    	{	
    	c1 += 1
    	}

    if (t1 = 0)
		{
		GuiControl,, Stake1, 0 / 0
    	r1 = 0
		}

    if (t1 < c1)
		{
		t1 := c1 - 1
		}

    if (c1 > r1)
    	{
		t1 += 1
    	GuiControl,, Stake1, %c1% / %t1%
    	r1 = %c1%
    	}

	else, if (c1 < r1)
    	{
		GuiControl,, Stake1, %c1% / %t1%
      	r1 = %c1%
    	}
;----------------------------------------------------------- STAKE 2 ------------------------------------------------------------

    v2 := 0
    c2 := 0

    WinGet, v2, count, %Stake2% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v2%
    	{	
    	c2 += 1
    	}

    if (t2 = 0)
		{
		GuiControl,, Stake2, 0 / 0
    	r2 = 0
		}

    if (t2 < c2)
		{
		t2 := c2 - 1
		}

    if (c2 > r2)
    	{
		t2++
    	GuiControl,, Stake2, %c2% / %t2%
    	r2 = %c2%
    	}

	else, if (c2 < r2)
    	{
		GuiControl,, Stake2, %c2% / %t2%
      	r2 = %c2%
    	}
;----------------------------------------------------------- STAKE 3 ------------------------------------------------------------

    v3 := 0
    c3 := 0

    WinGet, v3, count, %Stake3% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v3%
    	{	
    	c3 += 1
    	}

    if (t3 = 0)
		{
		GuiControl,, Stake3, 0 / 0
    	r3 = 0
		}

    if (t3 < c3)
		{
		t3 := c3 - 1
		}

    if (c3 > r3)
    	{
		t3++
    	GuiControl,, Stake3, %c3% / %t3%
     	r3 = %c3%
    	}

	else, if (c3 < r3)
    	{
		GuiControl,, Stake3, %c3% / %t3%
      	r3 = %c3%
    	}
;----------------------------------------------------------- STAKE 4 ------------------------------------------------------------

    v4 := 0
    v41 := 0
    v42 := 0
    v43 := 0
    v44 := 0
    v45 := 0
    c4 := 0

    WinGet, v41,count, %Stake4% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v42,count, %Stake4% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v43,count, %Stake4% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v44,count, %Stake4% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v45,count, %Stake4% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v4 := v41 + v42 + v43 + v44 + v45

    Loop, %v4%
    	{	
    	c4 += 1
    	}

    if (t4 = 0)
		{
		GuiControl,, Stake4, 0 / 0
    	r4 = 0
		}

    if (t4 < c4)
		{
		t4 := c4 - 1
		}

    if (c4 > r4)
    	{
		t4 += 1
    	GuiControl,, Stake4, %c4% / %t4%
    	 r4 = %c4%
    	}

	else, if (c4 < r4)
    	{
		GuiControl,, Stake4, %c4% / %t4%
      	r4 = %c4%
    	}
;----------------------------------------------------------- STAKE 5 ------------------------------------------------------------

    v5 := 0
    v51 := 0
    v52 := 0
    v53 := 0
    v54 := 0
    v55 := 0
    c5 := 0

    WinGet, v51,count, %Stake5% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v52,count, %Stake5% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v53,count, %Stake5% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v54,count, %Stake5% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v55,count, %Stake5% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v5 := v51 + v52 + v53 + v54 + v55

    Loop, %v5%
    	{	
    	c5 += 1
    	}

    if (t5 = 0)
		{
		GuiControl,, Stake5, 0 / 0
    	r5 = 0
		}

    if (t5 < c5)
		{
		t5 := c5 - 1
		}

    if (c5 > r5)
    	{
		t5++
    	GuiControl,, Stake5, %c5% / %t5%
    	r5 = %c5%
    	}

	else, if (c5 < r5)
    	{
		GuiControl,, Stake5, %c5% / %t5%
      	r5 = %c5%
    	}
;------------------------------------------------------------ STAKE 6 -----------------------------------------------------------
  
    v6 := 0
    v61 := 0
    v62 := 0
    v63 := 0
    v64 := 0
    v65 := 0
    c6 := 0

    WinGet, v61,count, %Stake6% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v62,count, %Stake6% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v63,count, %Stake6% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v64,count, %Stake6% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v65,count, %Stake6% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v6 := v61 + v62 + v63 + v64 + v65

    Loop, %v6%
    	{	
    	c6 += 1
    	}

    if (t6 = 0)
		{
		GuiControl,, Stake6, 0 / 0
    	r6 = 0
		}

    if (t6 < c6)
		{
		t6 := c6 - 1
		}

    if (c6 > r6)
    	{
		t6++
    	GuiControl,, Stake6, %c6% / %t6%
    	r6 = %c6%
    	}

	else, if (c6 < r6)
    	{
		GuiControl,, Stake6, %c6% / %t6%
      	r6 = %c6%
    	}
;----------------------------------------------------------- STAKE 7 ------------------------------------------------------------

    v7 := 0
    c7 := 0

    WinGet, v7, count, %Stake7% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass

    Loop, %v7%
    	{	
    	c7 += 1
    	}

    if (t7 = 0)
		{
		GuiControl,, Stake7, 0 / 0
    	r7 = 0
		}

    if (t7 < c7)
		{
		t7 := c7 - 1
		}

    if (c7 > r7)
    	{
		t7++
    	GuiControl,, Stake7, %c7% / %t7%
    	r7 = %c7%
    	}

	else, if (c7 < r7)
    	{
		GuiControl,, Stake7, %c7% / %t7%
      	r7 = %c7%
    	}
;----------------------------------------------------------- STAKE 8 ------------------------------------------------------------

    v8 := 0
    c8 := 0

    WinGet, v8, count, %Stake8% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass

    Loop, %v8%
    	{	
    	c8 += 1
    	}

    if (t8 = 0)
		{
		GuiControl,, Stake8, 0 / 0
    	r8 = 0
		}

    if (t8 < c8)
		{
		t8 := c8 - 1
		}

    if (c8 > r8)
    	{
		t8++
    	GuiControl,, Stake8, %c8% / %t8%
     	r8 = %c8%
    	}

	else, if (c8 < r8)
    	{
		GuiControl,, Stake8, %c8% / %t8%
      	r8 = %c8%
    	}
;----------------------------------------------------------- STAKE 9 ------------------------------------------------------------

    v9 := 0
    c9 := 0

    WinGet, v9,count, %Stake9% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass 

    Loop, %v9%
    	{	
    	c9 += 1
    	}

    if (t9 = 0)
		{
		GuiControl,, Stake9, 0 / 0
    	r9 = 0
		}

    if (t9 < c9)
		{
		t9 := c9 - 1
		}

    if (c9 > r9)
    	{
		t9++
    	GuiControl,, Stake9, %c9% / %t9%
    	 r9 = %c9%
    	}

	else, if (c9 < r9)
    	{
		GuiControl,, Stake9, %c9% / %t9%
      	r9 = %c9%
    	}
;----------------------------------------------------------- TOTALS -------------------------------------------------------------

    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9

    GuiControl,, TotalTables, %c0% / %t0%

    if (c0 < r0)
    	{
		SoundPlay, %SoundBust%
    	}
	
    r0 = %c0%

    if (c0 < CurrentLimit)
		{
		Gui, Font, s22 cCCCCCC, Verdana
		GuiControl, Font, TotalTables
		}

	else, if (c0 >= CurrentLimit)
		{
		Gui, Font, s22 c%LimitColor%, Verdana
		GuiControl, Font, TotalTables
		}

    if (t0 = TotalLimit)
    	{
		SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}
;----------------------------------------------------------- BUYIN --------------------------------------------------------------

Buyin_Dollars:=0.00
Buyin_Dollars_TournamentCounter:=0
Buyin_Euro:=0.00
Buyin_Euro_TournamentCounter:=0
Buyin_Session:=0.00	
Buyin_Session_TournamentCounter:=0
		
Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass

Loop %Ps_Hwnd_List%
{
	Hwnd:=Ps_Hwnd_List%A_index%
	IF  !(Buyin_%hwnd%)
		{
		WingetTitle,Title,Ahk_id%Hwnd%
		IF Instr(Title,"Tournament")
			{
			IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
				{
 				BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
				Buyin_Total:=Round(Buyin_Total+Buyin_%Hwnd%,2)
			    	Buyin_Total_TournamentCounter+=1
				}
			}
		}			
}	

Loop,Parse,Buyin_Hwnd_List,`,,
{
        Hwnd:=A_LoopField      
	IF WinExist("ahk_id" Hwnd)
        	{
		Currency:=Buyin_%hwnd%_Currency	
		Buyin:=Round(Buyin_%hwnd%,2)
		IF (Currency="$")
			{	
			Buyin_Dollars:=Round(Buyin_Dollars+Buyin,2)
		        Buyin_Dollars_TournamentCounter+=1
			}
		Else  IF (Currency="€")
			{		
			Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
			Buyin_Euro_TournamentCounter+=1
			}		
		Buyin_Session:=Round(Buyin_Session+Buyin,2)
		Buyin_Session_TournamentCounter+=1
		}
	Else
                { 
		Temp_list:="," Buyin_Hwnd_List "," 
		StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
	        StringTrimLeft,Temp_list,Temp_list,1
		StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
		}
}	
	
IF (BuyIn_Dollars_Save != BuyIn_Dollars) Or (BuyIn_Euro_Save != BuyIn_Euro) 
{
	BuyIn_Euro_Save:=BuyIn_Euro	
	BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
	BuyIn_Dollars_Save:=BuyIn_Dollars
	BuyIn_Dollars_Avg:=Round(BuyIn_Dollars/BuyIn_Dollars_TournamentCounter,2)
	BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
	BuyIn_Total_Avg:=Round(BuyIn_Total/BuyIn_Total_TournamentCounter,2)
		GuiControl,,Dollars,% "$" Buyin_Dollars_Avg " / $" BuyIn_Dollars " (C)"
		GuiControl,,TotalABI,% "$" BuyIn_Total_Avg " / $" BuyIn_Total " (T)"
		TotalBI := Round(BuyIn_Total-BuyIn_Dollars,2)
		GuiControl,,TotalBI,% "$" TotalBI "" 
}

GetBuyin(Title,byref currency="",Byref BuyinText="")
	{
	Static CurrencyList:="$,€"
 	Haystack:=Substr(Title, Instr(Title,"Sat:")+1) ;This is for satiliets
    Loop,Parse,Currencylist,`,
    	{
        IF ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
          	{          
           	BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
         	Currency=%A_loopField%
          	Buyin:=BuyinText
	  		StringReplace,Buyin,Buyin,%Currency%,, 
			IfInString, Buyin, +R
				{	
          		StringReplace,Buyin,Buyin,+R,, 
				RebuyMulti = 3
				Buyin := Buyin * RebuyMulti					
				}
             
			IF Buyin is not number
				{ 
				Buyin:=0
				currency:=
				buyinText:=    
				}
			Break     
			}
		}
	Return Buyin 
	}
		
;----------------------------------------------------------- VPP --------------------------------------------------------------

	VPP1 := t1 * Stake1VPP
	VPP2 := t2 * Stake2VPP
	VPP3 := t3 * Stake3VPP
	VPP4 := t4 * Stake4VPP
	VPP5 := t5 * Stake5VPP
	VPP6 := t6 * Stake6VPP
	VPP7 := t7 * Stake7VPP
	VPP8 := t8 * Stake8VPP
	VPP9 := t9 * Stake9VPP
	
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)

    GuiControl,, VPP, %VPP% VPP
	
;----------------------------------------------------------- CLOCK --------------------------------------------------------------

FormatTime, Time, %A_Now%, H:mm
GuiControl,, Clock, %Time%
StringTrimLeft, TimeOnly, A_Now, 10
StringTrimRight, Minutes, TimeOnly, 2
IfGreaterOrEqual, Minutes, 55
	{
	Gui, Font, s20 c%ClockColorBreak%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
else
	{
	Gui, Font, s20 c999999
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
;--------------------------------------------------------- DURATION -------------------------------------------------------------

If (Minutes != Var)
	{
	M2 += 1
	GuiControl,, SessionTime, %H%:%M1%%M2%
	Var := Minutes
	}

If (M2 > 9)
	{
	M1 += 1
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}

If (M1 > 5)
	{
	H += 1
	M1 = 0
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}
	
Limit = %H%:%M1%%M2%
If (Limit = SessionTimeLimit)
	{
	Gui, Font, s12 c%LimitColor%, Verdana
	GuiControl, Font, SessionTime
	}
;-------------------------------------------------------- INTERVAL --------------------------------------------------------------

   Sleep %LoopInterval%

}
return

;================================================================================================================================
;================================================================================================================================
;........................................................ HOTKEYS ...............................................................

^F9::				;counter (SessionTime) reset
{
H = 0
M1 = 0
M2 = 0
Gui, Font, s12 c999999, Verdana
GuiControl, Font, SessionTime
GuiControl,, SessionTime, %H%:%M1%%M2%
}
return
;................................................................................................................................

^F10::				;counter (SessionTime) + 1
Var = -1
return
;....................................................... TABLE MOVEMENTS ........................................................

F1::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA1x%, %SlotA1y%
else, return
}
return
;................................................................................................................................

F2::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA2x%, %SlotA2y%
else, return
}
return
;................................................................................................................................

F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA3x%, %SlotA3y%
else, return
}
return
;................................................................................................................................

F4::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA4x%, %SlotA4y%
else, return
}
return
;................................................................................................................................

^F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA0x%, %SlotA0y%
else, return
}
return
;................................................................................................................................

F5::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB1x%, %SlotB1y%
else, return
}
return
;................................................................................................................................

F6::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB2x%, %SlotB2y%
else, return
}
return
;................................................................................................................................

F7::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB3x%, %SlotB3y%
else, return
}
return
;................................................................................................................................

F8::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB4x%, %SlotB4y%
else, return
}
return
;................................................................................................................................

F9::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC1x%, %SlotC1y%
else, return
}
return
;................................................................................................................................

F10::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC2x%, %SlotC2y%
else, return
}
return
;................................................................................................................................

F11::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC3x%, %SlotC3y%
else, return
}
return
;................................................................................................................................

F12::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC4x%, %SlotC4y%
else, return
}
return
;................................................................................................................................

^Q::ExitApp
;................................................................................................................................

!Pause::Pause
;................................................................................................................................

GuiClose:
ExitApp
Table Counter AHK for PokerStars Quote
11-10-2013 , 03:10 PM
Some further design improvements:
  • customizable colors for GUI background, text / labels, and numbers other than table counters
  • option to disable custom table counter colors
  • removed unnecessary ".00" fractions for VPP, stakes, and ABI / Invest
  • added custom color to indicate reaching VPP goal
  • fixed ABI/Invest colors upon reaching their set limits
  • easier customizable counter row captions
  • some minor layout fixes







Spoiler:
Code:
#SingleInstance, force
;#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1					;1=begin with 2=contain 3=exact match

;================================================================================================================================
;==================================================== CONFIG SECTION ============================================================

GuiPos = x4 y4							;position of GUI on screen 
										;move the window where you want it to be, then use WindowSpy to grab its coords

Row1 = 6-max							;row1 caption (leave blank to omit)
Stake1 = $15.00							
Stake2 = $30.00							
Stake3 = $60.00	
Row2 = 9-max							;row2 caption (leave blank to omit)					
Stake4 = $15.00							
Stake5 = $30.00							
Stake6 = $60.00	
Row3 = 9-max[t]							;row3 caption (leave blank to omit)					
Stake7 = $15.00							
Stake8 = $30.00							
Stake9 = $60.00							

Stake1VPP = 6.66					
Stake2VPP = 13.31						
Stake3VPP = 26.62					
Stake4VPP = 7.15											
Stake5VPP = 14.30					
Stake6VPP = 28.60						
Stake7VPP = 6.11					
Stake8VPP = 12.21											
Stake9VPP = 24.42			

GUIColor = acacac						;GUI window background color
TextColor = ffffff						;text/label color
NumColor = 000000						;default color for VPP, Total Tables, Duration, ABI/Invest, and Clock values

CustomStakeColor = 1					;enable = 1, disable = 0 (will use NumColor if disabled)

Color1 = ff0000 						;color for table counter - stake1 
Color2 = ff0000							;color for table counter - stake2 
Color3 = ff0000							;color for table counter - stake3 
Color4 = 00ffff 						;color for table counter - stake4 
Color5 = 00ffff 						;color for table counter - stake5
Color6 = 00ffff							;color for table counter - stake6 
Color7 = 00ff00							;color for table counter - stake7 
Color8 = 00ff00 						;color for table counter - stake8 
Color9 = 00ff00 						;color for table counter - stake9

CurrentLimit = 18						;desired multitabling ratio (current)
TotalLimit = 120						;desired table limit (session)(triggers SoundAchieve)
MaxABI = 30								;maximum desired ABI (session)
MaxInvest = 3000						;maximum desired investment (session)
MinVPP = 5000							;desired VPP per session
SessionTimeLimit = 6:00					;desired session time limit (h:mm)

LimitColor = 33FF33						;color of controls upon reaching their set limits 
ClockColorBreak = FF0000				;clock color indicating sync tourney break (choose same as NumColor to disable this option)

SoundBust = C:\Program Files (x86)\PokerStars\snd\bust.wav			;sound if table closes
SoundAchieve = C:\Program Files (x86)\PokerStars\snd\ding.wav		;sound if TotalLimit reached
SoundInterval = 25						;SoundAchieve replays every N tables upon exceeding TotalLimit 
										
LoopInterval = 100						;counter update interval in msec (1000 = 1sec, default = 100)

;................................................. TABLE MOVEMENT COORDS ........................................................

SlotA1x := 304							;F1
SlotA1y := 0

SlotA2x := 1112							;F2
SlotA2y := 0

SlotA3x := 1920							;F3
SlotA3y := 0

SlotA4x := 2728							;F4
SlotA4y := 0
;...........................................
SlotC1x := 304							;F5
SlotC1y := 299

SlotC2x := 1112							;F6
SlotC2y := 299

SlotC3x := 1920							;F7
SlotC3y := 299

SlotC4x := 2728							;F8
SlotC4y := 299
;...........................................
SlotB1x := 304							;F9
SlotB1y := 584

SlotB2x := 1112							;F10
SlotB2y := 584

SlotB3x := 1920							;F11
SlotB3y := 584

SlotB4x := 2728							;F12
SlotB4y := 584

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIG HOTKEYS AT BOTTOM OF THE SCRIPT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT CONTROL COORDS IN THE GUI SECTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;====================================================== SECTION END =============================================================
;================================================================================================================================

If (CustomStakeColor = 0)
Loop, 9
	{
	C += 1
	Color%C% := NumColor
	}
 
;================================================================================================================================
;====================================================== GUI SECTION =============================================================

Gui -MaximizeBox -Resize +AlwaysOnTop +ToolWindow -MinimizeBox
Gui, Show, W376 H264 %GuiPos%, SessionMan 2.2.2	
Gui, Color, %GUIColor%		
;................................................................................................................................
;......................................................... TOP GUI ..............................................................
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x38 y10 Center, VPP
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x18 y24 vVPP Center, 0000.00 
						
Gui, Font, s8 c%TextColor%, Verdana					
Gui, Add, Text, x154 y0 Center, Total Tables
Gui, Font, s22 c%NumColor%, Verdana					
Gui, Add, Text, x110 y13 vTotalTables Center, 000 / 0000	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x300 y10 Center, Duration
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x305 y24 vSessionTime Center, 00:00	

;................................................................................................................................
;....................................................... SEPARATOR1 .............................................................								
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x39 y50 Center, %Row1%
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x167 y50 Center, %Row2%				
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x287 y50 Center, %Row3%
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x4 y45 Center, ______________________________________________		
;................................................................................................................................
;....................................................... CENTER GUI .............................................................		
;......................................................... STAKE 1 ..............................................................
						
Gui, Font, s8 c%Color1%, Verdana				
Gui, Add, Text, x37 y70 vControl1 Center, $000.00
								
Gui, Font, s16 c%Color1%, Verdana				
Gui, Add, Text, x3 y82 vStake1 Center, 000 / 0000		
;......................................................... STAKE 2 ..............................................................
								
Gui, Font, s8 c%Color2%, Verdana				
Gui, Add, Text, x37 y114 vControl2 Center, $000.00
								
Gui, Font, s16 c%Color2%, Verdana				
Gui, Add, Text, x3 y126 vStake2 Center, 000 / 0000		
;......................................................... STAKE 3 ..............................................................
								
Gui, Font, s8 c%Color3%, Verdana				
Gui, Add, Text, x37 y158 vControl3 Center, $000.00
								
Gui, Font, s16 c%Color3%, Verdana				
Gui, Add, Text, x3 y170 vStake3 Center, 000 / 0000		
;................................................................................................................................		
;......................................................... STAKE 4 ..............................................................
								
Gui, Font, s8 c%Color4%, Verdana				
Gui, Add, Text, x165 y70 vControl4 Center, $000.00
								
Gui, Font, s16 c%Color4%, Verdana			
Gui, Add, Text, x131 y82 vStake4 Center, 000 / 0000			
;......................................................... STAKE 5 ..............................................................
								
Gui, Font, s8 c%Color5%, Verdana				
Gui, Add, Text, x165 y114 vControl5 Center, $000.00
								
Gui, Font, s16 c%Color5%, Verdana			
Gui, Add, Text, x131 y126 vStake5 Center, 000 / 0000		
;......................................................... STAKE 6 ..............................................................
								
Gui, Font, s8 c%Color6%, Verdana				
Gui, Add, Text, x165 y158 vControl6 Center, $000.00
								
Gui, Font, s16 c%Color6%, Verdana				
Gui, Add, Text, x131 y170 vStake6 Center, 000 / 0000		
;................................................................................................................................				
;......................................................... STAKE 7 ..............................................................
								
Gui, Font, s8 c%Color7%, Verdana				
Gui, Add, Text, x293 y70 vControl7 Center, $000.00
								
Gui, Font, s16 c%Color7%, Verdana				
Gui, Add, Text, x259 y82 vStake7 Center, 000 / 0000		
;......................................................... STAKE 8 ..............................................................
								
Gui, Font, s8 c%Color8%, Verdana				
Gui, Add, Text, x293 y114 vControl8 Center, $000.00
								
Gui, Font, s16 c%Color8%, Verdana			
Gui, Add, Text, x259 y126 vStake8 Center, 000 / 0000			
;......................................................... STAKE 9 ..............................................................
								
Gui, Font, s8 c%Color9%, Verdana				
Gui, Add, Text, x293 y158 vControl9 Center, $000.00
								
Gui, Font, s16 c%Color9%, Verdana			
Gui, Add, Text, x259 y170 vStake9 Center, 000 / 0000	
;................................................................................................................................
;....................................................... SEPARATOR2 .............................................................	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x70 y203 Center, ABI/Invest
	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x292 y203 Center, Time

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x4 y197 Center, ______________________________________________
;................................................................................................................................
;....................................................... BOTTOM GUI .............................................................

Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x16 y220 vDollars Center, $0000.00 / $00000.00	
								
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x16 y240 vTotalABI Center, $0000.00 / $00000.00

Gui, Font, s20 c%NumColor%, Verdana					
Gui, Add, Text, x265 y222 vClock Center, 00000		

;====================================================== SECTION END =============================================================
;================================================================================================================================
;====================================================== MAIN SCRIPT =============================================================	
Loop, 9
{
N += 1
IfInString, Stake%N%, .00
	StringReplace, Stake%N%b, Stake%N%, .00,
else, Stake%N%b := Stake%N%	
}

GuiControl,, Control1, %Stake1b%
GuiControl,, Control2, %Stake2b%
GuiControl,, Control3, %Stake3b%
GuiControl,, Control4, %Stake4b%
GuiControl,, Control5, %Stake5b%
GuiControl,, Control6, %Stake6b%
GuiControl,, Control7, %Stake7b%
GuiControl,, Control8, %Stake8b%
GuiControl,, Control9, %Stake9b%

Buyin_Total := 0.00
Buyin_Total_TournamentCounter := 0

H = 0
M1 = 0
M2 = -1

r0 = 0
r1 = 0
r2 = 0
r3 = 0
r4 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r9 = 0

t1 = 0
t2 = 0
t3 = 0
t4 = 0
t5 = 0
t6 = 0
t7 = 0
t8 = 0
t9 = 0

VPP1 = 0
VPP2 = 0
VPP3 = 0
VPP4 = 0
VPP5 = 0
VPP6 = 0
VPP7 = 0
VPP8 = 0
VPP9 = 0

P = 0

Loop
{
;--------------------------------------------------------- STAKE 1 -----------------------------------------------------------
  
    v1 := 0
    c1 := 0

    WinGet, v1, count, %Stake1% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v1%
    	{	
    	c1 += 1
    	}

    if (t1 = 0)
		{
		GuiControl,, Stake1, 0 / 0
    	r1 = 0
		}

    if (t1 < c1)
		{
		t1 := c1 - 1
		}

    if (c1 > r1)
    	{
		t1 += 1
    	GuiControl,, Stake1, %c1% / %t1%
    	r1 = %c1%
    	}

	else, if (c1 < r1)
    	{
		GuiControl,, Stake1, %c1% / %t1%
      	r1 = %c1%
    	}
;--------------------------------------------------------- STAKE 2 ------------------------------------------------------------

    v2 := 0
    c2 := 0

    WinGet, v2, count, %Stake2% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v2%
    	{	
    	c2 += 1
    	}

    if (t2 = 0)
		{
		GuiControl,, Stake2, 0 / 0
    	r2 = 0
		}

    if (t2 < c2)
		{
		t2 := c2 - 1
		}

    if (c2 > r2)
    	{
		t2++
    	GuiControl,, Stake2, %c2% / %t2%
    	r2 = %c2%
    	}

	else, if (c2 < r2)
    	{
		GuiControl,, Stake2, %c2% / %t2%
      	r2 = %c2%
    	}
;--------------------------------------------------------- STAKE 3 ------------------------------------------------------------

    v3 := 0
    c3 := 0

    WinGet, v3, count, %Stake3% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass

    Loop, %v3%
    	{	
    	c3 += 1
    	}

    if (t3 = 0)
		{
		GuiControl,, Stake3, 0 / 0
    	r3 = 0
		}

    if (t3 < c3)
		{
		t3 := c3 - 1
		}

    if (c3 > r3)
    	{
		t3++
    	GuiControl,, Stake3, %c3% / %t3%
     	r3 = %c3%
    	}

	else, if (c3 < r3)
    	{
		GuiControl,, Stake3, %c3% / %t3%
      	r3 = %c3%
    	}
;--------------------------------------------------------- STAKE 4 ------------------------------------------------------------

    v4 := 0
    v41 := 0
    v42 := 0
    v43 := 0
    v44 := 0
    v45 := 0
    c4 := 0

    WinGet, v41,count, %Stake4% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v42,count, %Stake4% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v43,count, %Stake4% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v44,count, %Stake4% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v45,count, %Stake4% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v4 := v41 + v42 + v43 + v44 + v45

    Loop, %v4%
    	{	
    	c4 += 1
    	}

    if (t4 = 0)
		{
		GuiControl,, Stake4, 0 / 0
    	r4 = 0
		}

    if (t4 < c4)
		{
		t4 := c4 - 1
		}

    if (c4 > r4)
    	{
		t4 += 1
    	GuiControl,, Stake4, %c4% / %t4%
    	 r4 = %c4%
    	}

	else, if (c4 < r4)
    	{
		GuiControl,, Stake4, %c4% / %t4%
      	r4 = %c4%
    	}
;--------------------------------------------------------- STAKE 5 ------------------------------------------------------------

    v5 := 0
    v51 := 0
    v52 := 0
    v53 := 0
    v54 := 0
    v55 := 0
    c5 := 0

    WinGet, v51,count, %Stake5% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v52,count, %Stake5% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v53,count, %Stake5% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v54,count, %Stake5% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v55,count, %Stake5% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v5 := v51 + v52 + v53 + v54 + v55

    Loop, %v5%
    	{	
    	c5 += 1
    	}

    if (t5 = 0)
		{
		GuiControl,, Stake5, 0 / 0
    	r5 = 0
		}

    if (t5 < c5)
		{
		t5 := c5 - 1
		}

    if (c5 > r5)
    	{
		t5++
    	GuiControl,, Stake5, %c5% / %t5%
    	r5 = %c5%
    	}

	else, if (c5 < r5)
    	{
		GuiControl,, Stake5, %c5% / %t5%
      	r5 = %c5%
    	}
;--------------------------------------------------------- STAKE 6 -----------------------------------------------------------
  
    v6 := 0
    v61 := 0
    v62 := 0
    v63 := 0
    v64 := 0
    v65 := 0
    c6 := 0

    WinGet, v61,count, %Stake6% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v62,count, %Stake6% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v63,count, %Stake6% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v64,count, %Stake6% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    WinGet, v65,count, %Stake6% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	
	v6 := v61 + v62 + v63 + v64 + v65

    Loop, %v6%
    	{	
    	c6 += 1
    	}

    if (t6 = 0)
		{
		GuiControl,, Stake6, 0 / 0
    	r6 = 0
		}

    if (t6 < c6)
		{
		t6 := c6 - 1
		}

    if (c6 > r6)
    	{
		t6++
    	GuiControl,, Stake6, %c6% / %t6%
    	r6 = %c6%
    	}

	else, if (c6 < r6)
    	{
		GuiControl,, Stake6, %c6% / %t6%
      	r6 = %c6%
    	}
;--------------------------------------------------------- STAKE 7 ------------------------------------------------------------

    v7 := 0
    c7 := 0

    WinGet, v7, count, %Stake7% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass

    Loop, %v7%
    	{	
    	c7 += 1
    	}

    if (t7 = 0)
		{
		GuiControl,, Stake7, 0 / 0
    	r7 = 0
		}

    if (t7 < c7)
		{
		t7 := c7 - 1
		}

    if (c7 > r7)
    	{
		t7++
    	GuiControl,, Stake7, %c7% / %t7%
    	r7 = %c7%
    	}

	else, if (c7 < r7)
    	{
		GuiControl,, Stake7, %c7% / %t7%
      	r7 = %c7%
    	}
;--------------------------------------------------------- STAKE 8 ------------------------------------------------------------

    v8 := 0
    c8 := 0

    WinGet, v8, count, %Stake8% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass

    Loop, %v8%
    	{	
    	c8 += 1
    	}

    if (t8 = 0)
		{
		GuiControl,, Stake8, 0 / 0
    	r8 = 0
		}

    if (t8 < c8)
		{
		t8 := c8 - 1
		}

    if (c8 > r8)
    	{
		t8++
    	GuiControl,, Stake8, %c8% / %t8%
     	r8 = %c8%
    	}

	else, if (c8 < r8)
    	{
		GuiControl,, Stake8, %c8% / %t8%
      	r8 = %c8%
    	}
;--------------------------------------------------------- STAKE 9 ------------------------------------------------------------

    v9 := 0
    c9 := 0

    WinGet, v9,count, %Stake9% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass 

    Loop, %v9%
    	{	
    	c9 += 1
    	}

    if (t9 = 0)
		{
		GuiControl,, Stake9, 0 / 0
    	r9 = 0
		}

    if (t9 < c9)
		{
		t9 := c9 - 1
		}

    if (c9 > r9)
    	{
		t9++
    	GuiControl,, Stake9, %c9% / %t9%
    	 r9 = %c9%
    	}

	else, if (c9 < r9)
    	{
		GuiControl,, Stake9, %c9% / %t9%
      	r9 = %c9%
    	}
;--------------------------------------------------------- TOTALS -------------------------------------------------------------

    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9

    GuiControl,, TotalTables, %c0% / %t0%

    if (c0 < r0)
    	{
		SoundPlay, %SoundBust%
    	}
	
    r0 = %c0%

    if (c0 < CurrentLimit)
		{
		Gui, Font, s22 c%NumColor%, Verdana
		GuiControl, Font, TotalTables
		}

	else, if (c0 >= CurrentLimit)
		{
		Gui, Font, s22 c%LimitColor%, Verdana
		GuiControl, Font, TotalTables
		}

    if (t0 = TotalLimit)
    	{
		SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}
;--------------------------------------------------------- BUYIN --------------------------------------------------------------

Buyin_Dollars:=0.00
Buyin_Dollars_TournamentCounter:=0
Buyin_Euro:=0.00
Buyin_Euro_TournamentCounter:=0
Buyin_Session:=0.00	
Buyin_Session_TournamentCounter:=0
		
Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass

Loop %Ps_Hwnd_List%
{
	Hwnd:=Ps_Hwnd_List%A_index%
	IF  !(Buyin_%hwnd%)
		{
		WingetTitle,Title,Ahk_id%Hwnd%
		IF Instr(Title,"Tournament")
			{
			IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
				{
 				BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
				Buyin_Total:=Round(Buyin_Total+Buyin_%Hwnd%,2)
			    	Buyin_Total_TournamentCounter+=1
				}
			}
		}			
}	

Loop,Parse,Buyin_Hwnd_List,`,,
{
        Hwnd:=A_LoopField      
	IF WinExist("ahk_id" Hwnd)
        	{
		Currency:=Buyin_%hwnd%_Currency	
		Buyin:=Round(Buyin_%hwnd%,2)
		IF (Currency="$")
			{	
			Buyin_Dollars:=Round(Buyin_Dollars+Buyin,2)
		        Buyin_Dollars_TournamentCounter+=1
			}
		Else  IF (Currency="€")
			{		
			Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
			Buyin_Euro_TournamentCounter+=1
			}		
		Buyin_Session:=Round(Buyin_Session+Buyin,2)
		Buyin_Session_TournamentCounter+=1
		}
	Else
                { 
		Temp_list:="," Buyin_Hwnd_List "," 
		StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
	        StringTrimLeft,Temp_list,Temp_list,1
		StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
		}
}	
	
IF (BuyIn_Dollars_Save != BuyIn_Dollars) Or (BuyIn_Euro_Save != BuyIn_Euro) 
{
	BuyIn_Euro_Save:=BuyIn_Euro	
	BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
	BuyIn_Dollars_Save:=BuyIn_Dollars
	BuyIn_Dollars_Avg:=Round(BuyIn_Dollars/BuyIn_Dollars_TournamentCounter,2)
	BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
	BuyIn_Total_Avg:=Round(BuyIn_Total/BuyIn_Total_TournamentCounter,2)
	
	IfInString, Buyin_Dollars_Avg, .00
		StringReplace, Buyin_Dollars_Avg2, Buyin_Dollars_Avg, .00,
	else, Buyin_Dollars_Avg2 := Buyin_Dollars_Avg	
	
	IfInString, Buyin_Dollars, .00
		StringReplace, Buyin_Dollars2, Buyin_Dollars, .00,
	else, Buyin_Dollars2 := Buyin_Dollars
		
	IfInString, Buyin_Total_Avg, .00
		StringReplace, Buyin_Total_Avg2, Buyin_Total_Avg, .00,
	else, Buyin_Total_Avg2 := Buyin_Total_Avg
		
	IfInString, Buyin_Total, .00
		StringReplace, Buyin_Total2, Buyin_Total, .00,
	else, Buyin_Total2 := Buyin_Total
	
	GuiControl,,Dollars,% "$" Buyin_Dollars_Avg2 " / $" BuyIn_Dollars2 ""
	GuiControl,,TotalABI,% "$" BuyIn_Total_Avg2 " / $" BuyIn_Total2 ""
}

If (BuyIn_Total_Avg >= MaxABI) or (BuyIn_Total >= MaxInvest)
	{
	Gui, Font, s11 c%LimitColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}
else
	{
	Gui, Font, s11 c%NumColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}
	


GetBuyin(Title,byref currency="",Byref BuyinText="")
	{
	Static CurrencyList:="$,€"
 	Haystack:=Substr(Title, Instr(Title,"Sat:")+1) ;This is for satiliets
    Loop,Parse,Currencylist,`,
    	{
        IF ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
          	{          
           	BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
         	Currency=%A_loopField%
          	Buyin:=BuyinText
	  		StringReplace,Buyin,Buyin,%Currency%,, 
			IfInString, Buyin, +R
				{	
          		StringReplace,Buyin,Buyin,+R,, 
				RebuyMulti = 3
				Buyin := Buyin * RebuyMulti					
				}
             
			IF Buyin is not number
				{ 
				Buyin:=0
				currency:=
				buyinText:=    
				}
			Break     
			}
		}
	Return Buyin 
	}
		
;---------------------------------------------------------- VPP --------------------------------------------------------------

	VPP1 := t1 * Stake1VPP
	VPP2 := t2 * Stake2VPP
	VPP3 := t3 * Stake3VPP
	VPP4 := t4 * Stake4VPP
	VPP5 := t5 * Stake5VPP
	VPP6 := t6 * Stake6VPP
	VPP7 := t7 * Stake7VPP
	VPP8 := t8 * Stake8VPP
	VPP9 := t9 * Stake9VPP
	
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)
	
	
	IfInString, VPP, .00
		StringReplace, VPP_2, VPP, .00,
	else, VPP_2 := VPP

    GuiControl,, VPP, %VPP_2%
	
	If (VPP >= MinVPP)
		{
		Gui, Font, s11 c%LimitColor%, Verdana
		GuiControl, Font, VPP
		}
		
	
;--------------------------------------------------------- CLOCK --------------------------------------------------------------

FormatTime, Time, %A_Now%, H:mm
GuiControl,, Clock, %Time%
StringTrimLeft, TimeOnly, A_Now, 10
StringTrimRight, Minutes, TimeOnly, 2
IfGreaterOrEqual, Minutes, 55
	{
	Gui, Font, s20 c%ClockColorBreak%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
else
	{
	Gui, Font, s20 c%NumColor%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
;-------------------------------------------------------- DURATION -------------------------------------------------------------

If (Minutes != Var)
	{
	M2 += 1
	GuiControl,, SessionTime, %H%:%M1%%M2%
	Var := Minutes
	}

If (M2 > 9)
	{
	M1 += 1
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}

If (M1 > 5)
	{
	H += 1
	M1 = 0
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}
	
Limit = %H%:%M1%%M2%
If (Limit = SessionTimeLimit)
	{
	Gui, Font, s12 c%LimitColor%, Verdana
	GuiControl, Font, SessionTime
	}
;-------------------------------------------------------- INTERVAL --------------------------------------------------------------

   Sleep %LoopInterval%

}
return
;====================================================== SECTION END =============================================================
;================================================================================================================================
;======================================================== HOTKEYS ===============================================================

^F9::				;counter (SessionTime) reset
{
H = 0
M1 = 0
M2 = 0
Gui, Font, s12 c999999, Verdana
GuiControl, Font, SessionTime
GuiControl,, SessionTime, %H%:%M1%%M2%
}
return
;................................................................................................................................

^F10::				;counter (SessionTime) + 1
Var = -1
return
;.................................................... TABLE MOVEMENTS ...........................................................

F1::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA1x%, %SlotA1y%
else, return
}
return
;......................................................... SLOT1 ................................................................

F2::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA2x%, %SlotA2y%
else, return
}
return
;......................................................... SLOT2 ................................................................

F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA3x%, %SlotA3y%
else, return
}
return
;......................................................... SLOT3 ................................................................

F4::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA4x%, %SlotA4y%
else, return
}
return
;......................................................... SLOT4 ................................................................

^F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA0x%, %SlotA0y%
else, return
}
return
;......................................................... SLOT5 ................................................................

F5::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB1x%, %SlotB1y%
else, return
}
return
;......................................................... SLOT6 ................................................................

F6::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB2x%, %SlotB2y%
else, return
}
return
;......................................................... SLOT7 ................................................................

F7::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB3x%, %SlotB3y%
else, return
}
return
;......................................................... SLOT8 ................................................................

F8::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB4x%, %SlotB4y%
else, return
}
return
;......................................................... SLOT9 ................................................................

F9::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC1x%, %SlotC1y%
else, return
}
return
;......................................................... SLOT10 ...............................................................

F10::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC2x%, %SlotC2y%
else, return
}
return
;......................................................... SLOT11 ...............................................................

F11::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC3x%, %SlotC3y%
else, return
}
return
;......................................................... SLOT12 ...............................................................

F12::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC4x%, %SlotC4y%
else, return
}
return
;................................................................................................................................

^Q::ExitApp
;................................................................................................................................

!Pause::Pause
;................................................................................................................................

GuiClose:
ExitApp
Table Counter AHK for PokerStars Quote
11-11-2013 , 04:05 PM
More options and fixes (this version is ready for 180s, 45s, and 18s at the same time):



Spoiler:
Code:
#SingleInstance, force
;#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1					;1=begin with 2=contain 3=exact match

;================================================================================================================================
;==================================================== CONFIG SECTION ============================================================

GuiPos = x4 y4							;position of GUI on screen 
										;move the window where you want it to be, then use WindowSpy to grab its coords

ColumnL = 180s							;left column caption (leave blank to omit)
Stake1 = $3.50+R							
Stake2 = $8.00							
Stake3 = $15.00	
ColumnM = 45man							;center column caption (leave blank to omit)					
Stake4 = $3.50							
Stake5 = $7.00							
Stake6 = $15.00	
ColumnR = 18man							;right column caption (leave blank to omit)					
Stake7 = $3.50							
Stake8 = $7.00							
Stake9 = $15.00							

Stake1VPP = 1.71					
Stake2VPP = 3.63						
Stake3VPP = 6.77					
Stake4VPP = 1.71											
Stake5VPP = 3.19					
Stake6VPP = 6.71						
Stake7VPP = 1.87					
Stake8VPP = 3.03											
Stake9VPP = 6.11			

GUIColor = 383838						;GUI window background color
TextColor = ffffff						;text/label color
SeparatorColor = 303030					;separator color (choose same as GUIColor to hide separators)
NumColor = 000000						;default color for numeric controls
NumColorGoal = 33ff33					;control color upon reaching set goal (VPP/FPP, MinABI, MinMTRatio, SessionTimeLimit) 
NumColorWarn = ff0000					;control color upon reaching set maximum (MaxMTRatio, MaxABI, MaxInvest)

ClockColorBreak = FF0000				;clock color indicating sync tourney break (choose same as NumColor to disable this option)

CustomStakeColor = 0					;enable = 1, disable = 0 (will use NumColor if disabled)
Color1 = 8000FF 						;color for table counter - stake1 
Color2 = 0040FF							;color for table counter - stake2 
Color3 = 00BFFF							;color for table counter - stake3 
Color4 = 00FFBF 						;color for table counter - stake4 
Color5 = 00FF00 						;color for table counter - stake5
Color6 = BFFF00							;color for table counter - stake6 
Color7 = FFFF00							;color for table counter - stake7 
Color8 = FF8000 						;color for table counter - stake8 
Color9 = FF0000 						;color for table counter - stake9

MinMTRatio = 16							;min desired multitabling ratio (total)
MaxMTRatio = 20							;max desired multitabling ratio (total)
TotalLimit = 100						;max desired table limit (session)(triggers SoundAchieve)
MinABI = 4.5							;minimum desired ABI (session)
MaxABI = 6								;maximum desired ABI (session)
MaxInvest = 1000						;maximum desired investment (session)
VPPGoal = 375							;desired VPP per session
VIPMulti = 2							;FPP multiplicator (VIP status dependant)
SessionTimeGoal = 6:00					;desired session time (h:mm)

SoundBust = C:\Program Files (x86)\PokerStars\snd\bust.wav			;sound if table closes
SoundAchieve = C:\Program Files (x86)\PokerStars\snd\ding.wav		;sound if TotalLimit reached
SoundInterval = 25						;SoundAchieve replays every N tables upon exceeding TotalLimit 
										
LoopInterval = 100						;counter update interval in msec (1000 = 1sec, default = 100)

;................................................. TABLE MOVEMENT COORDS ........................................................

SlotA1x := 304							;F1
SlotA1y := 0

SlotA2x := 1112							;F2
SlotA2y := 0

SlotA3x := 1920							;F3
SlotA3y := 0

SlotA4x := 2728							;F4
SlotA4y := 0
;...........................................
SlotC1x := 304							;F5
SlotC1y := 299

SlotC2x := 1112							;F6
SlotC2y := 299

SlotC3x := 1920							;F7
SlotC3y := 299

SlotC4x := 2728							;F8
SlotC4y := 299
;...........................................
SlotB1x := 304							;F9
SlotB1y := 584

SlotB2x := 1112							;F10
SlotB2y := 584

SlotB3x := 1920							;F11
SlotB3y := 584

SlotB4x := 2728							;F12
SlotB4y := 584

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT REBUY MULTIPLICATOR AT LINE 882 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIG HOTKEYS AT BOTTOM OF THE SCRIPT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT CONTROL COORDS IN THE GUI SECTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;====================================================== SECTION END =============================================================
;================================================================================================================================

If (CustomStakeColor = 0)
Loop, 9
	{
	C += 1
	Color%C% := NumColor
	}
 
;================================================================================================================================
;====================================================== GUI SECTION =============================================================

Gui -MaximizeBox -Resize +AlwaysOnTop +ToolWindow -MinimizeBox
Gui, Show, W376 H305 %GuiPos%, SessionMan 2.2.3	
Gui, Color, %GUIColor%		

;................................................................................................................................
;...................................................... VPP/FPP/TOTALS ...........................................................

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x38 y6 Center, VPP
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x18 y24 vVPP Center, 0000.00 
						
Gui, Font, s8 c%TextColor%, Verdana					
Gui, Add, Text, x154 y0 Center, Total Tables
Gui, Font, s22 c%NumColor%, Verdana					
Gui, Add, Text, x110 y13 vTotalTables Center, 000 / 0000	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x311 y6 Center, FPP
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x285 y24 vFPP Center, 00000.00	

;................................................................................................................................
;....................................................... SEPARATOR1 .............................................................	
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x46 y50 Center, %ColumnL%
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x168 y50 Center, %ColumnM%				
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x295 y50 Center, %ColumnR%
							
Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y45 Center, ______________________________________________	
	
;................................................................................................................................
;..................................................... TABLE COUNTERS ...........................................................		
;......................................................... STAKE 1 ..............................................................
						
Gui, Font, s8 c%Color1%, Verdana				
Gui, Add, Text, x37 y70 vControl1 Center, $000.00
								
Gui, Font, s16 c%Color1%, Verdana				
Gui, Add, Text, x3 y82 vStake1 Center, 000 / 0000	
	
;......................................................... STAKE 2 ..............................................................
								
Gui, Font, s8 c%Color2%, Verdana				
Gui, Add, Text, x37 y114 vControl2 Center, $000.00
								
Gui, Font, s16 c%Color2%, Verdana				
Gui, Add, Text, x3 y126 vStake2 Center, 000 / 0000	
	
;......................................................... STAKE 3 ..............................................................
								
Gui, Font, s8 c%Color3%, Verdana				
Gui, Add, Text, x37 y158 vControl3 Center, $000.00
								
Gui, Font, s16 c%Color3%, Verdana				
Gui, Add, Text, x3 y170 vStake3 Center, 000 / 0000	
	
;................................................................................................................................		
;......................................................... STAKE 4 ..............................................................
								
Gui, Font, s8 c%Color4%, Verdana				
Gui, Add, Text, x165 y70 vControl4 Center, $000.00
								
Gui, Font, s16 c%Color4%, Verdana			
Gui, Add, Text, x131 y82 vStake4 Center, 000 / 0000		
	
;......................................................... STAKE 5 ..............................................................
								
Gui, Font, s8 c%Color5%, Verdana				
Gui, Add, Text, x165 y114 vControl5 Center, $000.00
								
Gui, Font, s16 c%Color5%, Verdana			
Gui, Add, Text, x131 y126 vStake5 Center, 000 / 0000	
	
;......................................................... STAKE 6 ..............................................................
								
Gui, Font, s8 c%Color6%, Verdana				
Gui, Add, Text, x165 y158 vControl6 Center, $000.00
								
Gui, Font, s16 c%Color6%, Verdana				
Gui, Add, Text, x131 y170 vStake6 Center, 000 / 0000	
	
;................................................................................................................................				
;......................................................... STAKE 7 ..............................................................
								
Gui, Font, s8 c%Color7%, Verdana				
Gui, Add, Text, x293 y70 vControl7 Center, $000.00
								
Gui, Font, s16 c%Color7%, Verdana				
Gui, Add, Text, x259 y82 vStake7 Center, 000 / 0000		

;......................................................... STAKE 8 ..............................................................
								
Gui, Font, s8 c%Color8%, Verdana				
Gui, Add, Text, x293 y114 vControl8 Center, $000.00
								
Gui, Font, s16 c%Color8%, Verdana			
Gui, Add, Text, x259 y126 vStake8 Center, 000 / 0000		
	
;......................................................... STAKE 9 ..............................................................
								
Gui, Font, s8 c%Color9%, Verdana				
Gui, Add, Text, x293 y158 vControl9 Center, $000.00
								
Gui, Font, s16 c%Color9%, Verdana			
Gui, Add, Text, x259 y170 vStake9 Center, 000 / 0000	

;................................................................................................................................
;....................................................... SEPARATOR2 .............................................................	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x76 y203 Center, ABI
	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x257 y203 Center, Invest

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y197 Center, ______________________________________________

;................................................................................................................................
;....................................................... ABI/INVEST .............................................................

Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x4 y224 vDollars Center, $0000.00 ($0000.00)	
								
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x184 y224 vTotalABI Center, $00000.00 ($00000.00) 

;................................................................................................................................
;....................................................... SEPARATOR3 .............................................................	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x35 y252 Center, Games/h
	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x170 y250 Center, Clock

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x298 y252 Center, Time

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y247 Center, ______________________________________________

;................................................................................................................................
;..................................................... GAMES/H / TIME ...........................................................	

Gui, Font, s16 c%NumColor%, Verdana					
Gui, Add, Text, x28 y273 vGames Center, 000.00	

Gui, Font, s20 c%NumColor%, Verdana					
Gui, Add, Text, x146 y268 vClock Center, 00000	

Gui, Font, s16 c%NumColor%, Verdana					
Gui, Add, Text, x285 y273 vSessionTime Center, 00:00	

;====================================================== SECTION END =============================================================
;================================================================================================================================
;====================================================== MAIN SCRIPT =============================================================	
Loop, 9
	{
	N += 1
	IfInString, Stake%N%, .00
		StringReplace, Stake%N%b, Stake%N%, .00,
	else, Stake%N%b := Stake%N%	
	}
	
N = 0

GuiControl,, Control1, %Stake1b%
GuiControl,, Control2, %Stake2b%
GuiControl,, Control3, %Stake3b%
GuiControl,, Control4, %Stake4b%
GuiControl,, Control5, %Stake5b%
GuiControl,, Control6, %Stake6b%
GuiControl,, Control7, %Stake7b%
GuiControl,, Control8, %Stake8b%
GuiControl,, Control9, %Stake9b%

Buyin_Total := 0.00
Buyin_Total_TournamentCounter := 0

H = 0
M1 = 0
M2 = -1
S = 0

r0 = 0
r1 = 0
r2 = 0
r3 = 0
r4 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r9 = 0

t1 = 0
t2 = 0
t3 = 0
t4 = 0
t5 = 0
t6 = 0
t7 = 0
t8 = 0
t9 = 0

VPP1 = 0
VPP2 = 0
VPP3 = 0
VPP4 = 0
VPP5 = 0
VPP6 = 0
VPP7 = 0
VPP8 = 0
VPP9 = 0

FPP = 0

P = 0

Loop
{
;--------------------------------------------------------- STAKE 1 -----------------------------------------------------------
  
    v1 := 0
    c1 := 0

    ;WinGet, v1, count, %Stake1% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass
	WinGet, v1, count, %Stake1% NL Hold'em [180 Players ahk_class PokerStarsTableFrameClass

    Loop, %v1%
    	{	
    	c1 += 1
    	}

    if (t1 = 0)
		{
		GuiControl,, Stake1, 0 / 0
    	r1 = 0
		}

    if (t1 < c1)
		{
		t1 := c1 - 1
		}

    if (c1 > r1)
    	{
		t1 += 1
    	GuiControl,, Stake1, %c1% / %t1%
    	r1 = %c1%
    	}

	else, if (c1 < r1)
    	{
		GuiControl,, Stake1, %c1% / %t1%
      	r1 = %c1%
    	}
;--------------------------------------------------------- STAKE 2 ------------------------------------------------------------

    v2 := 0
    c2 := 0

    ;WinGet, v2, count, %Stake2% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass
	WinGet, v2, count, %Stake2% NL Hold'em [180 Players ahk_class PokerStarsTableFrameClass

    Loop, %v2%
    	{	
    	c2 += 1
    	}

    if (t2 = 0)
		{
		GuiControl,, Stake2, 0 / 0
    	r2 = 0
		}

    if (t2 < c2)
		{
		t2 := c2 - 1
		}

    if (c2 > r2)
    	{
		t2++
    	GuiControl,, Stake2, %c2% / %t2%
    	r2 = %c2%
    	}

	else, if (c2 < r2)
    	{
		GuiControl,, Stake2, %c2% / %t2%
      	r2 = %c2%
    	}
;--------------------------------------------------------- STAKE 3 ------------------------------------------------------------

    v3 := 0
    c3 := 0

    ;WinGet, v3, count, %Stake3% NL Hold'em [6-Max] ahk_class PokerStarsTableFrameClass
	WinGet, v3, count, %Stake3% NL Hold'em [180 Players ahk_class PokerStarsTableFrameClass

    Loop, %v3%
    	{	
    	c3 += 1
    	}

    if (t3 = 0)
		{
		GuiControl,, Stake3, 0 / 0
    	r3 = 0
		}

    if (t3 < c3)
		{
		t3 := c3 - 1
		}

    if (c3 > r3)
    	{
		t3++
    	GuiControl,, Stake3, %c3% / %t3%
     	r3 = %c3%
    	}

	else, if (c3 < r3)
    	{
		GuiControl,, Stake3, %c3% / %t3%
      	r3 = %c3%
    	}
;--------------------------------------------------------- STAKE 4 ------------------------------------------------------------

    v4 := 0
    v41 := 0
    v42 := 0
    v43 := 0
    v44 := 0
    v45 := 0
    c4 := 0

    ;WinGet, v41,count, %Stake4% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v42,count, %Stake4% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v43,count, %Stake4% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v44,count, %Stake4% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v45,count, %Stake4% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	WinGet, v41, count, %Stake4% NL Hold'em [45 Players ahk_class PokerStarsTableFrameClass
	
	v4 := v41 + v42 + v43 + v44 + v45

    Loop, %v4%
    	{	
    	c4 += 1
    	}

    if (t4 = 0)
		{
		GuiControl,, Stake4, 0 / 0
    	r4 = 0
		}

    if (t4 < c4)
		{
		t4 := c4 - 1
		}

    if (c4 > r4)
    	{
		t4 += 1
    	GuiControl,, Stake4, %c4% / %t4%
    	 r4 = %c4%
    	}

	else, if (c4 < r4)
    	{
		GuiControl,, Stake4, %c4% / %t4%
      	r4 = %c4%
    	}
;--------------------------------------------------------- STAKE 5 ------------------------------------------------------------

    v5 := 0
    v51 := 0
    v52 := 0
    v53 := 0
    v54 := 0
    v55 := 0
    c5 := 0

    ;WinGet, v51,count, %Stake5% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v52,count, %Stake5% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v53,count, %Stake5% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v54,count, %Stake5% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v55,count, %Stake5% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	WinGet, v51, count, %Stake5% NL Hold'em [45 Players ahk_class PokerStarsTableFrameClass
	
	v5 := v51 + v52 + v53 + v54 + v55

    Loop, %v5%
    	{	
    	c5 += 1
    	}

    if (t5 = 0)
		{
		GuiControl,, Stake5, 0 / 0
    	r5 = 0
		}

    if (t5 < c5)
		{
		t5 := c5 - 1
		}

    if (c5 > r5)
    	{
		t5++
    	GuiControl,, Stake5, %c5% / %t5%
    	r5 = %c5%
    	}

	else, if (c5 < r5)
    	{
		GuiControl,, Stake5, %c5% / %t5%
      	r5 = %c5%
    	}
;--------------------------------------------------------- STAKE 6 -----------------------------------------------------------
  
    v6 := 0
    v61 := 0
    v62 := 0
    v63 := 0
    v64 := 0
    v65 := 0
    c6 := 0

    ;WinGet, v61,count, %Stake6% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v62,count, %Stake6% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v63,count, %Stake6% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v64,count, %Stake6% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
    ;WinGet, v65,count, %Stake6% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
	WinGet, v61, count, %Stake6% NL Hold'em [45 Players ahk_class PokerStarsTableFrameClass
	
	v6 := v61 + v62 + v63 + v64 + v65

    Loop, %v6%
    	{	
    	c6 += 1
    	}

    if (t6 = 0)
		{
		GuiControl,, Stake6, 0 / 0
    	r6 = 0
		}

    if (t6 < c6)
		{
		t6 := c6 - 1
		}

    if (c6 > r6)
    	{
		t6++
    	GuiControl,, Stake6, %c6% / %t6%
    	r6 = %c6%
    	}

	else, if (c6 < r6)
    	{
		GuiControl,, Stake6, %c6% / %t6%
      	r6 = %c6%
    	}
;--------------------------------------------------------- STAKE 7 ------------------------------------------------------------

    v7 := 0
    c7 := 0

    ;WinGet, v7, count, %Stake7% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
	WinGet, v7, count, %Stake7% NL Hold'em [18 Players ahk_class PokerStarsTableFrameClass

    Loop, %v7%
    	{	
    	c7 += 1
    	}

    if (t7 = 0)
		{
		GuiControl,, Stake7, 0 / 0
    	r7 = 0
		}

    if (t7 < c7)
		{
		t7 := c7 - 1
		}

    if (c7 > r7)
    	{
		t7++
    	GuiControl,, Stake7, %c7% / %t7%
    	r7 = %c7%
    	}

	else, if (c7 < r7)
    	{
		GuiControl,, Stake7, %c7% / %t7%
      	r7 = %c7%
    	}
;--------------------------------------------------------- STAKE 8 ------------------------------------------------------------

    v8 := 0
    c8 := 0

    ;WinGet, v8, count, %Stake8% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
	WinGet, v8, count, %Stake8% NL Hold'em [18 Players ahk_class PokerStarsTableFrameClass

    Loop, %v8%
    	{	
    	c8 += 1
    	}

    if (t8 = 0)
		{
		GuiControl,, Stake8, 0 / 0
    	r8 = 0
		}

    if (t8 < c8)
		{
		t8 := c8 - 1
		}

    if (c8 > r8)
    	{
		t8++
    	GuiControl,, Stake8, %c8% / %t8%
     	r8 = %c8%
    	}

	else, if (c8 < r8)
    	{
		GuiControl,, Stake8, %c8% / %t8%
      	r8 = %c8%
    	}
;--------------------------------------------------------- STAKE 9 ------------------------------------------------------------

    v9 := 0
    c9 := 0

    ;WinGet, v9,count, %Stake9% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass 	
	WinGet, v9, count, %Stake9% NL Hold'em [18 Players ahk_class PokerStarsTableFrameClass

    Loop, %v9%
    	{	
    	c9 += 1
    	}

    if (t9 = 0)
		{
		GuiControl,, Stake9, 0 / 0
    	r9 = 0
		}

    if (t9 < c9)
		{
		t9 := c9 - 1
		}

    if (c9 > r9)
    	{
		t9++
    	GuiControl,, Stake9, %c9% / %t9%
    	 r9 = %c9%
    	}

	else, if (c9 < r9)
    	{
		GuiControl,, Stake9, %c9% / %t9%
      	r9 = %c9%
    	}
;--------------------------------------------------------- TOTALS -------------------------------------------------------------

    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9

    GuiControl,, TotalTables, %c0% / %t0%

    if (c0 < r0)
    	{
		SoundPlay, %SoundBust%
    	}
	
    r0 = %c0%

    if (c0 < MinMTRatio)
		{
		Gui, Font, s22 c%NumColor%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}
	else, if (c0 > MaxMTRatio)
		{
		Gui, Font, s22 c%NumColorWarn%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}
	else
		{
		Gui, Font, s22 c%NumColorGoal%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}

    if (t0 = TotalLimit)
    	{
		SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}
;--------------------------------------------------------- BUYIN --------------------------------------------------------------

Buyin_Dollars:=0.00
Buyin_Dollars_TournamentCounter:=0
Buyin_Euro:=0.00
Buyin_Euro_TournamentCounter:=0
Buyin_Session:=0.00	
Buyin_Session_TournamentCounter:=0
		
Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass

Loop %Ps_Hwnd_List%
{
	Hwnd:=Ps_Hwnd_List%A_index%
	IF  !(Buyin_%hwnd%)
		{
		WingetTitle,Title,Ahk_id%Hwnd%
		IF Instr(Title,"Tournament")
			{
			IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
				{
 				BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
				Buyin_Total:=Round(Buyin_Total+Buyin_%Hwnd%,2)
			    	Buyin_Total_TournamentCounter+=1
				}
			}
		}			
}	

Loop,Parse,Buyin_Hwnd_List,`,,
{
        Hwnd:=A_LoopField      
	IF WinExist("ahk_id" Hwnd)
        	{
		Currency:=Buyin_%hwnd%_Currency	
		Buyin:=Round(Buyin_%hwnd%,2)
		IF (Currency="$")
			{	
			Buyin_Dollars:=Round(Buyin_Dollars+Buyin,2)
		        Buyin_Dollars_TournamentCounter+=1
			}
		Else  IF (Currency="€")
			{		
			Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
			Buyin_Euro_TournamentCounter+=1
			}		
		Buyin_Session:=Round(Buyin_Session+Buyin,2)
		Buyin_Session_TournamentCounter+=1
		}
	Else
                { 
		Temp_list:="," Buyin_Hwnd_List "," 
		StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
	        StringTrimLeft,Temp_list,Temp_list,1
		StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
		}
}	
	
IF (BuyIn_Dollars_Save != BuyIn_Dollars) Or (BuyIn_Euro_Save != BuyIn_Euro) 
{
	BuyIn_Euro_Save:=BuyIn_Euro	
	BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
	BuyIn_Dollars_Save:=BuyIn_Dollars
	BuyIn_Dollars_Avg:=Round(BuyIn_Dollars/BuyIn_Dollars_TournamentCounter,2)
	BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
	BuyIn_Total_Avg:=Round(BuyIn_Total/BuyIn_Total_TournamentCounter,2)
	
	IfInString, Buyin_Dollars_Avg, .00
		StringReplace, Buyin_Dollars_Avg, Buyin_Dollars_Avg, .00,
	
	IfInString, Buyin_Dollars, .00
		StringReplace, Buyin_Dollars, Buyin_Dollars, .00,
		
	IfInString, Buyin_Total_Avg, .00
		StringReplace, Buyin_Total_Avg, Buyin_Total_Avg, .00,
		
	IfInString, Buyin_Total, .00
		StringReplace, Buyin_Total, Buyin_Total, .00,
	
	GuiControl,,Dollars,% "$" Buyin_Dollars_Avg " ($" BuyIn_Total_Avg ")"
	GuiControl,,TotalABI,% "$" BuyIn_Dollars " ($" BuyIn_Total ")"
}

If (BuyIn_Total_Avg > MaxABI)
	{
	Gui, Font, s11 c%NumColorWarn%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
else, If (BuyIn_Total_Avg < MaxABI) and (BuyIn_Total_Avg > MinABI)
	{
	Gui, Font, s11 c%NumColorGoal%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
else
	{
	Gui, Font, s11 c%NumColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
	
If (BuyIn_Total > MaxInvest)
	{
	Gui, Font, s11 c%NumColorWarn%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}
else
	{
	Gui, Font, s11 c%NumColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}

GetBuyin(Title,byref currency="",Byref BuyinText="")
	{
	Static CurrencyList:="$,€"
 	Haystack:=Substr(Title, Instr(Title,"Sat:")+1) ;This is for satiliets
    Loop,Parse,Currencylist,`,
    	{
        IF ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
          	{          
           	BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
         	Currency=%A_loopField%
          	Buyin:=BuyinText
	  		StringReplace,Buyin,Buyin,%Currency%,, 
			IfInString, Buyin, +R
				{	
          		StringReplace,Buyin,Buyin,+R,, 
				RebuyMulti = 3
				Buyin := Buyin * RebuyMulti					
				}
             
			IF Buyin is not number
				{ 
				Buyin:=0
				currency:=
				buyinText:=    
				}
			Break     
			}
		}
	Return Buyin 
	}
		
;---------------------------------------------------------- VPP --------------------------------------------------------------

	VPP1 := t1 * Stake1VPP
	VPP2 := t2 * Stake2VPP
	VPP3 := t3 * Stake3VPP
	VPP4 := t4 * Stake4VPP
	VPP5 := t5 * Stake5VPP
	VPP6 := t6 * Stake6VPP
	VPP7 := t7 * Stake7VPP
	VPP8 := t8 * Stake8VPP
	VPP9 := t9 * Stake9VPP
	
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)
	
	
	IfInString, VPP, .00
		StringReplace, VPP, VPP, .00,
		
	Loop, 9
		{
		N += 1
		IfInString, VPP, .%N%0
			{
			StringTrimRight, VPP, VPP, 1
			break
			}	
		}
		
	N = 0

    GuiControl,, VPP, %VPP%
	
	If (VPP >= VPPGoal)
		{
		Gui, Font, s11 c%NumColorGoal%, Verdana
		GuiControl, Font, VPP
		GuiControl, Font, FPP
		}
		
;---------------------------------------------------------- FPP ---------------------------------------------------------------

	FPP := VPP * VIPMulti
	
	FPP := Round(FPP,2)
	
	IfInString, FPP, .00
		StringReplace, FPP, FPP, .00,
				
	Loop, 9
		{
		N += 1
		IfInString, FPP, .%N%0
			{
			StringTrimRight, FPP, FPP, 1
			break
			}	
		}
		
	N = 0

    GuiControl,, FPP, %FPP%
	
;--------------------------------------------------------- CLOCK --------------------------------------------------------------

FormatTime, Time, %A_Now%, H:mm
GuiControl,, Clock, %Time%
StringTrimLeft, TimeOnly, A_Now, 10
StringTrimRight, Minutes, TimeOnly, 2
IfGreaterOrEqual, Minutes, 55
	{
	Gui, Font, s20 c%ClockColorBreak%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
else
	{
	Gui, Font, s20 c%NumColor%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
;-------------------------------------------------------- DURATION -------------------------------------------------------------

If (Minutes != Var)
	{
	M2 += 1
	GuiControl,, SessionTime, %H%:%M1%%M2%
	Var := Minutes
	}

If (M2 > 9)
	{
	M1 += 1
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}

If (M1 > 5)
	{
	H += 1
	M1 = 0
	M2 = 0
	GuiControl,, SessionTime, %H%:%M1%%M2%
	}
	
Limit = %H%:%M1%%M2%
If (Limit = SessionTimeGoal)
	{
	Gui, Font, s16 c%NumColorGoal%, Verdana
	Gui, Font, Norm
	GuiControl, Font, SessionTime
	}
	
;--------------------------------------------------------- GAMES/H -------------------------------------------------------------

S := ((H * 60) + (M1 * 10) + M2) / 60
S := Round(S,6)

Games := (t0 - c0) / S
Games := Round(Games,2)

IfInString, Games, .00
	StringReplace, Games, Games, .00,
	
Loop, 9
	{
	N += 1
	IfInString, Games, .%N%0
		{
		StringTrimRight, Games, Games, 1
		break
		}	
	}
	
N = 0

GuiControl,, Games, %Games%

;-------------------------------------------------------- INTERVAL -------------------------------------------------------------

   Sleep %LoopInterval%

}
return
;====================================================== SECTION END =============================================================
;================================================================================================================================
;======================================================== HOTKEYS ===============================================================

^F9::				;counter (SessionTime) reset
{
H = 0
M1 = 0
M2 = 0
Gui, Font, s16 c%NumColor%, Verdana
Gui, Font, Norm
GuiControl, Font, SessionTime
GuiControl,, SessionTime, %H%:%M1%%M2%
}
return
;................................................................................................................................

^F10::				;counter (SessionTime) + 1
Var = -1
return
;.................................................... TABLE MOVEMENTS ...........................................................

F1::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA1x%, %SlotA1y%
else, return
}
return
;......................................................... SLOT1 ................................................................

F2::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA2x%, %SlotA2y%
else, return
}
return
;......................................................... SLOT2 ................................................................

F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA3x%, %SlotA3y%
else, return
}
return
;......................................................... SLOT3 ................................................................

F4::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA4x%, %SlotA4y%
else, return
}
return
;......................................................... SLOT4 ................................................................

^F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA0x%, %SlotA0y%
else, return
}
return
;......................................................... SLOT5 ................................................................

F5::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB1x%, %SlotB1y%
else, return
}
return
;......................................................... SLOT6 ................................................................

F6::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB2x%, %SlotB2y%
else, return
}
return
;......................................................... SLOT7 ................................................................

F7::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB3x%, %SlotB3y%
else, return
}
return
;......................................................... SLOT8 ................................................................

F8::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB4x%, %SlotB4y%
else, return
}
return
;......................................................... SLOT9 ................................................................

F9::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC1x%, %SlotC1y%
else, return
}
return
;......................................................... SLOT10 ...............................................................

F10::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC2x%, %SlotC2y%
else, return
}
return
;......................................................... SLOT11 ...............................................................

F11::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC3x%, %SlotC3y%
else, return
}
return
;......................................................... SLOT12 ...............................................................

F12::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC4x%, %SlotC4y%
else, return
}
return
;................................................................................................................................

^Q::ExitApp
;................................................................................................................................

!Pause::Pause
;................................................................................................................................

GuiClose:
ExitApp

Last edited by Baobhan-Sith; 11-11-2013 at 04:18 PM.
Table Counter AHK for PokerStars Quote
11-15-2013 , 11:24 PM
Made a settings GUI window and added some more options, including ability to log your sessions. Just rightclick the tray icon to see the magic.

You can now easily create game type definitions yourself (limited to SNG and tourneys for now). I included a brief description under the "Types" tab.

Note: The script will now create an ini file in its root folder (the logfile will go there as well). On first startup, the edit boxes will auto-populate with default values, and the same will happen if you delete the ini file or if you save your settings while leaving a box empty. Also note that saving settings will force the script to restart, so don't change the settings during a sessions.

Known bug: For now it's not possible to change hotkeys via the settings GUI. You still have to go through the last code section to edit these. The hotkey edit boxes for now just function as a reminder; you can change these but it will have no effect.


Spoiler:
Code:
#SingleInstance, force
#NoEnv
;#NoTrayIcon
DetectHiddenWindows, On
SetTitleMatchMode, 1					;1=begin with 2=contain 3=exact match

;================================================================================================================================
;==================================================== CONFIG SECTION ============================================================

Build = 2.3.6

LoopInterval = 100					;counter update interval in msec (1000 = 1sec, default = 100)

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT REBUY MULTIPLICATOR AT LINE 846 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIG HOTKEYS AT BOTTOM OF THE SCRIPT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT CONTROL COORDS IN THE GUI SECTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;====================================================== SECTION END =============================================================
;================================================================================================================================

Menu Tray, NoStandard
Menu Tray, Add, Bring To Front, TrayMenuHdlr_Bring
Menu Tray, Add
Menu Tray, Add, Save Position, TrayMenuHdlr_Position
Menu Tray, Add, Reload Script, TrayMenuHdlr_Reload
Menu Tray, Add
Menu Tray, Add, Enable Logging, TrayMenuHdlr_Log
Menu Tray, Add, Open Logfile, TrayMenuHdlr_Logfile
Menu Tray, Add, Clear Logfile, TrayMenuHdlr_ClrLog
Menu Tray, Add
Menu Tray, Add, Settings, TrayMenuHdlr_Config
Menu Tray, Add
Menu Tray, Add, Pause/Continue, TrayMenuHdlr_Pause
Menu Tray, Add, Exit, TrayMenuHdlr_Exit

FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
GoSub CheckIni
GoSub ReadIni
Gosub CheckLogging

If (ColorsBox = 0)
Loop, 9
	{
	C += 1
	Color%C% := NumColor
	}
	
IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x
IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y

ABI := "  ABI  "
Invest := "  Invest  "
Gamesh := "  Games/h  "
Clock := "  Clock  "
Time := "  Time "
 
;================================================================================================================================
;====================================================== GUI SECTION =============================================================

Gui -MaximizeBox -Resize +AlwaysOnTop ;+ToolWindow -MinimizeBox
Gui, Show, W376 H305 x%xpos% y%ypos%, SessionMan %Build%	
Gui, Color, %GUIColor%		

;................................................................................................................................
;...................................................... VPP/FPP/TOTALS ...........................................................

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x38 y6 Center, VPP
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x18 y24 vVPP Center, 0000.00 
						
Gui, Font, s8 c%TextColor%, Verdana					
Gui, Add, Text, x152 y0 Center, Total Tables
Gui, Font, s22 c%NumColor%, Verdana					
Gui, Add, Text, x109 y13 vTotalTables Center, 000 / 0000	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x311 y6 Center, FPP
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x285 y24 vFPP Center, 00000.00	

;................................................................................................................................
;....................................................... SEPARATOR1 .............................................................	
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x37 y50 vControlL Center, 000000
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x164 y50 vControlM Center, 000000				
							
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x292 y50 vControlR Center, 000000
							
Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y45 Center, ____
					
Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x86 y45 Center, __________

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x212 y45 Center, __________
				
Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x338 y45 Center, ____
;................................................................................................................................
;..................................................... TABLE COUNTERS ...........................................................		
;......................................................... STAKE 1 ..............................................................
						
Gui, Font, s8 c%Color1%, Verdana				
Gui, Add, Text, x37 y70 vControl1 Center, $000.00
								
Gui, Font, s16 c%Color1%, Verdana				
Gui, Add, Text, x3 y82 vStake1 Center, 000 / 0000	
	
;......................................................... STAKE 2 ..............................................................
								
Gui, Font, s8 c%Color2%, Verdana				
Gui, Add, Text, x37 y114 vControl2 Center, $000.00
								
Gui, Font, s16 c%Color2%, Verdana				
Gui, Add, Text, x3 y126 vStake2 Center, 000 / 0000	
	
;......................................................... STAKE 3 ..............................................................
								
Gui, Font, s8 c%Color3%, Verdana				
Gui, Add, Text, x37 y158 vControl3 Center, $000.00
								
Gui, Font, s16 c%Color3%, Verdana				
Gui, Add, Text, x3 y170 vStake3 Center, 000 / 0000	
	
;................................................................................................................................		
;......................................................... STAKE 4 ..............................................................
								
Gui, Font, s8 c%Color4%, Verdana				
Gui, Add, Text, x165 y70 vControl4 Center, $000.00
								
Gui, Font, s16 c%Color4%, Verdana			
Gui, Add, Text, x131 y82 vStake4 Center, 000 / 0000		
	
;......................................................... STAKE 5 ..............................................................
								
Gui, Font, s8 c%Color5%, Verdana				
Gui, Add, Text, x165 y114 vControl5 Center, $000.00
								
Gui, Font, s16 c%Color5%, Verdana			
Gui, Add, Text, x131 y126 vStake5 Center, 000 / 0000	
	
;......................................................... STAKE 6 ..............................................................
								
Gui, Font, s8 c%Color6%, Verdana				
Gui, Add, Text, x165 y158 vControl6 Center, $000.00
								
Gui, Font, s16 c%Color6%, Verdana				
Gui, Add, Text, x131 y170 vStake6 Center, 000 / 0000	
	
;................................................................................................................................				
;......................................................... STAKE 7 ..............................................................
								
Gui, Font, s8 c%Color7%, Verdana				
Gui, Add, Text, x293 y70 vControl7 Center, $000.00
								
Gui, Font, s16 c%Color7%, Verdana				
Gui, Add, Text, x259 y82 vStake7 Center, 000 / 0000		

;......................................................... STAKE 8 ..............................................................
								
Gui, Font, s8 c%Color8%, Verdana				
Gui, Add, Text, x293 y114 vControl8 Center, $000.00
								
Gui, Font, s16 c%Color8%, Verdana			
Gui, Add, Text, x259 y126 vStake8 Center, 000 / 0000		
	
;......................................................... STAKE 9 ..............................................................
								
Gui, Font, s8 c%Color9%, Verdana				
Gui, Add, Text, x293 y158 vControl9 Center, $000.00
								
Gui, Font, s16 c%Color9%, Verdana			
Gui, Add, Text, x259 y170 vStake9 Center, 000 / 0000	

;................................................................................................................................
;....................................................... SEPARATOR2 .............................................................	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x66 y203 Center, %ABI%
	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x247 y203 Center, %Invest%

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y197 Center, ________

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x108 y197 Center, _________________

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x314 y197 Center, _______
;................................................................................................................................
;....................................................... ABI/INVEST .............................................................

Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x4 y224 vDollars Center, $0000.00 ($0000.00)	
								
Gui, Font, s11 c%NumColor%, Verdana					
Gui, Add, Text, x184 y224 vTotalABI Center, $00000.00 ($00000.00) 

;................................................................................................................................
;....................................................... SEPARATOR3 .............................................................	

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x25 y252 Center, %Gamesh%
	
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x160 y252 Center, %Clock%

Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x288 y252 Center, %Time%

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x4 y247 Center, ___

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x104 y247 Center, _______

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x216 y247 Center, _________

Gui, Font, s10 c%SeparatorColor%, Verdana					
Gui, Add, Text, x338 y247 Center, ____

;................................................................................................................................
;..................................................... GAMES/H / TIME ...........................................................	

Gui, Font, s14 c%NumColor%, Verdana					
Gui, Add, Text, x33 y271 vGames Center, 0000.0	

Gui, Font, s20 c%NumColor%, Verdana					
Gui, Add, Text, x147 y268 vClock Center, 00000	

Gui, Font, s14 c%NumColor%, Verdana					
Gui, Add, Text, x287 y271 vSessionTime Center, 00:00	

;====================================================== SECTION END =============================================================
;================================================================================================================================
;====================================================== MAIN SCRIPT =============================================================	

Loop, 9
	{
	N += 1
	IfInString, Stake%N%, .00
		StringReplace, Stake%N%b, Stake%N%, .00,
	else, Stake%N%b := Stake%N%	
	IfInString, Stake%N%b, +R
		StringReplace, Stake%N%b, Stake%N%b, +,
	}
	
N = 0

GuiControl,, ControlL, %ColumnL%
GuiControl,, ControlM, %ColumnM%
GuiControl,, ControlR, %ColumnR%
GuiControl,, Control1, %Stake1b%
GuiControl,, Control2, %Stake2b%
GuiControl,, Control3, %Stake3b%
GuiControl,, Control4, %Stake4b%
GuiControl,, Control5, %Stake5b%
GuiControl,, Control6, %Stake6b%
GuiControl,, Control7, %Stake7b%
GuiControl,, Control8, %Stake8b%
GuiControl,, Control9, %Stake9b%

Buyin_Total := 0.00
Buyin_Total_TournamentCounter := 0

H1 = 0
H2 = 0
M1 = 0
M2 = -1
S = 0

r0 = 0
r1 = 0
r2 = 0
r3 = 0
r4 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r9 = 0

t1 = 0
t2 = 0
t3 = 0
t4 = 0
t5 = 0
t6 = 0
t7 = 0
t8 = 0
t9 = 0

VPP1 = 0
VPP2 = 0
VPP3 = 0
VPP4 = 0
VPP5 = 0
VPP6 = 0
VPP7 = 0
VPP8 = 0
VPP9 = 0

FPP = 0

P = 0

Loop
{
;--------------------------------------------------------- STAKE 1 -----------------------------------------------------------
  
    v1 := 0
    v11 := 0
    v12 := 0
    v13 := 0
    v14 := 0
    v15 := 0
	v16 := 0
    c1 := 0
	
	If Type1 = 18
		{
		WinGet, v11,count, %Stake1% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v12,count, %Stake1% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type1 = HUSTT
		{
		WinGet, v11,count, %Stake1% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v12,count, %Stake1% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v13,count, %Stake1% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v14,count, %Stake1% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type1, "9-Max, Turbo",0)
		{
		WinGet, v11,count, %Stake1% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v12,count, %Stake1% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type1, "9-Max",0)
		{
		WinGet, v11,count, %Stake1% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v12,count, %Stake1% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v13,count, %Stake1% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v14,count, %Stake1% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v15,count, %Stake1% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v16,count, %Stake1% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v11, count, %Stake1% NL Hold'em [%Type1% ahk_class PokerStarsTableFrameClass
		}
	
	v1 := v11 + v12 + v13 + v14 + v15 + v16

    Loop, %v1%
    	{	
    	c1 += 1
    	}

    if (t1 = 0)
		{
		GuiControl,, Stake1, 0 / 0
    	r1 = 0
		}

    if (t1 < c1)
		{
		t1 := c1 - 1
		}

    if (c1 > r1)
    	{
		t1 += 1
    	GuiControl,, Stake1, %c1% / %t1%
    	r1 = %c1%
    	}

	else, if (c1 < r1)
    	{
		GuiControl,, Stake1, %c1% / %t1%
      	r1 = %c1%
    	}
;--------------------------------------------------------- STAKE 2 ------------------------------------------------------------
    
    v2 := 0
    v21 := 0
    v22 := 0
    v23 := 0
    v24 := 0
    v25 := 0
	v26 := 0
    c2 := 0
	
	If Type2 = 18
		{
		WinGet, v21,count, %Stake2% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v22,count, %Stake2% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type2 = HUSTT
		{
		WinGet, v21,count, %Stake2% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v22,count, %Stake2% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v23,count, %Stake2% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v24,count, %Stake2% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type2, "9-Max, Turbo",0)
		{
		WinGet, v21,count, %Stake2% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v22,count, %Stake2% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type2, "9-Max",0)
		{
		WinGet, v21,count, %Stake2% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v22,count, %Stake2% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v23,count, %Stake2% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v24,count, %Stake2% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v25,count, %Stake2% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v26,count, %Stake2% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v21, count, %Stake2% NL Hold'em [%Type2% ahk_class PokerStarsTableFrameClass
		}
	
	v2 := v21 + v22 + v23 + v24 + v25 + v26

    Loop, %v2%
    	{	
    	c2 += 1
    	}

    if (t2 = 0)
		{
		GuiControl,, Stake2, 0 / 0
    	r2 = 0
		}

    if (t2 < c2)
		{
		t2 := c2 - 1
		}

    if (c2 > r2)
    	{
		t2++
    	GuiControl,, Stake2, %c2% / %t2%
    	r2 = %c2%
    	}

	else, if (c2 < r2)
    	{
		GuiControl,, Stake2, %c2% / %t2%
      	r2 = %c2%
    	}
;--------------------------------------------------------- STAKE 3 ------------------------------------------------------------

    v3 := 0
    v31 := 0
    v32 := 0
    v33 := 0
    v34 := 0
    v35 := 0
	v36 := 0
    c3 := 0
	
	If Type3 = 18
		{
		WinGet, v31,count, %Stake3% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v32,count, %Stake3% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type3 = HUSTT
		{
		WinGet, v31,count, %Stake3% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v32,count, %Stake3% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v33,count, %Stake3% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v34,count, %Stake3% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type3, "9-Max, Turbo",0)
		{
		WinGet, v31,count, %Stake3% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v32,count, %Stake3% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type3, "9-Max",0)
		{
		WinGet, v31,count, %Stake3% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v32,count, %Stake3% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v33,count, %Stake3% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v34,count, %Stake3% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v35,count, %Stake3% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v36,count, %Stake3% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v31, count, %Stake3% NL Hold'em [%Type3% ahk_class PokerStarsTableFrameClass
		}
	
	v3 := v31 + v32 + v33 + v34 + v35 + v36
	
    Loop, %v3%
    	{	
    	c3 += 1
    	}

    if (t3 = 0)
		{
		GuiControl,, Stake3, 0 / 0
    	r3 = 0
		}

    if (t3 < c3)
		{
		t3 := c3 - 1
		}

    if (c3 > r3)
    	{
		t3++
    	GuiControl,, Stake3, %c3% / %t3%
     	r3 = %c3%
    	}

	else, if (c3 < r3)
    	{
		GuiControl,, Stake3, %c3% / %t3%
      	r3 = %c3%
    	}
;--------------------------------------------------------- STAKE 4 ------------------------------------------------------------

    v4 := 0
    v41 := 0
    v42 := 0
    v43 := 0
    v44 := 0
    v45 := 0
	v46 := 0
    c4 := 0
		
	If Type4 = 18
		{
		WinGet, v41,count, %Stake4% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v42,count, %Stake4% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type4 = HUSTT
		{
		WinGet, v41,count, %Stake4% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v42,count, %Stake4% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v43,count, %Stake4% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v44,count, %Stake4% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type4, "9-Max, Turbo",0)
		{
		WinGet, v41,count, %Stake4% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v42,count, %Stake4% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type4, "9-Max",0)
		{
		WinGet, v41,count, %Stake4% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v42,count, %Stake4% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v43,count, %Stake4% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v44,count, %Stake4% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v45,count, %Stake4% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v46,count, %Stake4% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v41, count, %Stake4% NL Hold'em [%Type4% ahk_class PokerStarsTableFrameClass
		}
	
	v4 := v41 + v42 + v43 + v44 + v45 + v46

    Loop, %v4%
    	{	
    	c4 += 1
    	}

    if (t4 = 0)
		{
		GuiControl,, Stake4, 0 / 0
    	r4 = 0
		}

    if (t4 < c4)
		{
		t4 := c4 - 1
		}

    if (c4 > r4)
    	{
		t4 += 1
    	GuiControl,, Stake4, %c4% / %t4%
    	 r4 = %c4%
    	}

	else, if (c4 < r4)
    	{
		GuiControl,, Stake4, %c4% / %t4%
      	r4 = %c4%
    	}
;--------------------------------------------------------- STAKE 5 ------------------------------------------------------------

    v5 := 0
    v51 := 0
    v52 := 0
    v53 := 0
    v54 := 0
    v55 := 0
	v56 := 0
    c5 := 0
	
	If Type5 = 18
		{
		WinGet, v51,count, %Stake5% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v52,count, %Stake5% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type5 = HUSTT
		{
		WinGet, v51,count, %Stake5% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v52,count, %Stake5% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v53,count, %Stake5% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v54,count, %Stake5% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type5, "9-Max, Turbo",0)
		{
		WinGet, v51,count, %Stake5% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v52,count, %Stake5% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type5, "9-Max",0)
		{
		WinGet, v51,count, %Stake5% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v52,count, %Stake5% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v53,count, %Stake5% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v54,count, %Stake5% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v55,count, %Stake5% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v56,count, %Stake5% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v51, count, %Stake5% NL Hold'em [%Type5% ahk_class PokerStarsTableFrameClass
		}
	
	v5 := v51 + v52 + v53 + v54 + v55 + v56

    Loop, %v5%
    	{	
    	c5 += 1
    	}

    if (t5 = 0)
		{
		GuiControl,, Stake5, 0 / 0
    	r5 = 0
		}

    if (t5 < c5)
		{
		t5 := c5 - 1
		}

    if (c5 > r5)
    	{
		t5++
    	GuiControl,, Stake5, %c5% / %t5%
    	r5 = %c5%
    	}

	else, if (c5 < r5)
    	{
		GuiControl,, Stake5, %c5% / %t5%
      	r5 = %c5%
    	}
;--------------------------------------------------------- STAKE 6 -----------------------------------------------------------
  
    v6 := 0
    v61 := 0
    v62 := 0
    v63 := 0
    v64 := 0
    v65 := 0
	v66 := 0
    c6 := 0
	
	If Type6 = 18
		{
		WinGet, v61,count, %Stake6% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v62,count, %Stake6% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type6 = HUSTT
		{
		WinGet, v61,count, %Stake6% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v62,count, %Stake6% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v63,count, %Stake6% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v64,count, %Stake6% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type6, "9-Max, Turbo",0)
		{
		WinGet, v61,count, %Stake6% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v62,count, %Stake6% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type6, "9-Max",0)
		{
		WinGet, v61,count, %Stake6% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v62,count, %Stake6% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v63,count, %Stake6% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v64,count, %Stake6% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v65,count, %Stake6% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v66,count, %Stake6% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v61, count, %Stake6% NL Hold'em [%Type6% ahk_class PokerStarsTableFrameClass
		}
	
	v6 := v61 + v62 + v63 + v64 + v65 + v66

    Loop, %v6%
    	{	
    	c6 += 1
    	}

    if (t6 = 0)
		{
		GuiControl,, Stake6, 0 / 0
    	r6 = 0
		}

    if (t6 < c6)
		{
		t6 := c6 - 1
		}

    if (c6 > r6)
    	{
		t6++
    	GuiControl,, Stake6, %c6% / %t6%
    	r6 = %c6%
    	}

	else, if (c6 < r6)
    	{
		GuiControl,, Stake6, %c6% / %t6%
      	r6 = %c6%
    	}
;--------------------------------------------------------- STAKE 7 ------------------------------------------------------------

    v7 := 0
    v71 := 0
    v72 := 0
    v73 := 0
    v74 := 0
    v75 := 0
	v76 := 0
    c7 := 0
	
	If Type7 = 18
		{
		WinGet, v71,count, %Stake7% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v72,count, %Stake7% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type7 = HUSTT
		{
		WinGet, v71,count, %Stake7% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v72,count, %Stake7% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v73,count, %Stake7% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v74,count, %Stake7% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type7, "9-Max, Turbo",0)
		{
		WinGet, v71,count, %Stake7% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v72,count, %Stake7% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type7, "9-Max",0)
		{
		WinGet, v71,count, %Stake7% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v72,count, %Stake7% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v73,count, %Stake7% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v74,count, %Stake7% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v75,count, %Stake7% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v76,count, %Stake7% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v71, count, %Stake7% NL Hold'em [%Type7% ahk_class PokerStarsTableFrameClass
		}
	
	v7 := v71 + v72 + v73 + v74 + v75 + v76

    Loop, %v7%
    	{	
    	c7 += 1
    	}

    if (t7 = 0)
		{
		GuiControl,, Stake7, 0 / 0
    	r7 = 0
		}

    if (t7 < c7)
		{
		t7 := c7 - 1
		}

    if (c7 > r7)
    	{
		t7++
    	GuiControl,, Stake7, %c7% / %t7%
    	r7 = %c7%
    	}

	else, if (c7 < r7)
    	{
		GuiControl,, Stake7, %c7% / %t7%
      	r7 = %c7%
    	}
;--------------------------------------------------------- STAKE 8 ------------------------------------------------------------

    v8 := 0
    v81 := 0
    v82 := 0
    v83 := 0
    v84 := 0
    v85 := 0
	v86 := 0
    c8 := 0
	
	If Type8 = 18
		{
		WinGet, v81,count, %Stake8% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v82,count, %Stake8% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type8 = HUSTT
		{
		WinGet, v81,count, %Stake8% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v82,count, %Stake8% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v83,count, %Stake8% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v84,count, %Stake8% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type8, "9-Max, Turbo",0)
		{
		WinGet, v81,count, %Stake8% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v82,count, %Stake8% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type8, "9-Max",0)
		{
		WinGet, v81,count, %Stake8% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v82,count, %Stake8% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v83,count, %Stake8% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v84,count, %Stake8% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v85,count, %Stake8% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v86,count, %Stake8% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v81, count, %Stake8% NL Hold'em [%Type8% ahk_class PokerStarsTableFrameClass
		}
	
	v8 := v81 + v82 + v83 + v84 + v85 + v86

    Loop, %v8%
    	{	
    	c8 += 1
    	}

    if (t8 = 0)
		{
		GuiControl,, Stake8, 0 / 0
    	r8 = 0
		}

    if (t8 < c8)
		{
		t8 := c8 - 1
		}

    if (c8 > r8)
    	{
		t8++
    	GuiControl,, Stake8, %c8% / %t8%
     	r8 = %c8%
    	}

	else, if (c8 < r8)
    	{
		GuiControl,, Stake8, %c8% / %t8%
      	r8 = %c8%
    	}
;--------------------------------------------------------- STAKE 9 ------------------------------------------------------------

    v9 := 0
    v91 := 0
    v92 := 0
    v93 := 0
    v94 := 0
    v95 := 0
	v96 := 0
    c9 := 0
	
	If Type9 = 18
		{
		WinGet, v91,count, %Stake9% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v92,count, %Stake9% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}
	else, if Type9 = HUSTT
		{
		WinGet, v91,count, %Stake9% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v92,count, %Stake9% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v93,count, %Stake9% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v94,count, %Stake9% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type9, "9-Max, Turbo",0)
		{
		WinGet, v91,count, %Stake9% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v92,count, %Stake9% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}
	else, if InStr(Type9, "9-Max",0)
		{
		WinGet, v91,count, %Stake9% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v92,count, %Stake9% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v93,count, %Stake9% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v94,count, %Stake9% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v95,count, %Stake9% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v96,count, %Stake9% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}
	else
		{
		WinGet, v91, count, %Stake9% NL Hold'em [%Type9% ahk_class PokerStarsTableFrameClass
		}
	
	v9 := v91 + v92 + v93 + v94 + v95 + v96

    Loop, %v9%
    	{	
    	c9 += 1
    	}

    if (t9 = 0)
		{
		GuiControl,, Stake9, 0 / 0
    	r9 = 0
		}

    if (t9 < c9)
		{
		t9 := c9 - 1
		}

    if (c9 > r9)
    	{
		t9++
    	GuiControl,, Stake9, %c9% / %t9%
    	 r9 = %c9%
    	}

	else, if (c9 < r9)
    	{
		GuiControl,, Stake9, %c9% / %t9%
      	r9 = %c9%
    	}
;--------------------------------------------------------- TOTALS -------------------------------------------------------------

    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9

    GuiControl,, TotalTables, %c0% / %t0%

    if (c0 < r0)
    	{
		If BustBox = 1
		SoundPlay, %SoundBust%
    	}
	
    r0 = %c0%

    if (c0 < MinMTRatio)
		{
		Gui, Font, s22 c%NumColor%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}
	else, if (c0 > MaxMTRatio) and (WarnBox = 1)
		{
		Gui, Font, s22 c%NumColorWarn%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}
	else, if GoalBox = 1
		{
		Gui, Font, s22 c%NumColorGoal%, Verdana
		Gui, Font, Bold
		GuiControl, Font, TotalTables
		}

    if (t0 = TotalLimit)
    	{
		If AchieveBox = 1
			SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}
;--------------------------------------------------------- BUYIN --------------------------------------------------------------

Buyin_Dollars:=0.00
Buyin_Dollars_TournamentCounter:=0
Buyin_Euro:=0.00
Buyin_Euro_TournamentCounter:=0
Buyin_Session:=0.00	
Buyin_Session_TournamentCounter:=0
		
Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass

Loop %Ps_Hwnd_List%
{
	Hwnd:=Ps_Hwnd_List%A_index%
	IF  !(Buyin_%hwnd%)
		{
		WingetTitle,Title,Ahk_id%Hwnd%
		IF Instr(Title,"Tournament")
			{
			IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
				{
 				BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
				Buyin_Total:=Round(Buyin_Total+Buyin_%Hwnd%,2)
			    	Buyin_Total_TournamentCounter+=1
				}
			}
		}			
}	

Loop,Parse,Buyin_Hwnd_List,`,,
{
        Hwnd:=A_LoopField      
	IF WinExist("ahk_id" Hwnd)
        	{
		Currency:=Buyin_%hwnd%_Currency	
		Buyin:=Round(Buyin_%hwnd%,2)
		IF (Currency="$")
			{	
			Buyin_Dollars:=Round(Buyin_Dollars+Buyin,2)
		        Buyin_Dollars_TournamentCounter+=1
			}
		Else  IF (Currency="€")
			{		
			Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
			Buyin_Euro_TournamentCounter+=1
			}		
		Buyin_Session:=Round(Buyin_Session+Buyin,2)
		Buyin_Session_TournamentCounter+=1
		}
	Else
                { 
		Temp_list:="," Buyin_Hwnd_List "," 
		StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
	        StringTrimLeft,Temp_list,Temp_list,1
		StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
		}
}	
	
IF (BuyIn_Dollars_Save != BuyIn_Dollars) Or (BuyIn_Euro_Save != BuyIn_Euro) 
{
	BuyIn_Euro_Save:=BuyIn_Euro	
	BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
	BuyIn_Dollars_Save:=BuyIn_Dollars
	BuyIn_Dollars_Avg:=Round(BuyIn_Dollars/BuyIn_Dollars_TournamentCounter,2)
	BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
	BuyIn_Total_Avg:=Round(BuyIn_Total/BuyIn_Total_TournamentCounter,2)
	
	IfInString, Buyin_Dollars_Avg, .00
		StringReplace, Buyin_Dollars_Avg, Buyin_Dollars_Avg, .00,
	
	IfInString, Buyin_Dollars, .00
		StringReplace, Buyin_Dollars, Buyin_Dollars, .00,
		
	IfInString, Buyin_Total_Avg, .00
		StringReplace, Buyin_Total_Avg, Buyin_Total_Avg, .00,
		
	IfInString, Buyin_Total, .00
		StringReplace, Buyin_Total, Buyin_Total, .00,
	
	GuiControl,,Dollars,% "$" Buyin_Dollars_Avg " ($" BuyIn_Total_Avg ")"
	GuiControl,,TotalABI,% "$" BuyIn_Dollars " ($" BuyIn_Total ")"
}

If (BuyIn_Total_Avg = 0)
	{
	Gui, Font, s11 c%NumColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
else, If (BuyIn_Total_Avg > MaxABI) or (BuyIn_Total_Avg < MinABI) and (WarnBox = 1)
	{
	Gui, Font, s11 c%NumColorWarn%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
else, If (BuyIn_Total_Avg <= MaxABI) and (BuyIn_Total_Avg >= MinABI) and (GoalBox = 1)
	{
	Gui, Font, s11 c%NumColorGoal%, Verdana
	Gui, Font, Norm
	GuiControl, Font, Dollars
	}
	
If (BuyIn_Total > MaxInvest) and (WarnBox = 1)
	{
	Gui, Font, s11 c%NumColorWarn%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}
else
	{
	Gui, Font, s11 c%NumColor%, Verdana
	Gui, Font, Norm
	GuiControl, Font, TotalABI
	}

GetBuyin(Title,byref currency="",Byref BuyinText="")
	{
	Static CurrencyList:="$,€"
 	Haystack:=Substr(Title, Instr(Title,"Sat:")+1) ;This is for satiliets
    Loop,Parse,Currencylist,`,
    	{
        IF ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
          	{          
           	BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
         	Currency=%A_loopField%
          	Buyin:=BuyinText
	  		StringReplace,Buyin,Buyin,%Currency%,, 
			IfInString, Buyin, +R
				{	
          		StringReplace,Buyin,Buyin,+R,, 
				RebuyMulti = 3
				Buyin := Buyin * RebuyMulti					
				}
             
			IF Buyin is not number
				{ 
				Buyin:=0
				currency:=
				buyinText:=    
				}
			Break     
			}
		}
	Return Buyin 
	}
		
;---------------------------------------------------------- VPP --------------------------------------------------------------

	VPP1 := t1 * Stake1VPP
	VPP2 := t2 * Stake2VPP
	VPP3 := t3 * Stake3VPP
	VPP4 := t4 * Stake4VPP
	VPP5 := t5 * Stake5VPP
	VPP6 := t6 * Stake6VPP
	VPP7 := t7 * Stake7VPP
	VPP8 := t8 * Stake8VPP
	VPP9 := t9 * Stake9VPP
	
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)
	
	
	IfInString, VPP, .00
		StringReplace, VPP, VPP, .00,
		
	Loop, 9
		{
		N += 1
		IfInString, VPP, .%N%0
			{
			StringTrimRight, VPP, VPP, 1
			break
			}	
		}
		
	N = 0

    GuiControl,, VPP, %VPP%
	
	If (VPP >= VPPGoal) and (GoalBox = 1)
		{
		Gui, Font, s11 c%NumColorGoal%, Verdana
		GuiControl, Font, VPP
		GuiControl, Font, FPP
		}
		
;---------------------------------------------------------- FPP ---------------------------------------------------------------

	FPP := VPP * VIPMulti
	
	FPP := Round(FPP,2)
	
	IfInString, FPP, .00
		StringReplace, FPP, FPP, .00,
				
	Loop, 9
		{
		N += 1
		IfInString, FPP, .%N%0
			{
			StringTrimRight, FPP, FPP, 1
			break
			}	
		}
		
	N = 0

    GuiControl,, FPP, %FPP%
	
;--------------------------------------------------------- CLOCK --------------------------------------------------------------

FormatTime, Time, %A_Now%, H:mm
GuiControl,, Clock, %Time%
StringTrimLeft, TimeOnly, A_Now, 10
StringTrimRight, Minutes, TimeOnly, 2
If BreakBox = 1
	{
	IfGreaterOrEqual, Minutes, 55
		{
		Gui, Font, s20 c%ClockColorBreak%
		Gui, Font, Bold
		GuiControl, Font, Clock
		}
	else
		{
		Gui, Font, s20 c%NumColor%
		Gui, Font, Bold
		GuiControl, Font, Clock
		}
	}
else
	{
	Gui, Font, s20 c%NumColor%
	Gui, Font, Bold
	GuiControl, Font, Clock
	}
;------------------------------------------------------- SESSION TIME ----------------------------------------------------------

If (Minutes != Var)
	{
	M2 += 1
	Var := Minutes
	}

If (M2 > 9)
	{
	M1 += 1
	M2 = 0
	}

If (M1 > 5)
	{
	H2 += 1
	M1 = 0
	M2 = 0
	}

If (H2 > 9)
	{
	H1 += 1
	H2 = 0
	M1 = 0
	M2 = 0
	}
	
Runtime = %H1%%H2%:%M1%%M2%

If (Runtime >= SessionTimeGoal) and (GoalBox = 1)
	{
	Gui, Font, s14 c%NumColorGoal%, Verdana
	Gui, Font, Norm
	GuiControl, Font, SessionTime
	}
	
If (H1 = 0)
	GuiControl,, SessionTime, %H2%:%M1%%M2%
else, GuiControl,, SessionTime, %H1%%H2%:%M1%%M2%
	
;--------------------------------------------------------- GAMES/H -------------------------------------------------------------

S := ((H1 * 600) + (H2 * 60) + (M1 * 10) + M2) / 60
S := Round(S,6)

Games := (t0 - c0) / S
Games := Round(Games,1)

IfInString, Games, .0
	StringReplace, Games, Games, .0,

If (H2 < 1)
	Games := t0 - c0

If (Games = 0)
	Games = N/A
GuiControl,, Games, %Games%

;-------------------------------------------------------- INTERVAL -------------------------------------------------------------

   Sleep %LoopInterval%

}
return

;----------------------------------------------------- MENU HANDLERS -----------------------------------------------------------
;----------------------------------------------------- SETTINGS GUI ------------------------------------------------------------

TrayMenuHdlr_Bring:
WinActivate, SessionMan %Build% ahk_class AutoHotkeyGUI
return

TrayMenuHdlr_Position:
WinGetPos, xpos, ypos,,, SessionMan %Build% ahk_class AutoHotkeyGUI
IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
return

TrayMenuHdlr_Reload:
Reload
return

TrayMenuHdlr_Log:
IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
If Logging = false  
	{
	IniWrite, true, %A_ScriptDir%\SessionMan.ini, Logging, Log
	IfNotExist, %A_ScriptDir%\SessionMan.log.ini
		{
		IniWrite, 1, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
		}
	Menu Tray, Check, Enable Logging
	GoSub CheckLogging
	}
else
	{
	IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log	
	Menu Tray, Uncheck, Enable Logging
	}
return	

TrayMenuHdlr_Logfile:
Run, %A_ScriptDir%\SessionMan.log.ini
return

TrayMenuHdlr_ClrLog:
MsgBox, 4, SessionMan - Clear Logfile, Do you want to clear the logfile?
IfMsgBox OK
{
IfWinExist, SessionMan.log.ini
	WinClose, SessionMan.log.ini
FileDelete, %A_ScriptDir%\SessionMan.log.ini
FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
GoSub CheckLogging
}
return

TrayMenuHdlr_Config:
IfWinExist, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
	WinActivate, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
else, GoSub MenuHdlr_ConfigGUI
return

TrayMenuHdlr_Pause:
if A_IsPaused
	{
	Pause off
	Menu Tray, Uncheck, Pause/Continue
	}
else
	{
	Menu Tray, Check, Pause/Continue
	Pause On
	}
return

TrayMenuHdlr_Exit:
GoSub CreateLog
ExitApp
return

;----------------------------------------------------- SETTINGS GUI ------------------------------------------------------------

MenuHdlr_ConfigGUI:
Menu, HelpMenu, Add, Help, MenuHdlr_Help
Menu, HelpMenu, Add, WindowSpy, MenuHdlr_WinSpy
Menu, HelpMenu, Add, Color Codes (Web), MenuHdlr_WebColors
Menu, Menubar, Add, Help, :HelpMenu
Gui, 2:Menu, MenuBar

Gui, 2:Add, Tab, x-4 y0 w500 h750 , Stakes|Options|Hotkeys|Types
Gui, 2:Tab, Stakes
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x8 y32 w100 h40 , Captions:
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Edit, x31 y50 w50 h20 vColumnL, %ColumnL%
Gui, 2:Add, Edit, x141 y50 w50 h20 vColumnM, %ColumnM%
Gui, 2:Add, Edit, x251 y50 w50 h20 vColumnR, %ColumnR%
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x8 y82 w50 h20 , Stakes:
Gui, 2:Font, S8 Cff0000 norm
Gui, 2:Add, Text, x55 y82 w400 h20 , For rebuy games, include the "+R" appendix in the buy-in
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Edit, x6 y100 w100 h20 vStake1, %Stake1%
Gui, 2:Add, Edit, x6 y120 w100 h20 vStake2, %Stake2%
Gui, 2:Add, Edit, x6 y140 w100 h20 vStake3, %Stake3%
Gui, 2:Add, Edit, x116 y100 w100 h20 vStake4, %Stake4%
Gui, 2:Add, Edit, x116 y120 w100 h20 vStake5, %Stake5%
Gui, 2:Add, Edit, x116 y140 w100 h20 vStake6, %Stake6%
Gui, 2:Add, Edit, x226 y100 w100 h20 vStake7, %Stake7%
Gui, 2:Add, Edit, x226 y120 w100 h20 vStake8, %Stake8%
Gui, 2:Add, Edit, x226 y140 w100 h20 vStake9, %Stake9%
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x8 y172 w80 h20 , Game Types:
Gui, 2:Font, S8 Cff0000 norm
Gui, 2:Add, Text, x87 y172 w400 h20 , See "Types" Tab
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Edit, x6 y190 w100 h20 vType1, %Type1%
Gui, 2:Add, Edit, x6 y210 w100 h20 vType2, %Type2%
Gui, 2:Add, Edit, x6 y230 w100 h20 vType3, %Type3%
Gui, 2:Add, Edit, x116 y190 w100 h20 vType4, %Type4%
Gui, 2:Add, Edit, x116 y210 w100 h20 vType5, %Type5%
Gui, 2:Add, Edit, x116 y230 w100 h20 vType6, %Type6%
Gui, 2:Add, Edit, x226 y190 w100 h20 vType7, %Type7%
Gui, 2:Add, Edit, x226 y210 w100 h20 vType8, %Type8%
Gui, 2:Add, Edit, x226 y230 w100 h20 vType9, %Type9%
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x8 y262 w100 h20 , VPP:
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Edit, x6 y280 w100 h20 vStake1VPP, %Stake1VPP%
Gui, 2:Add, Edit, x6 y300 w100 h20 vStake2VPP, %Stake2VPP%
Gui, 2:Add, Edit, x6 y320 w100 h20 vStake3VPP, %Stake3VPP%
Gui, 2:Add, Edit, x116 y280 w100 h20 vStake4VPP, %Stake4VPP%
Gui, 2:Add, Edit, x116 y300 w100 h20 vStake5VPP, %Stake5VPP%
Gui, 2:Add, Edit, x116 y320 w100 h20 vStake6VPP, %Stake6VPP%
Gui, 2:Add, Edit, x226 y280 w100 h20 vStake7VPP, %Stake7VPP%
Gui, 2:Add, Edit, x226 y300 w100 h20 vStake8VPP, %Stake8VPP%
Gui, 2:Add, Edit, x226 y320 w100 h20 vStake9VPP, %Stake9VPP%
Gui, 2:Font, S8 CDefault Bold
If ColorsBox = 1
	Gui, 2:Add, CheckBox, x8 y350 w105 h20 Checked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
else
	Gui, 2:Add, CheckBox, x8 y350 w105 h20 Unchecked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
Gui, 2:Font, S8 Cff0000 norm
Gui, 2:Add, Text, x116 y353 w220 h20 , Colors reset to default if disabled
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Edit, x6 y370 w100 h20 vColor1, %Color1%
Gui, 2:Add, Edit, x6 y390 w100 h20 vColor2, %Color2%
Gui, 2:Add, Edit, x6 y410 w100 h20 vColor3, %Color3%
Gui, 2:Add, Edit, x116 y370 w100 h20 vColor4, %Color4%
Gui, 2:Add, Edit, x116 y390 w100 h20 vColor5, %Color5%
Gui, 2:Add, Edit, x116 y410 w100 h20 vColor6, %Color6%
Gui, 2:Add, Edit, x226 y370 w100 h20 vColor7, %Color7%
Gui, 2:Add, Edit, x226 y390 w100 h20 vColor8, %Color8%
Gui, 2:Add, Edit, x226 y410 w100 h20 vColor9, %Color9%
Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
Gui, 2:Font, S8 Cff0000 Bold
Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script

Gui, 2:Tab, Options
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Text, x8 y32 w220 h20 , Window Background Color
Gui, 2:Add, Edit, x226 y30 w100 h20 vGUIColor, %GUIColor%
Gui, 2:Add, Text, x8 y52 w220 h20 , Default Number Color
Gui, 2:Add, Edit, x226 y50 w100 h20 vNumColor, %NumColor%
Gui, 2:Add, Text, x8 y72 w220 h20 , Default Text Color
Gui, 2:Add, Edit, x226 y70 w100 h20 vTextColor, %TextColor%
Gui, 2:Add, Text, x8 y92 w220 h20 , Separator Color
Gui, 2:Add, Edit, x226 y90 w100 h20 vSeparatorColor, %SeparatorColor%
If GoalBox = 1
	Gui, 2:Add, CheckBox, x8 y110 w200 h20 Checked%GoalBox% vGoalBox, Achievement Color
else
	Gui, 2:Add, CheckBox, x8 y110 w200 h20 Unchecked%GoalBox% vGoalBox, Achievement Color
Gui, 2:Add, Edit, x226 y110 w100 h20 vNumColorGoal, %NumColorGoal%
If WarnBox = 1
	Gui, 2:Add, CheckBox, x8 y130 w200 h20 Checked%WarnBox% vWarnBox, Warning Color
else
	Gui, 2:Add, CheckBox, x8 y130 w200 h20 Unchecked%WarnBox% vWarnBox, Warning Color
Gui, 2:Add, Edit, x226 y130 w100 h20 vNumColorWarn, %NumColorWarn%
If BreakBox = 1
	Gui, 2:Add, CheckBox, x8 y150 w200 h20 Checked%BreakBox% vBreakBox, Sync Break Clock Color
else
	Gui, 2:Add, CheckBox, x8 y150 w200 h20 Unchecked%BreakBox% vBreakBox, Sync Break Clock Color
Gui, 2:Add, Edit, x226 y150 w100 h20 vClockColorBreak, %ClockColorBreak%
Gui, 2:Add, Text, x8 y182 w220 h20 , Multitabling Ratio (Min)
Gui, 2:Add, Edit, x226 y180 w100 h20 vMinMTRatio, %MinMTRatio%
Gui, 2:Add, Text, x8 y202 w220 h20 , Multitabling Ratio (Max)
Gui, 2:Add, Edit, x226 y200 w100 h20 vMaxMTRatio, %MaxMTRatio%
Gui, 2:Add, Text, x8 y222 w220 h20 , Destinated Games Per Session
Gui, 2:Add, Edit, x226 y220 w100 h20 vTotalLimit, %TotalLimit%
Gui, 2:Add, Text, x8 y242 w220 h20 , Destinated Session Time (hh:mm)
Gui, 2:Add, Edit, x226 y240 w100 h20 vSessionTimeGoal, %SessionTimeGoal%
Gui, 2:Add, Text, x8 y262 w220 h20 , ABI (Min)
Gui, 2:Add, Text, x218 y262 w8 h20 , $
Gui, 2:Add, Edit, x226 y260 w100 h20 vMinABI, %MinABI%
Gui, 2:Add, Text, x8 y282 w220 h20 , ABI (Max)
Gui, 2:Add, Text, x218 y282 w8 h20 , $
Gui, 2:Add, Edit, x226 y280 w100 h20 vMaxABI, %MaxABI%
Gui, 2:Add, Text, x8 y302 w220 h20 , Investment Limit
Gui, 2:Add, Text, x218 y302 w8 h20 , $
Gui, 2:Add, Edit, x226 y300 w100 h20 vMaxInvest, %MaxInvest%
Gui, 2:Add, Text, x8 y322 w220 h20 , VPP Goal
Gui, 2:Add, Edit, x226 y320 w100 h20 vVPPGoal, %VPPGoal%
Gui, 2:Add, Text, x8 y342 w220 h20 , VIP Multiplicator
Gui, 2:Add, Edit, x226 y340 w100 h20 vVIPMulti, %VIPMulti%
If BustBox = 0
	Gui, 2:Add, CheckBox, x8 y370 w100 h20 Unchecked%BustBox% vBustBox, Bustout Sound
else
	Gui, 2:Add, CheckBox, x8 y370 w100 h20 Checked%BustBox% vBustBox, Bustout Sound
Gui, 2:Add, Edit, x126 y370 w200 h20 vSoundBust, %SoundBust%
If AchieveBox = 0
	Gui, 2:Add, CheckBox, x8 y390 w115 h20 Unchecked%GoalBox% vAchieveBox, Achievement Sound
else
	Gui, 2:Add, CheckBox, x8 y390 w115 h20 Checked%GoalBox% vAchieveBox, Achievement Sound
Gui, 2:Add, Edit, x126 y390 w200 h20 vSoundAchieve, %SoundAchieve%
Gui, 2:Add, Text, x14 y407 w20 h14 , |_
If (IntervalBox = 1) and (AchieveBox = 1)
	Gui, 2:Add, CheckBox, x28 y410 w200 h20 Checked%IntervalBox% vIntervalBox, Repetition Interval
else
	Gui, 2:Add, CheckBox, x28 y410 w200 h20 Unchecked%IntervalBox% vIntervalBox, Repetition Interval
Gui, 2:Add, Edit, x226 y410 w100 h20 vSoundInterval, %SoundInterval%
Gui, 2:Add, Text, x34 y426 w30 h20 , |__
Gui, 2:Add, Text, x55 y432 w400 h20 ,This sound applies only for "Destinated Games"
Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
Gui, 2:Font, S8 Cff0000 Bold
Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script

Gui, 2:Tab, Hotkeys
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x6 y30 w240 h20 , Table Slots
Gui, 2:Font, S8 CDefault norm
Gui, 2:Add, Text, x110 y30 w240 h20 , X
Gui, 2:Add, Text, x160 y30 w240 h20 , Y
Gui, 2:Add, Text, x210 y30 w240 h20 , Hotkey
Gui, 2:Add, Text, x8 y52 w80 h20 , Slot 1 
Gui, 2:Add, Edit, x106 y50 w40 h20 vSlotA1x, %SlotA1x%
Gui, 2:Add, Edit, x156 y50 w40 h20 vSlotA1y, %SlotA1y%
Gui, 2:Add, Edit, x206 y50 w120 h20 vSlotA1Key, %SlotA1Key%
Gui, 2:Add, Text, x8 y72 w240 h20 , Slot 2
Gui, 2:Add, Edit, x106 y70 w40 h20 vSlotA2x, %SlotA2x%
Gui, 2:Add, Edit, x156 y70 w40 h20 vSlotA2y, %SlotA2y%
Gui, 2:Add, Edit, x206 y70 w120 h20 vSlotA2Key, %SlotA2Key%
Gui, 2:Add, Text, x8 y92 w240 h20 , Slot 3
Gui, 2:Add, Edit, x106 y90 w40 h20 vSlotA3x, %SlotA3x%
Gui, 2:Add, Edit, x156 y90 w40 h20 vSlotA3y, %SlotA3y%
Gui, 2:Add, Edit, x206 y90 w120 h20 vSlotA3Key, %SlotA3Key%
Gui, 2:Add, Text, x8 y112 w240 h20 , Slot 4
Gui, 2:Add, Edit, x106 y110 w40 h20 vSlotA4x, %SlotA4x%
Gui, 2:Add, Edit, x156 y110 w40 h20 vSlotA4y, %SlotA4y%
Gui, 2:Add, Edit, x206 y110 w120 h20 vSlotA4Key, %SlotA4Key%
Gui, 2:Add, Text, x8 y132 w80 h20 , Slot 5 
Gui, 2:Add, Edit, x106 y130 w40 h20 vSlotB1x, %SlotB1x%
Gui, 2:Add, Edit, x156 y130 w40 h20 vSlotB1y, %SlotB1y%
Gui, 2:Add, Edit, x206 y130 w120 h20 vSlotB1Key, %SlotB1Key%
Gui, 2:Add, Text, x8 y152 w240 h20 , Slot 6
Gui, 2:Add, Edit, x106 y150 w40 h20 vSlotB2x, %SlotB2x%
Gui, 2:Add, Edit, x156 y150 w40 h20 vSlotB2y, %SlotB2y%
Gui, 2:Add, Edit, x206 y150 w120 h20 vSlotB2Key, %SlotB2Key%
Gui, 2:Add, Text, x8 y172 w240 h20 , Slot 7
Gui, 2:Add, Edit, x106 y170 w40 h20 vSlotB3x, %SlotB3x%
Gui, 2:Add, Edit, x156 y170 w40 h20 vSlotB3y, %SlotB3y%
Gui, 2:Add, Edit, x206 y170 w120 h20 vSlotB3Key, %SlotB3Key%
Gui, 2:Add, Text, x8 y192 w240 h20 , Slot 8
Gui, 2:Add, Edit, x106 y190 w40 h20 vSlotB4x, %SlotB4x%
Gui, 2:Add, Edit, x156 y190 w40 h20 vSlotB4y, %SlotB4y%
Gui, 2:Add, Edit, x206 y190 w120 h20 vSlotB4Key, %SlotB4Key%
Gui, 2:Add, Text, x8 y212 w80 h20 , Slot 9 
Gui, 2:Add, Edit, x106 y210 w40 h20 vSlotC1x, %SlotC1x%
Gui, 2:Add, Edit, x156 y210 w40 h20 vSlotC1y, %SlotC1y%
Gui, 2:Add, Edit, x206 y210 w120 h20 vSlotC1Key, %SlotC1Key%
Gui, 2:Add, Text, x8 y232 w240 h20 , Slot 10
Gui, 2:Add, Edit, x106 y230 w40 h20 vSlotC2x, %SlotC2x%
Gui, 2:Add, Edit, x156 y230 w40 h20 vSlotC2y, %SlotC2y%
Gui, 2:Add, Edit, x206 y230 w120 h20 vSlotC2Key, %SlotC2Key%
Gui, 2:Add, Text, x8 y252 w240 h20 , Slot 11
Gui, 2:Add, Edit, x106 y250 w40 h20 vSlotC3x, %SlotC3x%
Gui, 2:Add, Edit, x156 y250 w40 h20 vSlotC3y, %SlotC3y%
Gui, 2:Add, Edit, x206 y250 w120 h20 vSlotC3Key, %SlotC3Key%
Gui, 2:Add, Text, x8 y272 w240 h20 , Slot 12
Gui, 2:Add, Edit, x106 y270 w40 h20 vSlotC4x, %SlotC4x%
Gui, 2:Add, Edit, x156 y270 w40 h20 vSlotC4y, %SlotC4y%
Gui, 2:Add, Edit, x206 y270 w120 h20 vSlotC4Key, %SlotC4Key%
Gui, 2:Add, Text, x8 y302 w180 h20 , Reset Session Time
Gui, 2:Add, Edit, x206 y300 w120 h20 vReset, %Reset%
Gui, 2:Add, Text, x8 y322 w180 h20 , Increase Session Time By 1
Gui, 2:Add, Edit, x206 y320 w120 h20 vIncrease, %Increase%
Gui, 2:Add, Text, x8 y342 w180 h20 , Pause/Continue
Gui, 2:Add, Edit, x206 y340 w120 h20 vPause, %Pause%
Gui, 2:Add, Text, x8 y362 w180 h20 , Close
Gui, 2:Add, Edit, x206 y360 w120 h20 vClose, %Close%
Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
Gui, 2:Font, S8 Cff0000 Bold
Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script

Gui, 2:Tab, Types
Gui, 2:Font, S8 CDefault Bold
Gui, 2:Add, Text, x8 y32 w240 h20 , Game Types Description: 
Gui, 2:Font, S8 CDefault norm
;Gui, 2:Add, Text, x8 y60 w400 h20 , Game Types refer to the term between the square brackets in nnnn
Gui, 2:Add, Text, x8 y60 w400 h20 , Game Types refer %A_Space%to %A_Space%the term %A_Space%inside %A_Space%the square brackets %A_Space%in %A_Space%the
Gui, 2:Add, Text, x8 y77 w400 h20 , target windows' %A_Space%titles. For 9max regular speed games, whose titles
Gui, 2:Add, Text, x8 y94 w400 h20 , lack such a term, %A_Space% just type "9-Max", and for 9max turbos just type  
Gui, 2:Add, Text, x8 y111 w400 h20, "Turbo". The following definitions group games as described:    
Gui, 2:Add, Text, x8 y128 w400 h20,     
Gui, 2:Font, S8 CDefault Bold     
Gui, 2:Add, Text, x8 y145 w400 h20, HU 
Gui, 2:Add, Text, x8 y162 w400 h20, HUSTT    
Gui, 2:Add, Text, x8 y179 w400 h20, 6-Max    
Gui, 2:Add, Text, x8 y196 w400 h20, 9-Max, Turbo 
Gui, 2:Add, Text, x8 y213 w400 h20, 18    
Gui, 2:Add, Text, x8 y230 w400 h20, 45   
Gui, 2:Add, Text, x8 y247 w400 h20, 180       
Gui, 2:Add, Text, x8 y264 w400 h20, 180 Players, Turbo      
Gui, 2:Add, Text, x8 y281 w400 h20,          
Gui, 2:Font, S8 CDefault norm     
Gui, 2:Add, Text, x130 y145 w400 h20, - any heads up SNG, including MTSNG
Gui, 2:Add, Text, x130 y162 w400 h20, - any heads up STT
Gui, 2:Add, Text, x130 y179 w400 h20, - any 6-handed STT     
Gui, 2:Add, Text, x130 y196 w400 h20, - 9-handed turbos and KO's    
Gui, 2:Add, Text, x130 y213 w400 h20, - any 9-handed 18man SNG      
Gui, 2:Add, Text, x130 y230 w400 h20, - any 45 player SNG      
Gui, 2:Add, Text, x130 y247 w400 h20, - any 180 player SNG    
Gui, 2:Add, Text, x130 y264 w400 h20, - any 180 player turbo SNG  
Gui, 2:Add, Text, x130 y281 w400 h20,  
Gui, 2:Add, Text, x8 y298 w400 h20, To avoid accidental groupings, make sure to define the whole term
Gui, 2:Add, Text, x8 y315 w400 h20, inside the brackets. For examle, don't just type %A_Space%"18 Players" %A_Space%if you 
Gui, 2:Add, Text, x8 y332 w400 h20, want to define 18man turbos; Instead, type "18 Players, Turbo".   

;Gui, 2:Tab, About
;Gui, 2:Font, S8 CDefault norm
;Gui, 2:Add, Text, x134 y80 w240 h20 , SessionMan 
;Gui, 2:Add, Text, x132 y100 w240 h20 , Version %Build%

Gui, 2:-SysMenu
Gui, 2:Show, h500 w334, Settings - SessionMan %Build%
return

MenuHdlr_Help:
IfWinExist AutoHotkey Help
    WinActivate
else
	{    
    RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
    Run %ahkInstallDir%\AutoHotKey.chm
	}
return

MenuHdlr_WinSpy:
RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
Run %ahkInstallDir%\AU3_Spy.exe
return

MenuHdlr_WebColors:
Gui, 3:Font, S9 C000000 
Gui, 3:Add, Text, x10 y8 w180 h20, Can't access browser. Please visit:
Gui, 3:Add, Edit, x20 y30 w142 h20 vMyEdit, http://html-color-codes.info/
Gui, 3:Add, Button, x65 y60 w50 h20 gCancel,Cancel
Gui, 3:-SysMenu
Gui, 3:Show, h90 w185, Error 
return

Save:
IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x, 4
IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y, 4
IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log, false 
Gui, Submit
FileDelete, %A_ScriptDir%\SessionMan.ini
GoSub CheckIni
GoSub UpdateIni
Reload
return

Cancel:
Gui, Destroy
Return

;-------------------------------------------------------- LABELS ---------------------------------------------------------------
CheckIni:
	IfNotExist, %A_ScriptDir%\SessionMan.ini
		{
		IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, x
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, y
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log
		}
return	

CheckLogging:
	IfNotExist, %A_ScriptDir%\SessionMan.log.ini
		IniWrite, 0 (logging disabled), %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = true 
		{
		IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		IniRead, GamesLogged, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		If GamesLogged != 0 Game(s)
			{
			SessionCount += 1
			IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}
		IniWrite, %Start% CET, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Start
		IniWrite, still running, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
		IniWrite, N/A, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		Menu Tray, Check, Enable Logging
		}
return

CreateLog:
IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
If Logging = true
	{
	IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
	IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
	
	FormatTime, Finish, %A_Now%, ddd d.M.yyyy H:mm:ss
	IniWrite, %Finish% CET, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
	IniWrite, %H1%%H2%:%M1%%M2%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
	Completed := t0 - c0
	IniWrite, %t0% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
	IniWrite, %Completed% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
	;IniWrite, %c0% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Running
	If Completed != 0
		{
		If (H = 0) and (M1 = 0) and (M2 = 0)
			Games := Completed
		IniWrite, %Games%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Games/h
		IniWrite, $%BuyIn_Total_Avg%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, ABI
		IniWrite, $%BuyIn_Total%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Invest
		IniWrite, %VPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, VPP
		IniWrite, %FPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, FPP
		FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
		}
	}
return

UpdateIni:
IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
FileAppend, `n, %A_ScriptDir%\SessionMan.ini
IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
FileAppend, `n, %A_ScriptDir%\SessionMan.ini
IniWrite, %Logging%, %A_ScriptDir%\SessionMan.ini, Logging, Log
If ColumnL
	IniWrite, %ColumnL%, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnL
If ColumnM
	IniWrite, %ColumnM%, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnM
If ColumnR
	IniWrite, %ColumnR%, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnR
If Stake1
	IniWrite, %Stake1%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1
If Stake2
	IniWrite, %Stake2%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2
If Stake3
	IniWrite, %Stake3%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3
If Stake4
	IniWrite, %Stake4%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4
If Stake5
	IniWrite, %Stake5%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5
If Stake6
	IniWrite, %Stake6%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6
If Stake7
	IniWrite, %Stake7%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7
If Stake8
	IniWrite, %Stake8%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8
If Stake9
	IniWrite, %Stake9%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9
If Type1
	IniWrite, %Type1%, %A_ScriptDir%\SessionMan.ini, Stakes, Type1
If Type2
	IniWrite, %Type2%, %A_ScriptDir%\SessionMan.ini, Stakes, Type2
If Type3
	IniWrite, %Type3%, %A_ScriptDir%\SessionMan.ini, Stakes, Type3
If Type4
	IniWrite, %Type4%, %A_ScriptDir%\SessionMan.ini, Stakes, Type4
If Type5
	IniWrite, %Type5%, %A_ScriptDir%\SessionMan.ini, Stakes, Type5
If Type6
	IniWrite, %Type6%, %A_ScriptDir%\SessionMan.ini, Stakes, Type6
If Type7
	IniWrite, %Type7%, %A_ScriptDir%\SessionMan.ini, Stakes, Type7
If Type8
	IniWrite, %Type8%, %A_ScriptDir%\SessionMan.ini, Stakes, Type8
If Type9
	IniWrite, %Type9%, %A_ScriptDir%\SessionMan.ini, Stakes, Type9
If Stake1VPP
	IniWrite, %Stake1VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP
If Stake2VPP
	IniWrite, %Stake2VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP
If Stake3VPP
	IniWrite, %Stake3VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP
If Stake4VPP
	IniWrite, %Stake4VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP
If Stake5VPP
	IniWrite, %Stake5VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP
If Stake6VPP
	IniWrite, %Stake6VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP
If Stake7VPP
	IniWrite, %Stake7VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP
If Stake8VPP
	IniWrite, %Stake8VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP
If Stake9VPP
	IniWrite, %Stake9VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP
If ColorsBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
If Color1
	IniWrite, %Color1%, %A_ScriptDir%\SessionMan.ini, Stakes, Color1
If Color2
	IniWrite, %Color2%, %A_ScriptDir%\SessionMan.ini, Stakes, Color2
If Color3
	IniWrite, %Color3%, %A_ScriptDir%\SessionMan.ini, Stakes, Color3
If Color4
	IniWrite, %Color4%, %A_ScriptDir%\SessionMan.ini, Stakes, Color4
If Color5
	IniWrite, %Color5%, %A_ScriptDir%\SessionMan.ini, Stakes, Color5
If Color6
	IniWrite, %Color6%, %A_ScriptDir%\SessionMan.ini, Stakes, Color6
If Color7
	IniWrite, %Color7%, %A_ScriptDir%\SessionMan.ini, Stakes, Color7
If Color8
	IniWrite, %Color8%, %A_ScriptDir%\SessionMan.ini, Stakes, Color8
If Color9
	IniWrite, %Color9%, %A_ScriptDir%\SessionMan.ini, Stakes, Color9
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
If GUIColor
	IniWrite, %GUIColor%, %A_ScriptDir%\SessionMan.ini, Options, GUIColor
If NumColor
	IniWrite, %NumColor%, %A_ScriptDir%\SessionMan.ini, Options, NumColor
If TextColor
	IniWrite, %TextColor%, %A_ScriptDir%\SessionMan.ini, Options, TextColor
If SeparatorColor
	IniWrite, %SeparatorColor%, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor
If GoalBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
If NumColorGoal
	IniWrite, %NumColorGoal%, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal
If WarnBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
If NumColorWarn
	IniWrite, %NumColorWarn%, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn
If BreakBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
If ClockColorBreak
	IniWrite, %ClockColorBreak%, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak
If MinMTRatio
	IniWrite, %MinMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio
If MaxMTRatio
	IniWrite, %MaxMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio
If TotalLimit
	IniWrite, %TotalLimit%, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit
If SessionTimeGoal
	IniWrite, %SessionTimeGoal%, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal
If MinABI
	IniWrite, %MinABI%, %A_ScriptDir%\SessionMan.ini, Options, MinABI
If MaxABI
	IniWrite, %MaxABI%, %A_ScriptDir%\SessionMan.ini, Options, MaxABI
If MaxInvest
	IniWrite, %MaxInvest%, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest
If VPPGoal
	IniWrite, %VPPGoal%, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal
If VIPMulti
	IniWrite, %VIPMulti%, %A_ScriptDir%\SessionMan.ini, Options, VIPMulti
If BustBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BustBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BustBox
If SoundBust
	IniWrite, %SoundBust%, %A_ScriptDir%\SessionMan.ini, Options, SoundBust
If AchieveBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
If SoundAchieve
	IniWrite, %SoundAchieve%, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve
If IntervalBox
	IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
else, 
	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
If SoundInterval
	IniWrite, %SoundInterval%, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
If SlotA1x
	IniWrite, %SlotA1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x
If SlotA2x
	IniWrite, %SlotA2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x
If SlotA3x
	IniWrite, %SlotA3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x
If SlotA4x
	IniWrite, %SlotA4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x
If SlotB1x
	IniWrite, %SlotB1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x
If SlotB2x
	IniWrite, %SlotB2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x
If SlotB3x
	IniWrite, %SlotB3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x
If SlotB4x
	IniWrite, %SlotB4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x
If SlotC1x
	IniWrite, %SlotC1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x
If SlotC2x
	IniWrite, %SlotC2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x
If SlotC3x
	IniWrite, %SlotC3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x
If SlotC4x
	IniWrite, %SlotC4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x
If SlotA1y
	IniWrite, %SlotA1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y
If SlotA2y
	IniWrite, %SlotA2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y
If SlotA3y
	IniWrite, %SlotA3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y
If SlotA4y
	IniWrite, %SlotA4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y
If SlotB1y
	IniWrite, %SlotB1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y
If SlotB2y
	IniWrite, %SlotB2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y
If SlotB3y
	IniWrite, %SlotB3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y
If SlotB4y
	IniWrite, %SlotB4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y
If SlotC1y
	IniWrite, %SlotC1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y
If SlotC2y
	IniWrite, %SlotC2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y
If SlotC3y
	IniWrite, %SlotC3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y
If SlotC4y
	IniWrite, %SlotC4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
If SlotA1Key
	IniWrite, %SlotA1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key
If SlotA2Key
	IniWrite, %SlotA2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key
If SlotA3Key
	IniWrite, %SlotA3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key
If SlotA4Key
	IniWrite, %SlotA4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key
If SlotB1Key
	IniWrite, %SlotB1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key
If SlotB2Key
	IniWrite, %SlotB2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key
If SlotB3Key
	IniWrite, %SlotB3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key
If SlotB4Key
	IniWrite, %SlotB4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key
If SlotC1Key
	IniWrite, %SlotC1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key
If SlotC2Key
	IniWrite, %SlotC2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key
If SlotC3Key
	IniWrite, %SlotC3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key
If SlotC4Key
	IniWrite, %SlotC4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key
If Reset
	IniWrite, %Reset%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset
If Increase
	IniWrite, %Increase%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase
If Pause
	IniWrite, %Pause%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Pause
If Close
	IniWrite, %Close%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close	
return

ReadIni:
IniRead, ColumnL, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnL, 180s
IniRead, ColumnM, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnM, 45s
IniRead, ColumnR, %A_ScriptDir%\SessionMan.ini, Stakes, ColumnR, 18s
IniRead, Stake1, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1, $3.50+R
IniRead, Stake2, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2, $8.00
IniRead, Stake3, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3, $15.00
IniRead, Stake4, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4, $3.50
IniRead, Stake5, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5, $7.00
IniRead, Stake6, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6, $15.00
IniRead, Stake7, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7, $3.50
IniRead, Stake8, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8, $7.00
IniRead, Stake9, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9, $15.00
IniRead, Type1, %A_ScriptDir%\SessionMan.ini, Stakes, Type1, 180
IniRead, Type2, %A_ScriptDir%\SessionMan.ini, Stakes, Type2, 180
IniRead, Type3, %A_ScriptDir%\SessionMan.ini, Stakes, Type3, 180
IniRead, Type4, %A_ScriptDir%\SessionMan.ini, Stakes, Type4, 45
IniRead, Type5, %A_ScriptDir%\SessionMan.ini, Stakes, Type5, 45
IniRead, Type6, %A_ScriptDir%\SessionMan.ini, Stakes, Type6, 45
IniRead, Type7, %A_ScriptDir%\SessionMan.ini, Stakes, Type7, 18
IniRead, Type8, %A_ScriptDir%\SessionMan.ini, Stakes, Type8, 18
IniRead, Type9, %A_ScriptDir%\SessionMan.ini, Stakes, Type9, 18
IniRead, Stake1VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP, 1.71					 
IniRead, Stake2VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP, 3.63													
IniRead, Stake3VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP, 6.77												
IniRead, Stake4VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP, 1.71											 
IniRead, Stake5VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP, 3.19					 
IniRead, Stake6VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP, 6.71													
IniRead, Stake7VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP, 1.87												
IniRead, Stake8VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP, 3.03											 
IniRead, Stake9VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP, 6.11			
IniRead, Color1, %A_ScriptDir%\SessionMan.ini, Stakes, Color1, ff0000
IniRead, Color2, %A_ScriptDir%\SessionMan.ini, Stakes, Color2, ff5500
IniRead, Color3, %A_ScriptDir%\SessionMan.ini, Stakes, Color3, ffaa00
IniRead, Color4, %A_ScriptDir%\SessionMan.ini, Stakes, Color4, 00ff55
IniRead, Color5, %A_ScriptDir%\SessionMan.ini, Stakes, Color5, 005555
IniRead, Color6, %A_ScriptDir%\SessionMan.ini, Stakes, Color6, 00aaaa
IniRead, Color7, %A_ScriptDir%\SessionMan.ini, Stakes, Color7, 0033ff
IniRead, Color8, %A_ScriptDir%\SessionMan.ini, Stakes, Color8, 5555ff
IniRead, Color9, %A_ScriptDir%\SessionMan.ini, Stakes, Color9, aa55ff 
IniRead, ColorsBox, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox, 0
IniRead, GUIColor, %A_ScriptDir%\SessionMan.ini, Options, GUIColor, 383838
IniRead, NumColor, %A_ScriptDir%\SessionMan.ini, Options, NumColor, 999999
IniRead, TextColor, %A_ScriptDir%\SessionMan.ini, Options, TextColor, 000000
IniRead, SeparatorColor, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor, 282828
IniRead, GoalBox, %A_ScriptDir%\SessionMan.ini, Options, GoalBox, 1 
IniRead, NumColorGoal, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal, 33ff33
IniRead, WarnBox, %A_ScriptDir%\SessionMan.ini, Options, WarnBox, 1 
IniRead, NumColorWarn, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn, ff0000
IniRead, BreakBox, %A_ScriptDir%\SessionMan.ini, Options, BreakBox, 1
IniRead, ClockColorBreak, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak, ff0000
IniRead, MinMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio, 16
IniRead, MaxMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio, 20
IniRead, TotalLimit, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit, 150
IniRead, SessionTimeGoal, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal, 06:00
IniRead, MinABI, %A_ScriptDir%\SessionMan.ini, Options, MinABI, 5
IniRead, MaxABI, %A_ScriptDir%\SessionMan.ini, Options, MaxABI, 7
IniRead, MaxInvest, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest, 1000
IniRead, VPPGoal, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal, 375
IniRead, VIPMulti, %A_ScriptDir%\SessionMan.ini, Options, VIPMulti, 2
IniRead, BustBox, %A_ScriptDir%\SessionMan.ini, Options, BustBox, 0
IniRead, SoundBust, %A_ScriptDir%\SessionMan.ini, Options, SoundBust, C:\Program Files (x86)\PokerStars\snd\bust.wav
IniRead, AchieveBox, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox, 0	
IniRead, SoundAchieve, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve, C:\Program Files (x86)\PokerStars\snd\ding.wav
IniRead, IntervalBox, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox, 0
IniRead, SoundInterval, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval, 25
IniRead, SlotA1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x, 304
IniRead, SlotA2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x, 1112
IniRead, SlotA3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x, 1920
IniRead, SlotA4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x, 2728
IniRead, SlotB1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x, 304
IniRead, SlotB2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x, 1112
IniRead, SlotB3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x, 1920
IniRead, SlotB4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x, 2728
IniRead, SlotC1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x, 304
IniRead, SlotC2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x, 1112
IniRead, SlotC3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x, 1920
IniRead, SlotC4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x, 2728
IniRead, SlotA1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y, 0
IniRead, SlotA2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y, 0
IniRead, SlotA3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y, 0
IniRead, SlotA4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y, 0
IniRead, SlotB1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y, 584
IniRead, SlotB2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y, 584
IniRead, SlotB3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y, 584
IniRead, SlotB4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y, 584	
IniRead, SlotC1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y, 299
IniRead, SlotC2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y, 299
IniRead, SlotC3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y, 299
IniRead, SlotC4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y, 299
IniRead, SlotA1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key, F1
IniRead, SlotA2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key, F2
IniRead, SlotA3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key, F3
IniRead, SlotA4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key, F4
IniRead, SlotB1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key, F5
IniRead, SlotB2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key, F6
IniRead, SlotB3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key, F7
IniRead, SlotB4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key, F8
IniRead, SlotC1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key, F9
IniRead, SlotC2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key, F10
IniRead, SlotC3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key, F11
IniRead, SlotC4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key, F12
IniRead, Reset, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset, CTRL+F9
IniRead, Increase, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase, CTRL+F10
IniRead, Pause, %A_ScriptDir%\SessionMan.ini, Hotkeys, Pause, ALT+Pause
IniRead, Close, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close, CTRL+Q
return

;====================================================== SECTION END =============================================================
;================================================================================================================================
;======================================================== HOTKEYS ===============================================================

^F9::				;counter (SessionTime) reset
{
FormatTime, Start, %A_Now%, ddd d.M.yyyy HH:mm:ss
H1 = 0
H2 = 0
M1 = 0
M2 = 0
Gui, Font, s14 c%NumColor%, Verdana
Gui, Font, Norm
GuiControl, Font, SessionTime
GuiControl,, SessionTime, %H2%:%M1%%M2%
GoSub CheckLogging
}
return
;................................................................................................................................

^F10::				;counter (SessionTime) + 1
Var = -1
return
;.................................................... TABLE MOVEMENTS ...........................................................

F1::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA1x%, %SlotA1y%
else, return
}
return
;......................................................... SLOT1 ................................................................

F2::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA2x%, %SlotA2y%
else, return
}
return
;......................................................... SLOT2 ................................................................

F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA3x%, %SlotA3y%
else, return
}
return
;......................................................... SLOT3 ................................................................

F4::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA4x%, %SlotA4y%
else, return
}
return
;......................................................... SLOT4 ................................................................

^F3::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotA0x%, %SlotA0y%
else, return
}
return
;......................................................... SLOT5 ................................................................

F5::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB1x%, %SlotB1y%
else, return
}
return
;......................................................... SLOT6 ................................................................

F6::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB2x%, %SlotB2y%
else, return
}
return
;......................................................... SLOT7 ................................................................

F7::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB3x%, %SlotB3y%
else, return
}
return
;......................................................... SLOT8 ................................................................

F8::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotB4x%, %SlotB4y%
else, return
}
return
;......................................................... SLOT9 ................................................................

F9::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC1x%, %SlotC1y%
else, return
}
return
;......................................................... SLOT10 ...............................................................

F10::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC2x%, %SlotC2y%
else, return
}
return
;......................................................... SLOT11 ...............................................................

F11::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC3x%, %SlotC3y%
else, return
}
return
;......................................................... SLOT12 ...............................................................

F12::
{
IfWinActive, ahk_class PokerStarsTableFrameClass
	WinMove, %SlotC4x%, %SlotC4y%
else, return
}
return

;................................................................................................................................

^Q::
GoSub, GuiClose
return
;................................................................................................................................

!Pause::Pause
;................................................................................................................................

GuiClose:
GoSub, CreateLog 
ExitApp

Last edited by Baobhan-Sith; 11-15-2013 at 11:49 PM.
Table Counter AHK for PokerStars Quote
11-18-2013 , 10:37 AM
very nice work from all!

Baob, I tried using your latest version but when I right click for settings, I'm getting an error: invalid option on line 1167
Table Counter AHK for PokerStars Quote
11-18-2013 , 02:24 PM
Are you sure you didn't miss parts of the code (or accidentally added/changed some) when you copied it into your file? Because, that line is empty in this version.

Also fwiw, you need to run Autohotkey 1.0.48.05, other versions are not supported atm.

Anyway, here's an update.
- cleaned the code a bit for less CPU usage
- fixed for NLHE MTT support
- added cashgame support*
- added rake and rakeback (rakeback fixed at FPP*0.016 for now, Line 867)
- session time stops when there's no table
- ABI/Invest will only consider games you defined
- some minor fixes

*You can define cashgame stakes as either of the following examples:
Quote:
$10/$20 - $400 Cap
$400 Cap
CAP - $10/$20
$10/$20
(will count all $10/$20 tables regardless of entrants/Cap)
$10/$20 USD (will count only regular $10/$20 games, including ZOOM, but regardless of entrants)
€5/€10 EUR (will count only regular €5/€10 games but regardless of entrants)

It is not possible to distinguish between 6max and 9max (nor between regular and ZOOM*) cashgame tables.

* Unless you include the ZOOM table name in the stake definition, that is.

Obviously tracking VPP/FPP/ABI and such is not possible for cashgames.
Spoiler:

Code:
#SingleInstance, force
#NoEnv
DetectHiddenWindows, On
SetTitleMatchMode, 1					
Build = 2.3.82
LoopInterval = 100			

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT REBUY MULTIPLICATOR AT LINE 826 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;>>>>>>>>>>>>>>>>>>>>>>>>>>> GetBuyin(Title,byref currency="",Byref BuyinText="", RebuyMulti="3") <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CONFIG HOTKEYS AT HOTKEY SECTION (LINE 1400 ET SEQ)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EDIT CONTROL COORDS IN THE GUI SECTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;================================================================================================================================
;================================================== INITIAL SETTINGS ============================================================
Menu Tray, NoStandard
Menu Tray, Add, Bring To Front, TrayBring
Menu Tray, Add, Save Position, TrayPosition
Menu Tray, Add
Menu Tray, Add, Enable Logging, TrayLog
Menu Tray, Add, Open Logfile, TrayLogfile
Menu Tray, Add, Clear Logfile, TrayClrLog
Menu Tray, Add
Menu Tray, Add, Settings, TrayConfig
Menu Tray, Add
Menu Tray, Add, Pause/Continue, TrayPause
Menu Tray, Add
Menu Tray, Add, Reload Script, TrayReload
Menu Tray, Add, Exit, TrayExit

FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
Gosub CheckIni
Gosub ReadIni
Gosub CheckLog

If (ColorsBox = 0)
Loop, 9
	{
	C += 1
	Color%C% := NumColor
	}
	
IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x
IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y

ABI := "  ABI  "
Invest := "  Invest  "
Gamesh := "  Games/h  "
Clock := "  Clock  "
Time := "  Time "
TotalInvest := Rake := 0.00             
TotalInvest_TournamentCounter := 0
S := P := H1 := H2 := M1 := 0   
M2 = -1                         
r0 := r1 := r2 := r3 := r4 := r5 := r6 := r7 := r8 := r9 := 0
c1 := c2 := c3 := c4 := c5 := c6 := c7 := c8 := c9 := 0
t := t1 := t2 := t3 := t4 := t5 := t6 := t7 := t8 := t9 := 0
VPP1 := VPP2 := VPP3 := VPP4 := VPP5 := VPP6 := VPP7 := VPP8 := VPP9 := FPP := 0
;================================================================================================================================
;======================================================== MAIN GUI ==============================================================
Gui -MaximizeBox -Resize +AlwaysOnTop ;+ToolWindow -MinimizeBox
Gui, Show, W376 H305 x%xpos% y%ypos%, SessionMan %Build%	
Gui, Color, %GUIColor%		
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x3 y7 Left, VPP:				
Gui, Add, Text, x3 y27 Left, Rake:						
Gui, Add, Text, x348 y7 Right, FPP				
Gui, Add, Text, x348 y27 Right, RB	
Gui, Font, s10 c%NumColor%					
Gui, Add, Text, x41 y7 Left vVPP, 0000.00 	
Gui, Add, Text, x41 y27 Left vRake, $0000.00 	
Gui, Add, Text, x282 y7 Right vFPP, 00000.00	
Gui, Add, Text, x282 y27 Right vRakeback, $0000.00							
Gui, Font, s8 c%TextColor%					
Gui, Add, Text, x152 y0 Center, Total Tables
Gui, Font, s22 c%NumColor%					
Gui, Add, Text, x108 y13 vTotalTables Center, 000 / 0000	
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x37 y50 vLCaption Center, xxxxxx				
Gui, Add, Text, x164 y50 vMCaption Center, xxxxxx				
Gui, Add, Text, x292 y50 vRCaption Center, xxxxxx							
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y45 Center, ____								
Gui, Add, Text, x86 y45 Center, __________			
Gui, Add, Text, x212 y45 Center, __________					
Gui, Add, Text, x338 y45 Center, ____
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s8 c%Color1%				
Gui, Add, Text, x0 y70 vControl1 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color1%				
Gui, Add, Text, x2 y82 vCounter1 Center, 000 / 0000									
Gui, Font, s8 c%Color2%			
Gui, Add, Text, x0 y114 vControl2 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color2%				
Gui, Add, Text, x2 y126 vCounter2 Center, 000 / 0000									
Gui, Font, s8 c%Color3%				
Gui, Add, Text, x0 y158 vControl3 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color3%				
Gui, Add, Text, x2 y170 vCounter3 Center, 000 / 0000										
Gui, Font, s8 c%Color4%				
Gui, Add, Text, x128 y70 vControl4 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color4%			
Gui, Add, Text, x130 y82 vCounter4 Center, 000 / 0000										
Gui, Font, s8 c%Color5%				
Gui, Add, Text, x128 y114 vControl5 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color5%			
Gui, Add, Text, x130 y126 vCounter5 Center, 000 / 0000										
Gui, Font, s8 c%Color6%				
Gui, Add, Text, x128 y158 vControl6 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color6%				
Gui, Add, Text, x130 y170 vCounter6 Center, 000 / 0000										
Gui, Font, s8 c%Color7%				
Gui, Add, Text, x256 y70 vControl7 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color7%				
Gui, Add, Text, x258 y82 vCounter7 Center, 000 / 0000									
Gui, Font, s8 c%Color8%				
Gui, Add, Text, x256 y114 vControl8 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color8%			
Gui, Add, Text, x258 y126 vCounter8 Center, 000 / 0000										
Gui, Font, s8 c%Color9%				
Gui, Add, Text, x256 y158 vControl9 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color9%			
Gui, Add, Text, x258 y170 vCounter9 Center, 000 / 0000
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x66 y203 Center, %ABI%				
Gui, Add, Text, x247 y203 Center, %Invest%
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y197 Center, ________				
Gui, Add, Text, x108 y197 Center, _________________				
Gui, Add, Text, x314 y197 Center, _______
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s11 c%NumColor%					
Gui, Add, Text, x4 y224 vAvgBI Center, $0000.00 ($0000.00)				
Gui, Add, Text, x184 y224 vInvestment Center, $00000.00 ($00000.00) 
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x25 y252 Center, %Gamesh%				
Gui, Add, Text, x160 y252 Center, %Clock%				
Gui, Add, Text, x288 y252 Center, %Time%
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y247 Center, ___					
Gui, Add, Text, x104 y247 Center, _______				
Gui, Add, Text, x216 y247 Center, _________				
Gui, Add, Text, x338 y247 Center, ____	
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s14 c%NumColor%					
Gui, Add, Text, x33 y271 vGames Center, 0000.0						
Gui, Add, Text, x287 y271 vSessionTime Center, 00:00
Gui, Font, s20 c%NumColor%					
Gui, Add, Text, x147 y268 vClock Center, 00000	
;--------------------------------------------------------------------------------------------------------------------------------
Loop, 9                         
	{                           
	N += 1                      
	IfInString, Stake%N%, .00   
		StringReplace, Stake%N%b, Stake%N%, .00,
	else, Stake%N%b := Stake%N%	
	IfInString, Stake%N%b, +R   
		StringReplace, Stake%N%b, Stake%N%b, +,
	}	                        
N = 0	      
;--------------------------------------------------------------------------------------------------------------------------------                  
GuiControl,, LCaption, %LCaption%
GuiControl,, MCaption, %MCaption%
GuiControl,, RCaption, %RCaption%
GuiControl,, Control1, %Stake1b%
GuiControl,, Control2, %Stake2b%
GuiControl,, Control3, %Stake3b%
GuiControl,, Control4, %Stake4b%
GuiControl,, Control5, %Stake5b%
GuiControl,, Control6, %Stake6b%
GuiControl,, Control7, %Stake7b%
GuiControl,, Control8, %Stake8b%
GuiControl,, Control9, %Stake9b%
;================================================================================================================================
;===================================================== TOTALS COUNTER ===========================================================
Loop                            
	{	                        
    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 
	If (t0 = 0)                 
		GuiControl,, TotalTables, 0
	else, GuiControl,, TotalTables, %c0% / %t0%
    If (c0 < r0)                
    	{                       
		If BustBox = 1          
		SoundPlay, %SoundBust%  
    	}	                    
    r0 = %c0%                   
    If (c0 < MinMTRatio)        
		{                       
		Gui, Font, s22 c%NumColor%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
	else, if (c0 > MaxMTRatio) and (WarnBox = 1)
		{                       
		Gui, Font, s22 c%NumColorWarn%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
	else, if GoalBox = 1        
		{                       
		Gui, Font, s22 c%NumColorGoal%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
    If (t0 = TotalLimit)        
    	{                       
		If AchieveBox = 1       
			SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}	                    
	If (c0 != clast)            
		{                       
		Gosub Stakes            
		Gosub BIandPoints       
		clast := c0             
		}	            
;--------------------------------------------------------------------------------------------------------------------------------
	IfWinNotExist, ahk_class PokerStarsTableFrameClass
		{                       
		P += 1                  
		If (P = 2)              
			{                   
			Loop                
				{               
				Gosub Timers    
				Sleep %LoopInterval%
				IfWinExist, ahk_class PokerStarsTableFrameClass
					break       
				}               
			P = 0               
			}				    
		}	     	                     
	Gosub Timers                  
	Gosub Stakes                
	Sleep %LoopInterval%    
	}                           
return            
;================================================================================================================================
;===================================================== TRAY MENU HANDLERS =======================================================
TrayBring:             
	WinActivate, SessionMan %Build% ahk_class AutoHotkeyGUI
return                          
;================================================================================================================================
TrayPosition:          
	WinGetPos, xpos, ypos,,, SessionMan %Build% ahk_class AutoHotkeyGUI
	IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
	IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
return                          
;================================================================================================================================
TrayReload:            
	Gosub, CreateLog            
	Reload                      
return                          
;================================================================================================================================
TrayLog:               
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = false          
		{                       
		IniWrite, true, %A_ScriptDir%\SessionMan.ini, Logging, Log
		IfNotExist, %A_ScriptDir%\SessionMan.log.ini
			{                   
			IniWrite, 1, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		Menu Tray, Check, Enable Logging
		Gosub CheckLog      
		}                       
	else                        
		{                       
		IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log	
		Menu Tray, Uncheck, Enable Logging
		}                       
return	                        
;================================================================================================================================
TrayLogfile:           
	Run, %A_ScriptDir%\SessionMan.log.ini
return                          
;================================================================================================================================
TrayClrLog:            
	MsgBox, 4, SessionMan - Clear Logfile, Do you want to clear the logfile?
	IfMsgBox Yes                
		{                       
		IfWinExist, SessionMan.log.ini
			WinClose, SessionMan.log.ini
		FileDelete, %A_ScriptDir%\SessionMan.log.ini
		FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
		Gosub CheckLog      
		}                       
return                          
;================================================================================================================================
TrayConfig:            
	IfWinExist, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
		WinActivate, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
	else, Gosub SettingsGUI
return                          
;================================================================================================================================
TrayPause:             
	If A_IsPaused               
		{                       
		Pause off               
		Menu Tray, Uncheck, Pause/Continue
		}                       
	else                        
		{                       
		Menu Tray, Check, Pause/Continue
		Pause On                
		}                       
return                          
;================================================================================================================================
TrayExit:              
	Gosub CreateLog             
	ExitApp                     
return                          
;================================================================================================================================
;===================================================== SETTINGS GUI =============================================================
SettingsGUI:             
	Menu, HelpMenu, Add, Help, SettingsHelp
	Menu, HelpMenu, Add, WindowSpy, SettingsSpy
	Menu, HelpMenu, Add, Color Codes (Web), SettingsColors
	Menu, Menubar, Add, Help, :HelpMenu
	Gui, 2:Menu, MenuBar        
	Gui, 2:-SysMenu             
	Gui, 2:Show, h500 w334, Settings - SessionMan %Build%
	Gui, 2:Add, Tab, x0 y0 w500 h750 , Stakes|Options|Hotkeys|Types
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Stakes          
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y32 w100 h40 , Captions:
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x31 y50 w50 h20 vLCaption, %LCaption%
	Gui, 2:Add, Edit, x141 y50 w50 h20 vMCaption, %MCaption%
	Gui, 2:Add, Edit, x251 y50 w50 h20 vRCaption, %RCaption%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y82 w50 h20 , Stakes:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x55 y82 w400 h20 , For rebuy games, include the "+R" appendix in the buy-in
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y100 w100 h20 vStake1, %Stake1%
	Gui, 2:Add, Edit, x6 y120 w100 h20 vStake2, %Stake2%
	Gui, 2:Add, Edit, x6 y140 w100 h20 vStake3, %Stake3%
	Gui, 2:Add, Edit, x116 y100 w100 h20 vStake4, %Stake4%
	Gui, 2:Add, Edit, x116 y120 w100 h20 vStake5, %Stake5%
	Gui, 2:Add, Edit, x116 y140 w100 h20 vStake6, %Stake6%
	Gui, 2:Add, Edit, x226 y100 w100 h20 vStake7, %Stake7%
	Gui, 2:Add, Edit, x226 y120 w100 h20 vStake8, %Stake8%
	Gui, 2:Add, Edit, x226 y140 w100 h20 vStake9, %Stake9%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y172 w80 h20 , Game Types:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x87 y172 w400 h20 , See Types Tab
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y190 w100 h20 vType1, %Type1%
	Gui, 2:Add, Edit, x6 y210 w100 h20 vType2, %Type2%
	Gui, 2:Add, Edit, x6 y230 w100 h20 vType3, %Type3%
	Gui, 2:Add, Edit, x116 y190 w100 h20 vType4, %Type4%
	Gui, 2:Add, Edit, x116 y210 w100 h20 vType5, %Type5%
	Gui, 2:Add, Edit, x116 y230 w100 h20 vType6, %Type6%
	Gui, 2:Add, Edit, x226 y190 w100 h20 vType7, %Type7%
	Gui, 2:Add, Edit, x226 y210 w100 h20 vType8, %Type8%
	Gui, 2:Add, Edit, x226 y230 w100 h20 vType9, %Type9%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y262 w28 h20 , VPP:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x40 y262 w300 h20 , To set to zero, type 0.000000001
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y280 w100 h20 vStake1VPP, %Stake1VPP%
	Gui, 2:Add, Edit, x6 y300 w100 h20 vStake2VPP, %Stake2VPP%
	Gui, 2:Add, Edit, x6 y320 w100 h20 vStake3VPP, %Stake3VPP%
	Gui, 2:Add, Edit, x116 y280 w100 h20 vStake4VPP, %Stake4VPP%
	Gui, 2:Add, Edit, x116 y300 w100 h20 vStake5VPP, %Stake5VPP%
	Gui, 2:Add, Edit, x116 y320 w100 h20 vStake6VPP, %Stake6VPP%
	Gui, 2:Add, Edit, x226 y280 w100 h20 vStake7VPP, %Stake7VPP%
	Gui, 2:Add, Edit, x226 y300 w100 h20 vStake8VPP, %Stake8VPP%
	Gui, 2:Add, Edit, x226 y320 w100 h20 vStake9VPP, %Stake9VPP%
	Gui, 2:Font, s8 cDefault Bold
	If ColorsBox = 1            
			Gui, 2:Add, CheckBox, x8 y350 w105 h20 Checked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
	else, 	Gui, 2:Add, CheckBox, x8 y350 w105 h20 Unchecked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x116 y353 w220 h20 , Colors reset to default if disabled
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y370 w100 h20 vColor1, %Color1%
	Gui, 2:Add, Edit, x6 y390 w100 h20 vColor2, %Color2%
	Gui, 2:Add, Edit, x6 y410 w100 h20 vColor3, %Color3%
	Gui, 2:Add, Edit, x116 y370 w100 h20 vColor4, %Color4%
	Gui, 2:Add, Edit, x116 y390 w100 h20 vColor5, %Color5%
	Gui, 2:Add, Edit, x116 y410 w100 h20 vColor6, %Color6%
	Gui, 2:Add, Edit, x226 y370 w100 h20 vColor7, %Color7%
	Gui, 2:Add, Edit, x226 y390 w100 h20 vColor8, %Color8%
	Gui, 2:Add, Edit, x226 y410 w100 h20 vColor9, %Color9%
	Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Options         
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x8 y32 w220 h20 , Background Color
	Gui, 2:Add, Edit, x226 y30 w100 h20 vGUIColor, %GUIColor%
	Gui, 2:Add, Text, x8 y52 w220 h20 , Digit Color
	Gui, 2:Add, Edit, x226 y50 w100 h20 vNumColor, %NumColor%
	Gui, 2:Add, Text, x8 y72 w220 h20 , Caption Color
	Gui, 2:Add, Edit, x226 y70 w100 h20 vTextColor, %TextColor%
	Gui, 2:Add, Text, x8 y92 w220 h20 , Separator Color
	Gui, 2:Add, Edit, x226 y90 w100 h20 vSeparatorColor, %SeparatorColor%
	If GoalBox = 1              
			Gui, 2:Add, CheckBox, x8 y110 w200 h20 Checked%GoalBox% vGoalBox, Achievement Color
	else, 	Gui, 2:Add, CheckBox, x8 y110 w200 h20 Unchecked%GoalBox% vGoalBox, Achievement Color
	Gui, 2:Add, Edit, x226 y110 w100 h20 vNumColorGoal, %NumColorGoal%
	If WarnBox = 1              
			Gui, 2:Add, CheckBox, x8 y130 w200 h20 Checked%WarnBox% vWarnBox, Warning Color
	else, 	Gui, 2:Add, CheckBox, x8 y130 w200 h20 Unchecked%WarnBox% vWarnBox, Warning Color
	Gui, 2:Add, Edit, x226 y130 w100 h20 vNumColorWarn, %NumColorWarn%
	If BreakBox = 1             
			Gui, 2:Add, CheckBox, x8 y150 w200 h20 Checked%BreakBox% vBreakBox, Sync Break Clock Color
	else, 	Gui, 2:Add, CheckBox, x8 y150 w200 h20 Unchecked%BreakBox% vBreakBox, Sync Break Clock Color
	Gui, 2:Add, Edit, x226 y150 w100 h20 vClockColorBreak, %ClockColorBreak%
	Gui, 2:Add, Text, x8 y182 w220 h20 , Multitabling Ratio (Min)
	Gui, 2:Add, Edit, x226 y180 w100 h20 vMinMTRatio, %MinMTRatio%
	Gui, 2:Add, Text, x8 y202 w220 h20 , Multitabling Ratio (Max)
	Gui, 2:Add, Edit, x226 y200 w100 h20 vMaxMTRatio, %MaxMTRatio%
	Gui, 2:Add, Text, x8 y222 w220 h20 , Destinated Games Per Session
	Gui, 2:Add, Edit, x226 y220 w100 h20 vTotalLimit, %TotalLimit%
	Gui, 2:Add, Text, x8 y242 w220 h20 , Destinated Session Time (hh:mm)
	Gui, 2:Add, Edit, x226 y240 w100 h20 vSessionTimeGoal, %SessionTimeGoal%
	Gui, 2:Add, Text, x8 y262 w220 h20 , ABI (Min)
	Gui, 2:Add, Text, x218 y262 w8 h20 , $
	Gui, 2:Add, Edit, x226 y260 w100 h20 vMinABI, %MinABI%
	Gui, 2:Add, Text, x8 y282 w220 h20 , ABI (Max)
	Gui, 2:Add, Text, x218 y282 w8 h20 , $
	Gui, 2:Add, Edit, x226 y280 w100 h20 vMaxABI, %MaxABI%
	Gui, 2:Add, Text, x8 y302 w220 h20 , Investment Limit
	Gui, 2:Add, Text, x218 y302 w8 h20 , $
	Gui, 2:Add, Edit, x226 y300 w100 h20 vMaxInvest, %MaxInvest%
	Gui, 2:Add, Text, x8 y322 w220 h20 , VPP Goal
	Gui, 2:Add, Edit, x226 y320 w100 h20 vVPPGoal, %VPPGoal%
	Gui, 2:Add, Text, x8 y342 w220 h20 , VIP Multiplicator
	Gui, 2:Add, Edit, x226 y340 w100 h20 vVIPMulti, %VIPMulti%
	If BustBox = 0              
			Gui, 2:Add, CheckBox, x8 y370 w100 h20 Unchecked%BustBox% vBustBox, Bustout Sound
	else, 	Gui, 2:Add, CheckBox, x8 y370 w100 h20 Checked%BustBox% vBustBox, Bustout Sound
	Gui, 2:Add, Edit, x126 y370 w200 h20 vSoundBust, %SoundBust%
	If AchieveBox = 0           
			Gui, 2:Add, CheckBox, x8 y390 w115 h20 Unchecked%GoalBox% vAchieveBox, Achievement Sound
	else, 	Gui, 2:Add, CheckBox, x8 y390 w115 h20 Checked%GoalBox% vAchieveBox, Achievement Sound
	Gui, 2:Add, Edit, x126 y390 w200 h20 vSoundAchieve, %SoundAchieve%
	Gui, 2:Add, Text, x14 y407 w20 h14 , |_
	If (IntervalBox = 1) and (AchieveBox = 1)
			Gui, 2:Add, CheckBox, x28 y410 w200 h20 Checked%IntervalBox% vIntervalBox, Repetition Interval
	else, 	Gui, 2:Add, CheckBox, x28 y410 w200 h20 Unchecked%IntervalBox% vIntervalBox, Repetition Interval
	Gui, 2:Add, Edit, x226 y410 w100 h20 vSoundInterval, %SoundInterval%
	Gui, 2:Add, Text, x34 y426 w30 h20 , |__
	Gui, 2:Add, Text, x55 y432 w400 h20 ,This sound applies only for "Destinated Games"
	Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Hotkeys         
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x6 y30 w240 h20 , Table Slots
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x110 y30 w240 h20 , X
	Gui, 2:Add, Text, x160 y30 w240 h20 , Y
	Gui, 2:Add, Text, x210 y30 w240 h20 , Hotkey
	Gui, 2:Add, Text, x8 y52 w80 h20 , Slot 1 
	Gui, 2:Add, Edit, x106 y50 w40 h20 vSlotA1x, %SlotA1x%
	Gui, 2:Add, Edit, x156 y50 w40 h20 vSlotA1y, %SlotA1y%
	Gui, 2:Add, Edit, x206 y50 w120 h20 vSlotA1Key, %SlotA1Key%
	Gui, 2:Add, Text, x8 y72 w240 h20 , Slot 2
	Gui, 2:Add, Edit, x106 y70 w40 h20 vSlotA2x, %SlotA2x%
	Gui, 2:Add, Edit, x156 y70 w40 h20 vSlotA2y, %SlotA2y%
	Gui, 2:Add, Edit, x206 y70 w120 h20 vSlotA2Key, %SlotA2Key%
	Gui, 2:Add, Text, x8 y92 w240 h20 , Slot 3
	Gui, 2:Add, Edit, x106 y90 w40 h20 vSlotA3x, %SlotA3x%
	Gui, 2:Add, Edit, x156 y90 w40 h20 vSlotA3y, %SlotA3y%
	Gui, 2:Add, Edit, x206 y90 w120 h20 vSlotA3Key, %SlotA3Key%
	Gui, 2:Add, Text, x8 y112 w240 h20 , Slot 4
	Gui, 2:Add, Edit, x106 y110 w40 h20 vSlotA4x, %SlotA4x%
	Gui, 2:Add, Edit, x156 y110 w40 h20 vSlotA4y, %SlotA4y%
	Gui, 2:Add, Edit, x206 y110 w120 h20 vSlotA4Key, %SlotA4Key%
	Gui, 2:Add, Text, x8 y132 w80 h20 , Slot 5 
	Gui, 2:Add, Edit, x106 y130 w40 h20 vSlotB1x, %SlotB1x%
	Gui, 2:Add, Edit, x156 y130 w40 h20 vSlotB1y, %SlotB1y%
	Gui, 2:Add, Edit, x206 y130 w120 h20 vSlotB1Key, %SlotB1Key%
	Gui, 2:Add, Text, x8 y152 w240 h20 , Slot 6
	Gui, 2:Add, Edit, x106 y150 w40 h20 vSlotB2x, %SlotB2x%
	Gui, 2:Add, Edit, x156 y150 w40 h20 vSlotB2y, %SlotB2y%
	Gui, 2:Add, Edit, x206 y150 w120 h20 vSlotB2Key, %SlotB2Key%
	Gui, 2:Add, Text, x8 y172 w240 h20 , Slot 7
	Gui, 2:Add, Edit, x106 y170 w40 h20 vSlotB3x, %SlotB3x%
	Gui, 2:Add, Edit, x156 y170 w40 h20 vSlotB3y, %SlotB3y%
	Gui, 2:Add, Edit, x206 y170 w120 h20 vSlotB3Key, %SlotB3Key%
	Gui, 2:Add, Text, x8 y192 w240 h20 , Slot 8
	Gui, 2:Add, Edit, x106 y190 w40 h20 vSlotB4x, %SlotB4x%
	Gui, 2:Add, Edit, x156 y190 w40 h20 vSlotB4y, %SlotB4y%
	Gui, 2:Add, Edit, x206 y190 w120 h20 vSlotB4Key, %SlotB4Key%
	Gui, 2:Add, Text, x8 y212 w80 h20 , Slot 9 
	Gui, 2:Add, Edit, x106 y210 w40 h20 vSlotC1x, %SlotC1x%
	Gui, 2:Add, Edit, x156 y210 w40 h20 vSlotC1y, %SlotC1y%
	Gui, 2:Add, Edit, x206 y210 w120 h20 vSlotC1Key, %SlotC1Key%
	Gui, 2:Add, Text, x8 y232 w240 h20 , Slot 10
	Gui, 2:Add, Edit, x106 y230 w40 h20 vSlotC2x, %SlotC2x%
	Gui, 2:Add, Edit, x156 y230 w40 h20 vSlotC2y, %SlotC2y%
	Gui, 2:Add, Edit, x206 y230 w120 h20 vSlotC2Key, %SlotC2Key%
	Gui, 2:Add, Text, x8 y252 w240 h20 , Slot 11
	Gui, 2:Add, Edit, x106 y250 w40 h20 vSlotC3x, %SlotC3x%
	Gui, 2:Add, Edit, x156 y250 w40 h20 vSlotC3y, %SlotC3y%
	Gui, 2:Add, Edit, x206 y250 w120 h20 vSlotC3Key, %SlotC3Key%
	Gui, 2:Add, Text, x8 y272 w240 h20 , Slot 12
	Gui, 2:Add, Edit, x106 y270 w40 h20 vSlotC4x, %SlotC4x%
	Gui, 2:Add, Edit, x156 y270 w40 h20 vSlotC4y, %SlotC4y%
	Gui, 2:Add, Edit, x206 y270 w120 h20 vSlotC4Key, %SlotC4Key%
	Gui, 2:Add, Text, x8 y302 w180 h20 , Reset Session Time
	Gui, 2:Add, Edit, x206 y300 w120 h20 vReset, %Reset%
	Gui, 2:Add, Text, x8 y322 w180 h20 , Increase Session Time By 1
	Gui, 2:Add, Edit, x206 y320 w120 h20 vIncrease, %Increase%
	Gui, 2:Add, Text, x8 y342 w180 h20 , Pause/Continue
	Gui, 2:Add, Edit, x206 y340 w120 h20 vPause, %Pause%
	Gui, 2:Add, Text, x8 y362 w180 h20 , Close
	Gui, 2:Add, Edit, x206 y360 w120 h20 vClose, %Close%
	Gui, 2:Add, Button, x118 y455 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y455 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y481 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Types           
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y32 w240 h20 , Game Types Description: 
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x8 y60 w400 h20 , Game Types refer %A_Space%to %A_Space%the term %A_Space%inside %A_Space%the square brackets %A_Space%in %A_Space%the
	Gui, 2:Add, Text, x8 y77 w400 h20 , target windows' %A_Space%titles. For 9max regular speed games, whose titles
	Gui, 2:Add, Text, x8 y94 w400 h20 , lack such a term, %A_Space% just type "9-Max", and for 9max turbos just type  
	Gui, 2:Add, Text, x8 y111 w400 h20, "Turbo". The following definitions group games as described:    
	Gui, 2:Font, s8 cDefault Bold     
	Gui, 2:Add, Text, x8 y145 w400 h20, HU 
	Gui, 2:Add, Text, x8 y162 w400 h20, HUSTT    
	Gui, 2:Add, Text, x8 y179 w400 h20, 6-Max    
	Gui, 2:Add, Text, x8 y196 w400 h20, 9-Max, Turbo 
	Gui, 2:Add, Text, x8 y213 w400 h20, 18    
	Gui, 2:Add, Text, x8 y230 w400 h20, 45   
	Gui, 2:Add, Text, x8 y247 w400 h20, 180       
	Gui, 2:Add, Text, x8 y264 w400 h20, 180 Players, Turbo      
	Gui, 2:Add, Text, x8 y281 w400 h20, Gtd      
	Gui, 2:Add, Text, x8 y298 w400 h20, Cash      
	Gui, 2:Add, Text, x8 y315 w400 h20, NoType    
	Gui, 2:Font, s8 cDefault Norm     
	Gui, 2:Add, Text, x130 y145 w400 h20, - any HU SNG, including MTSNG
	Gui, 2:Add, Text, x130 y162 w400 h20, - any HU STT
	Gui, 2:Add, Text, x130 y179 w400 h20, - any 6-handed STT     
	Gui, 2:Add, Text, x130 y196 w400 h20, - any 9-handed Turbo STT, incl. KO's    
	Gui, 2:Add, Text, x130 y213 w400 h20, - any 9-handed 18man SNG      
	Gui, 2:Add, Text, x130 y230 w400 h20, - any 45 player SNG      
	Gui, 2:Add, Text, x130 y247 w400 h20, - any 180 player SNG    
	Gui, 2:Add, Text, x130 y264 w400 h20, - any 180 player Turbo SNG  
	Gui, 2:Add, Text, x130 y281 w400 h20, - any Gtd MTT regardless of stake
	Gui, 2:Add, Text, x130 y298 w100 h20, - cash games    
	Gui, 2:Font, s8 cFF0000 Norm     
	Gui, 2:Add, Text, x196 y298 w200 h20, (don't use for SNG/MTT)   
	Gui, 2:Font, s8 cDefault Norm     
	Gui, 2:Add, Text, x130 y315 w400 h20, - disregards game type (see below)
	Gui, 2:Add, Text, x8 y349 w400 h20, To avoid accidental groupings, make sure to define the whole term
	Gui, 2:Add, Text, x8 y366 w400 h20, inside the brackets. For examle, don't just type %A_Space%"18 Players" %A_Space%if you 
	Gui, 2:Add, Text, x8 y383 w400 h20, want to define 18man Turbos; Instead, type "18 Players, Turbo".  
	Gui, 2:Add, Text, x8 y417 w400 h20, When using the "NoType" definition, only tables whose titles begin
	Gui, 2:Add, Text, x8 y434 w400 h20, with your stake definition will be considered. %A_Space%The Bigger $5.50, for 
	Gui, 2:Add, Text, x8 y451 w400 h20, instance, will not be considered if you define the stake as "$5.50".
return                          
;================================================================================================================================
;===================================================== GUI MENU HANDLERS ========================================================
SettingsHelp:                  
	IfWinExist AutoHotkey Help  
		WinActivate             
	else                        
		{                       
		RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
		Run %ahkInstallDir%\AutoHotKey.chm
		}                       
return                          
;================================================================================================================================
SettingsSpy:                
	RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
	Run %ahkInstallDir%\AU3_Spy.exe
return                          
;================================================================================================================================
SettingsColors:             
	Gui, 3:Font, s9 c000000     
	Gui, 3:Add, Text, x10 y8 w180 h20, Can't access browser. Please visit:
	Gui, 3:Add, Edit, x20 y30 w142 h20 vMyEdit, http://html-color-codes.info/
	Gui, 3:Add, Button, x65 y60 w50 h20 gCancel,Cancel
	Gui, 3:-SysMenu             
	Gui, 3:Show, h90 w185, SessionMan - Error 
return                          
;================================================================================================================================
Save:                           
	IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x, 4
	IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y, 4
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log, false 
	Gui, Submit                 
	FileDelete, %A_ScriptDir%\SessionMan.ini
	Gosub CheckIni              
	Gosub UpdateIni             
	Reload                      
return                          
;================================================================================================================================
Cancel:                         
	Gui, Destroy                
Return        
;================================================================================================================================
GuiClose:                       
	Gosub, CreateLog            
	ExitApp                     
return	                  
;================================================================================================================================
;====================================================== GENERAL LABELS ========================================================== 
Stakes: 
	num = 0 
	Loop, 9
		{
		num += 1
		r := c%num%                     
		t := t%num%  
		Stake := Stake%num%
		Type := Type%num%           
		Counter = Counter%num%         
		Gosub Counter               
		c%num% := c                     
		t%num% := t
		}       
return	                     
;================================================================================================================================
Counter: 
	If Type = 18                
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}                       
	else, if Type = HUSTT       
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v3, count, %Stake% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v4, count, %Stake% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}                       
	else, if InStr(Type, "9-Max, Turbo",0)
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}                       
	else, if InStr(Type, "9-Max",0)
		{                       
		WinGet, v1, count, %Stake% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v3, count, %Stake% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v4, count, %Stake% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v5, count, %Stake% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v6, count, %Stake% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}                       
	else, if Type = Gtd         
		{                       
		SetTitleMatchMode, 2    
		WinGet, v1, count, Gtd ahk_class PokerStarsTableFrameClass
		SetTitleMatchMode, 1    
		}                       
	else, if Type = Cash        
		{                       
		SetTitleMatchMode, 2    
		WinGet, v1, count, %Stake% ahk_class PokerStarsTableFrameClass
		SetTitleMatchMode, 1    
		}                       
	else, if Type = NoType      
		{                       
		WinGet, v1, count, %Stake% ahk_class PokerStarsTableFrameClass
		}                       
	else                        
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [%Type% ahk_class PokerStarsTableFrameClass
		}                       
	Tables := v1 + v2 + v3 + v4 + v5 + v6
	c = 0                       
	Loop, %Tables%              
		{	                    
		c += 1                  
		}                       
	If (c != c%Counter%last)    
		{                       
		If (t = 0)              
			{	                
			GuiControl,, %Counter%, 0
			r = 0               
			}                   
		If (t < c)              
			{                   
			t := c - 1          
			}                   
		If (c > r)              
			{                   
			t += 1              
			GuiControl,, %Counter%, %c% / %t%
			r := c              
			}                   
		else, if (c < r)        
			{                   
			GuiControl,, %Counter%, %c% / %t%
			r := c              
			}                   
		c%Counter%last := c	    
		}	                    
	v1 = 0                      
	v2 = 0                      
	v3 = 0                      
	v4 = 0                      
	v5 = 0                      
	v6 = 0  
return                             
;================================================================================================================================
BIandPoints:                    
	CurrentInvest:=0.00         
	CurrentInvest_TournamentCounter:=0
	Buyin_Euro:=0.00            
	Buyin_Euro_TournamentCounter:=0
	Buyin_Session:=0.00	        
	Buyin_Session_TournamentCounter:=0		
	Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass
	Loop %Ps_Hwnd_List%         
		{                       
		Hwnd:=Ps_Hwnd_List%A_index%
		IF  !(Buyin_%hwnd%)     
			{                   
			WingetTitle,Title,Ahk_id%Hwnd%
			IF Instr(Title,"Tournament")
				{               
				IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
					{           
					BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
					TotalInvest:=Round(TotalInvest+Buyin_%Hwnd%,2)
						TotalInvest_TournamentCounter+=1
					}           
				}               
			}			        
		}	                    
	Loop,Parse,Buyin_Hwnd_List,`,,
		{                       
		Hwnd:=A_LoopField       
		If WinExist("ahk_id" Hwnd)
			{                   
			Currency:=Buyin_%hwnd%_Currency	
			Buyin:=Round(Buyin_%hwnd%,2)
			If (Currency="$")   
				{	            
				CurrentInvest:=Round(CurrentInvest+Buyin,2)
				CurrentInvest_TournamentCounter+=1
				}               
			else, if (Currency="€")
				{		        
				Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
				Buyin_Euro_TournamentCounter+=1
				}		        
			Buyin_Session:=Round(Buyin_Session+Buyin,2)
			Buyin_Session_TournamentCounter+=1
			}                   
		else                    
			{                   
			Temp_list:="," Buyin_Hwnd_List "," 
			StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
			StringTrimLeft,Temp_list,Temp_list,1
			StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
			}                   
		}		                
	If (CurrentInvest_Save != CurrentInvest) Or (BuyIn_Euro_Save != BuyIn_Euro) 
		{                       
		BuyIn_Euro_Save:=BuyIn_Euro	
		BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
		CurrentInvest_Save:=CurrentInvest
		CurrentABI:=Round(CurrentInvest/CurrentInvest_TournamentCounter,2)
		BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
		TotalABI:=Round(TotalInvest/TotalInvest_TournamentCounter,2)
		IfInString, CurrentABI, .00
			StringReplace, CurrentABI, CurrentABI, .00,	
		IfInString, CurrentInvest, .00
			StringReplace, CurrentInvest, CurrentInvest, .00,		
		IfInString, TotalABI, .00
			StringReplace, TotalABI, TotalABI, .00,		
		IfInString, TotalInvest, .00
			StringReplace, TotalInvest, TotalInvest, .00,	
		GuiControl,,AvgBI,% "$" CurrentABI " / $" TotalABI ""
		GuiControl,,Investment,% "$" CurrentInvest " / $" TotalInvest ""
		}                       
	If (TotalABI = 0)    
		{                       
		Gui, Font, s11 c%NumColor%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}                       
	else, if (TotalABI > MaxABI) or (TotalABI < MinABI) and (WarnBox = 1)
		{                       
		Gui, Font, s11 c%NumColorWarn%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}                       
	else, if (TotalABI <= MaxABI) and (TotalABI >= MinABI) and (GoalBox = 1)
		{                       
		Gui, Font, s11 c%NumColorGoal%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}	                    
	If (TotalInvest > MaxInvest) and (WarnBox = 1)
		{                       
		Gui, Font, s11 c%NumColorWarn%
		Gui, Font, Norm         
		GuiControl, Font, Investment
		}                       
	else                        
		{                       
		Gui, Font, s11 c%NumColor%
		Gui, Font, Norm         
		GuiControl, Font, Investment
		}	                    
	GetBuyin(Title,byref currency="",Byref BuyinText="", RebuyMulti="3")
		{                       
		Static CurrencyList:="$,€"
		Haystack:=Substr(Title, Instr(Title,"Sat:")+1) 
		Loop,Parse,Currencylist,`,
			{                   
			If ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
				{               
				BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
				Currency=%A_loopField%
				Buyin:=BuyinText
				StringReplace,Buyin,Buyin,%Currency%,, 
				IfInString, Buyin, +R
					{	        
					StringReplace,Buyin,Buyin,+R,, 
					Buyin := Buyin * RebuyMulti					
					}            
				If Buyin is not number
					{           
					Buyin:=0    
					currency:=  
					buyinText:=    
					}           
				Break           
				}               
			}                   
		Return Buyin            
		}        
;--------------------------------------------------------------------------------------------------------------------------------
	VPP1 := t1 * Stake1VPP      
	VPP2 := t2 * Stake2VPP      
	VPP3 := t3 * Stake3VPP      
	VPP4 := t4 * Stake4VPP      
	VPP5 := t5 * Stake5VPP      
	VPP6 := t6 * Stake6VPP      
	VPP7 := t7 * Stake7VPP      
	VPP8 := t8 * Stake8VPP      
	VPP9 := t9 * Stake9VPP	    
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)	
	FPP := VPP * VIPMulti	
	Rake := Round(VPP/5.5, 2)
	Rakeback := Round(FPP*0.016, 2)    
	If (VPP >= VPPGoal) and (GoalBox = 1)
		{                       
		Gui, Font, s10 c%NumColorGoal%
		GuiControl, Font, VPP   
		}	                    
	If VPP >= 10000             
		{                       
		VK = k                  
		VPP := Round(VPP/1000,5)
		StringTrimRight, VPP, VPP, 4
		IfInString, VPP, .0     
			StringReplace, VPP, VPP, .0,
		}                       
	else, if VPP >= 1000        
		{                       
		VK = k                  
		VPP := Round(VPP/1000,5)
		StringTrimRight, VPP, VPP, 3
		}	                    
	IfInString, VPP, .00        
		StringReplace, VPP, VPP, .00,		
	Loop, 9                     
		{                       
		N += 1                  
		IfInString, VPP, .%N%0  
			{                   
			StringTrimRight, VPP, VPP, 1
			break               
			}	                
		}		                
	N = 0                       
    GuiControl,, VPP, %VPP%%VK% 
;--------------------------------------------------------------------------------------------------------------------------------
	FPP := Round(FPP,2)	        
	If FPP >= 10000             
		{                       
		FK = k                  
		FPP := Round(FPP/1000,5)
		StringTrimRight, FPP, FPP, 4
		IfInString, FPP, .0     
			StringReplace, FPP, FPP, .0,
		}                       
	else, if FPP >= 1000        
		{                       
		FK = k                  
		FPP := Round(FPP/1000,5)
		StringTrimRight, FPP, FPP, 3
		}	                    
	IfInString, FPP, .00        
		StringReplace, FPP, FPP, .00,				
	Loop, 9                     
		{                       
		N += 1                  
		IfInString, FPP, .%N%0  
			{                   
			StringTrimRight, FPP, FPP, 1
			break               
			}	                
		}		                
	N = 0                       
    GuiControl,, FPP, %FPP%%FK%                
    GuiControl,, Rake, $%Rake%              
    GuiControl,, Rakeback, $%Rakeback%
return	                        
;================================================================================================================================
Timers:                         
	FormatTime, Time, %A_Now%, H:mm
	GuiControl,, Clock, %Time%  
	StringTrimLeft, TimeOnly, A_Now, 10
	StringTrimRight, Minutes, TimeOnly, 2
	If BreakBox = 1             
		{                       
		IfGreaterOrEqual, Minutes, 55
			{                   
			Gui, Font, s20 c%ClockColorBreak%
			Gui, Font, Bold     
			GuiControl, Font, Clock
			}                   
		else                    
			{                   
			Gui, Font, s20 c%NumColor%
			Gui, Font, Bold     
			GuiControl, Font, Clock
			}                   
		}                       
	else                        
		{                       
		Gui, Font, s20 c%NumColor%
		Gui, Font, Bold         
		GuiControl, Font, Clock 
		}                       
;--------------------------------------------------------------------------------------------------------------------------------
	IfWinExist, ahk_class PokerStarsTableFrameClass
		{  
		If (Minutes != Var)         
			{                       
			M2 += 1                 
			Var := Minutes          
			}                       
		If (M2 > 9)                 
			{                       
			M1 += 1                 
			M2 = 0                  
			}                       
		If (M1 > 5)                 
			{                       
			H2 += 1                 
			M1 = 0                  
			M2 = 0                  
			}                       
		If (H2 > 9)                 
			{                       
			H1 += 1                 
			H2 = 0                  
			M1 = 0                  
			M2 = 0                  
			}	                    
		Runtime = %H1%%H2%:%M1%%M2% 
		If (Runtime >= SessionTimeGoal) and (GoalBox = 1)
			{                       
			Gui, Font, s14 c%NumColorGoal%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			} 
		else
		    {          
			Gui, Font, s14 c%NumColor%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			}
		If (H1 = 0)                 
			GuiControl,, SessionTime, %H2%:%M1%%M2%
		else, GuiControl,, SessionTime, %H1%%H2%:%M1%%M2%
		} 
	else
		{
		If (H1 = 0)                 
			GuiControl,, SessionTime, %H2%:%M1%%M2%
		If (M2 = -1)    
			{
			Gui, Font, s14 c%NumColor%
			Gui, Font, Norm           
			GuiControl, Font, SessionTime 
			GuiControl,, SessionTime, -
			}
		else
			{
			Gui, Font, s14 c%NumColorWarn%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			}
		}
;--------------------------------------------------------------------------------------------------------------------------------
	S := ((H1 * 600) + (H2 * 60) + (M1 * 10) + M2) / 60
	S := Round(S,6)             
	Games := (t0 - c0) / S      
	Games := Round(Games,1)     
	IfInString, Games, .0       
		StringReplace, Games, Games, .0,
	If (Games = 0)              
		Games = -               
	GuiControl,, Games, %Games% 
return	
;================================================================================================================================
CheckLog:                   
	IfNotExist, %A_ScriptDir%\SessionMan.log.ini
		IniWrite, 0 (logging disabled), %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = true           
		{                       
		IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		IniRead, GamesLogged, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		If GamesLogged != 0 Game(s)
			{                   
			SessionCount += 1   
			IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		IniWrite, %Start%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Start
		IniWrite, still running, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
		IniWrite, n/a, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		Menu Tray, Check, Enable Logging
		}                       
return                          
;================================================================================================================================
CreateLog:                      
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = true           
		{                       
		IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged                    
		FormatTime, Finish, %A_Now%, ddd d.M.yyyy H:mm:ss
		IniWrite, %Finish%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
		IniWrite, %H1%%H2%:%M1%%M2%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
		Completed := t0 - c0    
		IniWrite, %t0% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
		IniWrite, %Completed% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		If Completed != 0       
			{                   
			If (H = 0) and (M1 = 0) and (M2 = 0)
				Games := Completed
			IniWrite, %Games%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Games/h
			IniWrite, $%TotalABI%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, ABI
			IniWrite, $%TotalInvest%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Invested
			IniWrite, %VPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, VPP
			IniWrite, %FPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, FPP
			IniWrite, $%Rake%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Rake
			IniWrite, $%Rakeback%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Rakeback
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		}                       
return         
;================================================================================================================================
CheckIni:                       
	IfNotExist, %A_ScriptDir%\SessionMan.ini
		{                       
		IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, x
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, y
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log
		}                       
return	                                         
;================================================================================================================================
UpdateIni:                      
	IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
	IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	IniWrite, %Logging%, %A_ScriptDir%\SessionMan.ini, Logging, Log
	If LCaption                  
		IniWrite, %LCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, LCaption
	If MCaption                  
		IniWrite, %MCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, MCaption
	If RCaption                  
		IniWrite, %RCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, RCaption
	If Stake1                   
		IniWrite, %Stake1%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1
	If Stake2                   
		IniWrite, %Stake2%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2
	If Stake3                   
		IniWrite, %Stake3%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3
	If Stake4                   
		IniWrite, %Stake4%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4
	If Stake5                   
		IniWrite, %Stake5%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5
	If Stake6                   
		IniWrite, %Stake6%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6
	If Stake7                   
		IniWrite, %Stake7%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7
	If Stake8                   
		IniWrite, %Stake8%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8
	If Stake9                   
		IniWrite, %Stake9%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9
	If Type1                    
		IniWrite, %Type1%, %A_ScriptDir%\SessionMan.ini, Stakes, Type1
	If Type2                    
		IniWrite, %Type2%, %A_ScriptDir%\SessionMan.ini, Stakes, Type2
	If Type3                    
		IniWrite, %Type3%, %A_ScriptDir%\SessionMan.ini, Stakes, Type3
	If Type4                    
		IniWrite, %Type4%, %A_ScriptDir%\SessionMan.ini, Stakes, Type4
	If Type5                    
		IniWrite, %Type5%, %A_ScriptDir%\SessionMan.ini, Stakes, Type5
	If Type6                    
		IniWrite, %Type6%, %A_ScriptDir%\SessionMan.ini, Stakes, Type6
	If Type7                    
		IniWrite, %Type7%, %A_ScriptDir%\SessionMan.ini, Stakes, Type7
	If Type8                    
		IniWrite, %Type8%, %A_ScriptDir%\SessionMan.ini, Stakes, Type8
	If Type9                    
		IniWrite, %Type9%, %A_ScriptDir%\SessionMan.ini, Stakes, Type9
	If Stake1VPP                
		IniWrite, %Stake1VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP
	If Stake2VPP                
		IniWrite, %Stake2VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP
	If Stake3VPP                
		IniWrite, %Stake3VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP
	If Stake4VPP                
		IniWrite, %Stake4VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP
	If Stake5VPP                
		IniWrite, %Stake5VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP
	If Stake6VPP                
		IniWrite, %Stake6VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP
	If Stake7VPP                
		IniWrite, %Stake7VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP
	If Stake8VPP                
		IniWrite, %Stake8VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP
	If Stake9VPP                
		IniWrite, %Stake9VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP
	If ColorsBox                
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
	If Color1                   
		IniWrite, %Color1%, %A_ScriptDir%\SessionMan.ini, Stakes, Color1
	If Color2                   
		IniWrite, %Color2%, %A_ScriptDir%\SessionMan.ini, Stakes, Color2
	If Color3                   
		IniWrite, %Color3%, %A_ScriptDir%\SessionMan.ini, Stakes, Color3
	If Color4                   
		IniWrite, %Color4%, %A_ScriptDir%\SessionMan.ini, Stakes, Color4
	If Color5                   
		IniWrite, %Color5%, %A_ScriptDir%\SessionMan.ini, Stakes, Color5
	If Color6                   
		IniWrite, %Color6%, %A_ScriptDir%\SessionMan.ini, Stakes, Color6
	If Color7                   
		IniWrite, %Color7%, %A_ScriptDir%\SessionMan.ini, Stakes, Color7
	If Color8                   
		IniWrite, %Color8%, %A_ScriptDir%\SessionMan.ini, Stakes, Color8
	If Color9                   
		IniWrite, %Color9%, %A_ScriptDir%\SessionMan.ini, Stakes, Color9
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If GUIColor                 
		IniWrite, %GUIColor%, %A_ScriptDir%\SessionMan.ini, Options, GUIColor
	If NumColor                 
		IniWrite, %NumColor%, %A_ScriptDir%\SessionMan.ini, Options, NumColor
	If TextColor                
		IniWrite, %TextColor%, %A_ScriptDir%\SessionMan.ini, Options, TextColor
	If SeparatorColor           
		IniWrite, %SeparatorColor%, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor
	If GoalBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
	If NumColorGoal             
		IniWrite, %NumColorGoal%, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal
	If WarnBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
	If NumColorWarn             
		IniWrite, %NumColorWarn%, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn
	If BreakBox                 
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
	If ClockColorBreak          
		IniWrite, %ClockColorBreak%, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak
	If MinMTRatio               
		IniWrite, %MinMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio
	If MaxMTRatio               
		IniWrite, %MaxMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio
	If TotalLimit               
		IniWrite, %TotalLimit%, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit
	If SessionTimeGoal          
		IniWrite, %SessionTimeGoal%, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal
	If MinABI                   
		IniWrite, %MinABI%, %A_ScriptDir%\SessionMan.ini, Options, MinABI
	If MaxABI                   
		IniWrite, %MaxABI%, %A_ScriptDir%\SessionMan.ini, Options, MaxABI
	If MaxInvest                
		IniWrite, %MaxInvest%, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest
	If VPPGoal                  
		IniWrite, %VPPGoal%, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal
	If VIPMulti                 
		IniWrite, %VIPMulti%, %A_ScriptDir%\SessionMan.ini, Options, VIPMulti
	If BustBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BustBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BustBox
	If SoundBust                
		IniWrite, %SoundBust%, %A_ScriptDir%\SessionMan.ini, Options, SoundBust
	If AchieveBox               
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
	If SoundAchieve             
		IniWrite, %SoundAchieve%, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve
	If IntervalBox              
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
	If SoundInterval            
		IniWrite, %SoundInterval%, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If SlotA1x                  
		IniWrite, %SlotA1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x
	If SlotA2x                  
		IniWrite, %SlotA2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x
	If SlotA3x                  
		IniWrite, %SlotA3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x
	If SlotA4x                  
		IniWrite, %SlotA4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x
	If SlotB1x                  
		IniWrite, %SlotB1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x
	If SlotB2x                  
		IniWrite, %SlotB2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x
	If SlotB3x                  
		IniWrite, %SlotB3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x
	If SlotB4x                  
		IniWrite, %SlotB4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x
	If SlotC1x                  
		IniWrite, %SlotC1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x
	If SlotC2x                  
		IniWrite, %SlotC2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x
	If SlotC3x                  
		IniWrite, %SlotC3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x
	If SlotC4x                  
		IniWrite, %SlotC4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x
	If SlotA1y                  
		IniWrite, %SlotA1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y
	If SlotA2y                  
		IniWrite, %SlotA2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y
	If SlotA3y                  
		IniWrite, %SlotA3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y
	If SlotA4y                  
		IniWrite, %SlotA4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y
	If SlotB1y                  
		IniWrite, %SlotB1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y
	If SlotB2y                  
		IniWrite, %SlotB2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y
	If SlotB3y                  
		IniWrite, %SlotB3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y
	If SlotB4y                  
		IniWrite, %SlotB4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y
	If SlotC1y                  
		IniWrite, %SlotC1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y
	If SlotC2y                  
		IniWrite, %SlotC2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y
	If SlotC3y                  
		IniWrite, %SlotC3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y
	If SlotC4y                  
		IniWrite, %SlotC4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If SlotA1Key                
		IniWrite, %SlotA1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key
	If SlotA2Key                
		IniWrite, %SlotA2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key
	If SlotA3Key                
		IniWrite, %SlotA3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key
	If SlotA4Key                
		IniWrite, %SlotA4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key
	If SlotB1Key                
		IniWrite, %SlotB1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key
	If SlotB2Key                
		IniWrite, %SlotB2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key
	If SlotB3Key                
		IniWrite, %SlotB3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key
	If SlotB4Key                
		IniWrite, %SlotB4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key
	If SlotC1Key                
		IniWrite, %SlotC1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key
	If SlotC2Key                
		IniWrite, %SlotC2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key
	If SlotC3Key                
		IniWrite, %SlotC3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key
	If SlotC4Key                
		IniWrite, %SlotC4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key
	If Reset                    
		IniWrite, %Reset%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset
	If Increase                 
		IniWrite, %Increase%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase
	If Pause                    
		IniWrite, %Pause%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Pause
	If Close                    
		IniWrite, %Close%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close	
return                          
;================================================================================================================================
ReadIni:                        
	IniRead, LCaption, %A_ScriptDir%\SessionMan.ini, Stakes, LCaption, 180s
	IniRead, MCaption, %A_ScriptDir%\SessionMan.ini, Stakes, MCaption, 45s
	IniRead, RCaption, %A_ScriptDir%\SessionMan.ini, Stakes, RCaption, 18s
	IniRead, Stake1, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1, $3.50+R
	IniRead, Stake2, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2, $8.00
	IniRead, Stake3, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3, $15.00
	IniRead, Stake4, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4, $3.50
	IniRead, Stake5, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5, $7.00
	IniRead, Stake6, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6, $15.00
	IniRead, Stake7, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7, $3.50
	IniRead, Stake8, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8, $7.00
	IniRead, Stake9, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9, $15.00
	IniRead, Type1, %A_ScriptDir%\SessionMan.ini, Stakes, Type1, 180
	IniRead, Type2, %A_ScriptDir%\SessionMan.ini, Stakes, Type2, 180
	IniRead, Type3, %A_ScriptDir%\SessionMan.ini, Stakes, Type3, 180
	IniRead, Type4, %A_ScriptDir%\SessionMan.ini, Stakes, Type4, 45
	IniRead, Type5, %A_ScriptDir%\SessionMan.ini, Stakes, Type5, 45
	IniRead, Type6, %A_ScriptDir%\SessionMan.ini, Stakes, Type6, 45
	IniRead, Type7, %A_ScriptDir%\SessionMan.ini, Stakes, Type7, 18
	IniRead, Type8, %A_ScriptDir%\SessionMan.ini, Stakes, Type8, 18
	IniRead, Type9, %A_ScriptDir%\SessionMan.ini, Stakes, Type9, 18
	IniRead, Stake1VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP, 1.71					 
	IniRead, Stake2VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP, 3.63													
	IniRead, Stake3VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP, 6.77												
	IniRead, Stake4VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP, 1.71											 
	IniRead, Stake5VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP, 3.19					 
	IniRead, Stake6VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP, 6.71													
	IniRead, Stake7VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP, 1.87												
	IniRead, Stake8VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP, 3.03											 
	IniRead, Stake9VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP, 6.11			
	IniRead, Color1, %A_ScriptDir%\SessionMan.ini, Stakes, Color1, ff0000
	IniRead, Color2, %A_ScriptDir%\SessionMan.ini, Stakes, Color2, ff5500
	IniRead, Color3, %A_ScriptDir%\SessionMan.ini, Stakes, Color3, ffaa00
	IniRead, Color4, %A_ScriptDir%\SessionMan.ini, Stakes, Color4, 00ff55
	IniRead, Color5, %A_ScriptDir%\SessionMan.ini, Stakes, Color5, 005555
	IniRead, Color6, %A_ScriptDir%\SessionMan.ini, Stakes, Color6, 00aaaa
	IniRead, Color7, %A_ScriptDir%\SessionMan.ini, Stakes, Color7, 0033ff
	IniRead, Color8, %A_ScriptDir%\SessionMan.ini, Stakes, Color8, 5555ff
	IniRead, Color9, %A_ScriptDir%\SessionMan.ini, Stakes, Color9, aa55ff 
	IniRead, ColorsBox, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox, 0
	IniRead, GUIColor, %A_ScriptDir%\SessionMan.ini, Options, GUIColor, 383838
	IniRead, NumColor, %A_ScriptDir%\SessionMan.ini, Options, NumColor, 999999
	IniRead, TextColor, %A_ScriptDir%\SessionMan.ini, Options, TextColor, Black
	IniRead, SeparatorColor, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor, 282828
	IniRead, GoalBox, %A_ScriptDir%\SessionMan.ini, Options, GoalBox, 1 
	IniRead, NumColorGoal, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal, 33ff33
	IniRead, WarnBox, %A_ScriptDir%\SessionMan.ini, Options, WarnBox, 1 
	IniRead, NumColorWarn, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn, Red
	IniRead, BreakBox, %A_ScriptDir%\SessionMan.ini, Options, BreakBox, 1
	IniRead, ClockColorBreak, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak, Red
	IniRead, MinMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio, 16
	IniRead, MaxMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio, 20
	IniRead, TotalLimit, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit, 150
	IniRead, SessionTimeGoal, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal, 06:00
	IniRead, MinABI, %A_ScriptDir%\SessionMan.ini, Options, MinABI, 5
	IniRead, MaxABI, %A_ScriptDir%\SessionMan.ini, Options, MaxABI, 7
	IniRead, MaxInvest, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest, 1000
	IniRead, VPPGoal, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal, 375
	IniRead, VIPMulti, %A_ScriptDir%\SessionMan.ini, Options, VIPMulti, 2
	IniRead, BustBox, %A_ScriptDir%\SessionMan.ini, Options, BustBox, 0
	IniRead, SoundBust, %A_ScriptDir%\SessionMan.ini, Options, SoundBust, C:\Program Files (x86)\PokerStars\snd\bust.wav
	IniRead, AchieveBox, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox, 0	
	IniRead, SoundAchieve, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve, C:\Program Files (x86)\PokerStars\snd\ding.wav
	IniRead, IntervalBox, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox, 0
	IniRead, SoundInterval, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval, 25
	IniRead, SlotA1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x, 304
	IniRead, SlotA2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x, 1112
	IniRead, SlotA3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x, 1920
	IniRead, SlotA4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x, 2728
	IniRead, SlotB1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x, 304
	IniRead, SlotB2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x, 1112
	IniRead, SlotB3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x, 1920
	IniRead, SlotB4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x, 2728
	IniRead, SlotC1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x, 304
	IniRead, SlotC2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x, 1112
	IniRead, SlotC3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x, 1920
	IniRead, SlotC4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x, 2728
	IniRead, SlotA1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y, 0
	IniRead, SlotA2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y, 0
	IniRead, SlotA3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y, 0
	IniRead, SlotA4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y, 0
	IniRead, SlotB1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y, 584
	IniRead, SlotB2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y, 584
	IniRead, SlotB3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y, 584
	IniRead, SlotB4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y, 584	
	IniRead, SlotC1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y, 299
	IniRead, SlotC2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y, 299
	IniRead, SlotC3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y, 299
	IniRead, SlotC4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y, 299
	IniRead, SlotA1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key, F1
	IniRead, SlotA2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key, F2
	IniRead, SlotA3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key, F3
	IniRead, SlotA4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key, F4
	IniRead, SlotB1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key, F5
	IniRead, SlotB2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key, F6
	IniRead, SlotB3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key, F7
	IniRead, SlotB4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key, F8
	IniRead, SlotC1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key, F9
	IniRead, SlotC2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key, F10
	IniRead, SlotC3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key, F11
	IniRead, SlotC4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key, F12
	IniRead, Reset, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset, CTRL+F9
	IniRead, Increase, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase, CTRL+F10
	IniRead, Pause, %A_ScriptDir%\SessionMan.ini, Hotkeys, Pause, ALT+Pause
	IniRead, Close, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close, CTRL+Q
return     
;================================================================================================================================
;======================================================== HOTKEYS ===============================================================
^F9::				;counter (SessionTime) reset
	{                           
	FormatTime, Start, %A_Now%, ddd d.M.yyyy HH:mm:ss
	H1 = 0                      
	H2 = 0                      
	M1 = 0                      
	M2 = 0                      
	Gui, Font, s14 c%NumColor%  
	Gui, Font, Norm             
	GuiControl, Font, SessionTime
	GuiControl,, SessionTime, %H2%:%M1%%M2%
	Gosub CheckLog          
	}                           
return                          
;--------------------------------------------------------------------------------------------------------------------------------
^F10::				;counter (SessionTime) + 1
	Var = -1                    
return                          
;--------------------------------------------------------- SLOT1 ----------------------------------------------------------------
F1::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA1x%, %SlotA1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT2 ----------------------------------------------------------------
F2::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA2x%, %SlotA2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT3 ----------------------------------------------------------------
F3::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA3x%, %SlotA3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT4 ----------------------------------------------------------------
F4::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA4x%, %SlotA4y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT5 ----------------------------------------------------------------
F5::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB1x%, %SlotB1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT6 ----------------------------------------------------------------
F6::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB2x%, %SlotB2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT7 ----------------------------------------------------------------
F7::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB3x%, %SlotB3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT8 ----------------------------------------------------------------
F8::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB4x%, %SlotB4y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT9 ----------------------------------------------------------------
F9::                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC1x%, %SlotC1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT10 ----------------------------------------------------------------
F10::                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC2x%, %SlotC2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT11 ----------------------------------------------------------------
F11::                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC3x%, %SlotC3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT12 ----------------------------------------------------------------
F12::                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC4x%, %SlotC4y%
	else, return                
	}                           
return                          
;--------------------------------------------------------------------------------------------------------------------------------
^Q::                            
	Gosub, GuiClose             
return                          
;--------------------------------------------------------------------------------------------------------------------------------
!Pause::Pause

Last edited by Baobhan-Sith; 11-18-2013 at 02:30 PM.
Table Counter AHK for PokerStars Quote
11-18-2013 , 06:22 PM
Quote:
Originally Posted by Baobhan-Sith
Also fwiw, you need to run Autohotkey 1.0.48.05, other versions are not supported atm.
This did it for me, I was running a newer version, thanks
Table Counter AHK for PokerStars Quote
11-30-2013 , 09:03 PM
Quote:
Originally Posted by Baobhan-Sith
- ABI/Invest will only consider games you defined
Obv brain fail, it will consider all games but it will only update when the number of tables changes, ie. when the counter updates.

Anyway, I finally managed to make hotkeys and rebuy multiplicator configurable through the settings GUI. I had to remove the hotkey to pause the script but you can still do that via the tray menu.

I also made FPP and basic rakeback calculation easier - just select your VIP status and that's it. VIP status dependant rakeback does not consider stellar rewards and milestone credits though, but you can override that with your individual RB percentage. RB calculation might however still be a tiny bit off due to rounding errors and it being based on VPP.

Spoiler:
Code:
;================================================================================================================================
;================================================== INITIAL SETTINGS ============================================================ 	;<
#SingleInstance, force				
#NoEnv
DetectHiddenWindows, On
SetTitleMatchMode, 1					
Build = 2.4
LoopInterval = 100		

Menu Tray, NoStandard
Menu Tray, Add, Bring To Front, TrayBring
Menu Tray, Add, Save Position, TrayPosition
Menu Tray, Add
Menu Tray, Add, Enable Logging, TrayLog
Menu Tray, Add, Open Logfile, TrayLogfile
Menu Tray, Add, Clear Logfile, TrayClrLog
Menu Tray, Add
Menu Tray, Add, Settings, TrayConfig
Menu Tray, Add
Menu Tray, Add, Pause/Continue, TrayPause
Menu Tray, Add
Menu Tray, Add, Reload Script, TrayReload
Menu Tray, Add, Exit, TrayExit

FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
Gosub CheckIni
Gosub ReadIni
Gosub CheckLog

If (ColorsBox = 0)
Loop, 9
	{
	C += 1
	Color%C% := NumColor
	}

ABI := "  ABI  "
Invest := "  Invest  "
Gamesh := "  Games/h  "
Clock := "  Clock  "
Time := "  Time "
TotalInvest := Rake := 0.00             
TotalInvest_TournamentCounter := 0
S := P1 := P2 := H1 := H2 := M1 := 0   
M2 = -1                         
r0 := r1 := r2 := r3 := r4 := r5 := r6 := r7 := r8 := r9 := 0
c1 := c2 := c3 := c4 := c5 := c6 := c7 := c8 := c9 := 0
t := t1 := t2 := t3 := t4 := t5 := t6 := t7 := t8 := t9 := 0
VPP1 := VPP2 := VPP3 := VPP4 := VPP5 := VPP6 := VPP7 := VPP8 := VPP9 := FPP := 0 

Hotkey, %SlotA1Key%, Slot1
Hotkey, %SlotA2Key%, Slot2
Hotkey, %SlotA3Key%, Slot3
Hotkey, %SlotA4Key%, Slot4
Hotkey, %SlotB1Key%, Slot5
Hotkey, %SlotB2Key%, Slot6
Hotkey, %SlotB3Key%, Slot7
Hotkey, %SlotB4Key%, Slot8
Hotkey, %SlotC1Key%, Slot9
Hotkey, %SlotC2Key%, Slot10
Hotkey, %SlotC3Key%, Slot11
Hotkey, %SlotC4Key%, Slot12
Hotkey, %Reset%, TimeReset
Hotkey, %Increase%, TimeIncrease
Hotkey, %Close%, GuiClose

If (SilverBox = 1)
	{
	VIPMulti :=  1.5
	Value := 0.011111
	}
else, if (GoldBox = 1)
	{
	VIPMulti :=  2
	Value := 0.012
	}	
else, if (PlatinBox = 1)
	{
	VIPMulti :=  2.5
	Value := 0.013
	}	
else, if (SNBox = 1)
	{
	VIPMulti :=  3.5
	Value := 0.016
	}	
else, if (SNEBox = 1)
	{
	VIPMulti :=  5
	Value := 0.016
	}	
else
	{
	VIPMulti :=  1
	Value := 0.01
	}	
;================================================================================================================================ 	
;====================================================== MAIN GUI ================================================================ 	;|
Gui -MaximizeBox -Resize +AlwaysOnTop ;+ToolWindow -MinimizeBox
Gui, Show, W376 H305 x%xpos% y%ypos%, SessionMan %Build%	
Gui, Color, %GUIColor%		
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%, Verdana					
Gui, Add, Text, x3 y7 Left, VPP						
Gui, Add, Text, x3 y27 Left, FPP					
Gui, Add, Text, x342 y7 Right, Rake			
Gui, Add, Text, x342 y27 Right, RB	
Gui, Font, s10 c%NumColor%					
Gui, Add, Text, x41 y7 Left vVPP, 0000.00 	
Gui, Add, Text, x41 y27 Left vFPP, 00000.00	
Gui, Add, Text, x275 y7 Right vRake, $0000.00 	
Gui, Add, Text, x275 y27 Right vRakeback, $0000.00							
Gui, Font, s8 c%TextColor%					
Gui, Add, Text, x152 y0 Center, Total Tables
Gui, Font, s22 c%NumColor%					
Gui, Add, Text, x108 y13 vTotalTables Center, 000 / 0000	
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x37 y50 vLCaption Center, xxxxxx				
Gui, Add, Text, x164 y50 vMCaption Center, xxxxxx				
Gui, Add, Text, x292 y50 vRCaption Center, xxxxxx							
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y45 Center, ____								
Gui, Add, Text, x86 y45 Center, __________			
Gui, Add, Text, x212 y45 Center, __________					
Gui, Add, Text, x338 y45 Center, ____
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s8 c%Color1%				
Gui, Add, Text, x0 y70 vControl1 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color1%				
Gui, Add, Text, x2 y82 vCounter1 Center, 000 / 0000									
Gui, Font, s8 c%Color2%			
Gui, Add, Text, x0 y114 vControl2 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color2%				
Gui, Add, Text, x2 y126 vCounter2 Center, 000 / 0000									
Gui, Font, s8 c%Color3%				
Gui, Add, Text, x0 y158 vControl3 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color3%				
Gui, Add, Text, x2 y170 vCounter3 Center, 000 / 0000										
Gui, Font, s8 c%Color4%				
Gui, Add, Text, x128 y70 vControl4 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color4%			
Gui, Add, Text, x130 y82 vCounter4 Center, 000 / 0000										
Gui, Font, s8 c%Color5%				
Gui, Add, Text, x128 y114 vControl5 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color5%			
Gui, Add, Text, x130 y126 vCounter5 Center, 000 / 0000										
Gui, Font, s8 c%Color6%				
Gui, Add, Text, x128 y158 vControl6 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color6%				
Gui, Add, Text, x130 y170 vCounter6 Center, 000 / 0000										
Gui, Font, s8 c%Color7%				
Gui, Add, Text, x256 y70 vControl7 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color7%				
Gui, Add, Text, x258 y82 vCounter7 Center, 000 / 0000									
Gui, Font, s8 c%Color8%				
Gui, Add, Text, x256 y114 vControl8 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color8%			
Gui, Add, Text, x258 y126 vCounter8 Center, 000 / 0000										
Gui, Font, s8 c%Color9%				
Gui, Add, Text, x256 y158 vControl9 Center, xxxxxxxx|xxxxxxxx								
Gui, Font, s16 c%Color9%			
Gui, Add, Text, x258 y170 vCounter9 Center, 000 / 0000
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x66 y203 Center, %ABI%				
Gui, Add, Text, x247 y203 Center, %Invest%
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y197 Center, ________				
Gui, Add, Text, x108 y197 Center, _________________				
Gui, Add, Text, x314 y197 Center, _______
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s11 c%NumColor%					
Gui, Add, Text, x4 y224 vAvgBI Center, $0000.00 ($0000.00)				
Gui, Add, Text, x184 y224 vInvestment Center, $00000.00 ($00000.00) 
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s10 c%TextColor%					
Gui, Add, Text, x25 y252 Center, %Gamesh%				
Gui, Add, Text, x160 y252 Center, %Clock%				
Gui, Add, Text, x288 y252 Center, %Time%
Gui, Font, s10 c%SeparatorColor%					
Gui, Add, Text, x4 y247 Center, ___					
Gui, Add, Text, x104 y247 Center, _______				
Gui, Add, Text, x216 y247 Center, _________				
Gui, Add, Text, x338 y247 Center, ____	
;--------------------------------------------------------------------------------------------------------------------------------
Gui, Font, s14 c%NumColor%					
Gui, Add, Text, x33 y271 vGames Center, 0000.0						
Gui, Add, Text, x287 y271 vSessionTime Center, 00:00
Gui, Font, s20 c%NumColor%					
Gui, Add, Text, x147 y268 vClock Center, 00000	
;--------------------------------------------------------------------------------------------------------------------------------
Loop, 9                         
	{                           
	N += 1                      
	IfInString, Stake%N%, .00   
		StringReplace, Stake%N%b, Stake%N%, .00,
	else, Stake%N%b := Stake%N%	
	IfInString, Stake%N%b, +R   
		StringReplace, Stake%N%b, Stake%N%b, +,
	}	                        
N = 0	      
;--------------------------------------------------------------------------------------------------------------------------------                  
GuiControl,, LCaption, %LCaption%
GuiControl,, MCaption, %MCaption%
GuiControl,, RCaption, %RCaption%
GuiControl,, Control1, %Stake1b%
GuiControl,, Control2, %Stake2b%
GuiControl,, Control3, %Stake3b%
GuiControl,, Control4, %Stake4b%
GuiControl,, Control5, %Stake5b%
GuiControl,, Control6, %Stake6b%
GuiControl,, Control7, %Stake7b%
GuiControl,, Control8, %Stake8b%
GuiControl,, Control9, %Stake9b%
;================================================================================================================================ 	
;=================================================== TOTALS COUNTER ============================================================= 	;|
Loop                            
	{	                        
    c0 := c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 
    t0 := t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 
	If (t0 = 0)                 
		GuiControl,, TotalTables, 0
	else, GuiControl,, TotalTables, %c0% / %t0%
    If (c0 < r0)                
    	{                       
		If BustBox = 1          
		SoundPlay, %SoundBust%  
    	}	                    
    r0 = %c0%                   
    If (c0 < MinMTRatio)        
		{                       
		Gui, Font, s22 c%NumColor%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
	else, if (c0 > MaxMTRatio) and (WarnBox = 1)
		{                       
		Gui, Font, s22 c%NumColorWarn%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
	else, if GoalBox = 1        
		{                       
		Gui, Font, s22 c%NumColorGoal%
		Gui, Font, Bold         
		GuiControl, Font, TotalTables
		}                       
    If (t0 = TotalLimit)        
    	{                       
		If AchieveBox = 1       
			SoundPlay, %SoundAchieve%
		TotalLimit := t0 + SoundInterval
    	}	                    
	If (c0 != clast)            
		{  
		Gosub Stakes            
		Gosub Buyin       
		clast := c0
		P1 = 1
		}
	else, P1 = 0
;--------------------------------------------------------------------------------------------------------------------------------
	IfWinNotExist, ahk_class PokerStarsTableFrameClass
		{                       
		P2 += 1                  
		If (P2 = 2)              
			{                   
			Loop                
				{               
				Gosub Timers    
				Sleep %LoopInterval%
				IfWinExist, ahk_class PokerStarsTableFrameClass
					break       
				}               
			P2 = 0               
			}				    
		} 
	If (P1 = 0)
		Gosub Stakes
	Gosub Timers                
	Sleep %LoopInterval%    
	}                           
return            
;================================================================================================================================ 	
;================================================= TRAY MENU HANDLERS =========================================================== 	;|
TrayBring:             
	WinActivate, SessionMan %Build% ahk_class AutoHotkeyGUI
return                          
;================================================================================================================================
TrayPosition:          
	WinGetPos, xpos, ypos,,, SessionMan %Build% ahk_class AutoHotkeyGUI
	IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
	IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
return                          
;================================================================================================================================
TrayReload:            
	Gosub, UpdateLog            
	Reload                      
return                          
;================================================================================================================================
TrayLog:               
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = false          
		{                       
		IniWrite, true, %A_ScriptDir%\SessionMan.ini, Logging, Log
		IfNotExist, %A_ScriptDir%\SessionMan.log.ini
			{                   
			IniWrite, 1, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		Menu Tray, Check, Enable Logging
		Gosub CheckLog      
		}                       
	else                        
		{                       
		IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log	
		Menu Tray, Uncheck, Enable Logging
		}                       
return	                        
;================================================================================================================================
TrayLogfile:           
	Run, %A_ScriptDir%\SessionMan.log.ini
return                          
;================================================================================================================================
TrayClrLog:            
	MsgBox, 4, SessionMan - Clear Logfile, Do you want to clear the logfile?
	IfMsgBox Yes                
		{                       
		IfWinExist, SessionMan.log.ini
			WinClose, SessionMan.log.ini
		FileDelete, %A_ScriptDir%\SessionMan.log.ini
		FormatTime, Start, %A_Now%, ddd d.M.yyyy H:mm:ss
		Gosub CheckLog      
		}                       
return                          
;================================================================================================================================
TrayConfig:            
	IfWinExist, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
		WinActivate, Settings - SessionMan %Build% ahk_class AutoHotkeyGUI
	else, Gosub SettingsGUI
return    
;================================================================================================================================
TrayPause:
	Menu Tray, ToggleCheck, Pause/Continue
	Pause, Toggle	
return	          
;================================================================================================================================
TrayExit:              
	Gosub UpdateLog             
	ExitApp                     
return                          
;================================================================================================================================ 	
;==================================================== SETTINGS GUI ============================================================== 	;|
SettingsGUI:             
	Menu, HelpMenu, Add, AutoHotkey Help, SettingsHelp
	Menu, HelpMenu, Add, WindowSpy, SettingsSpy
	Menu, HelpMenu, Add, Color Codes (Web), SettingsColors
	Menu, Menubar, Add, Help, :HelpMenu
	Gui, 2:Menu, MenuBar        
	Gui, 2:-SysMenu             
	Gui, 2:Show, h520 w334, Settings - SessionMan %Build%
	Gui, 2:Add, Tab, x0 y0 w500 h750 , Stakes|Options|Hotkeys|Types
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Stakes          
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y32 w100 h40 , Captions:
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x31 y50 w50 h20 vLCaption, %LCaption%
	Gui, 2:Add, Edit, x141 y50 w50 h20 vMCaption, %MCaption%
	Gui, 2:Add, Edit, x251 y50 w50 h20 vRCaption, %RCaption%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y82 w50 h20 , Stakes:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x55 y82 w400 h20 , For rebuy games, include the "+R" appendix in the buy-in
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y100 w100 h20 vStake1, %Stake1%
	Gui, 2:Add, Edit, x6 y120 w100 h20 vStake2, %Stake2%
	Gui, 2:Add, Edit, x6 y140 w100 h20 vStake3, %Stake3%
	Gui, 2:Add, Edit, x116 y100 w100 h20 vStake4, %Stake4%
	Gui, 2:Add, Edit, x116 y120 w100 h20 vStake5, %Stake5%
	Gui, 2:Add, Edit, x116 y140 w100 h20 vStake6, %Stake6%
	Gui, 2:Add, Edit, x226 y100 w100 h20 vStake7, %Stake7%
	Gui, 2:Add, Edit, x226 y120 w100 h20 vStake8, %Stake8%
	Gui, 2:Add, Edit, x226 y140 w100 h20 vStake9, %Stake9%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y172 w80 h20 , Game Types:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x87 y172 w400 h20 , See Types Tab
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y190 w100 h20 vType1, %Type1%
	Gui, 2:Add, Edit, x6 y210 w100 h20 vType2, %Type2%
	Gui, 2:Add, Edit, x6 y230 w100 h20 vType3, %Type3%
	Gui, 2:Add, Edit, x116 y190 w100 h20 vType4, %Type4%
	Gui, 2:Add, Edit, x116 y210 w100 h20 vType5, %Type5%
	Gui, 2:Add, Edit, x116 y230 w100 h20 vType6, %Type6%
	Gui, 2:Add, Edit, x226 y190 w100 h20 vType7, %Type7%
	Gui, 2:Add, Edit, x226 y210 w100 h20 vType8, %Type8%
	Gui, 2:Add, Edit, x226 y230 w100 h20 vType9, %Type9%
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y262 w28 h20 , VPP:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x40 y262 w300 h20 , To set to zero, type 0.000000001
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y280 w100 h20 vStake1VPP, %Stake1VPP%
	Gui, 2:Add, Edit, x6 y300 w100 h20 vStake2VPP, %Stake2VPP%
	Gui, 2:Add, Edit, x6 y320 w100 h20 vStake3VPP, %Stake3VPP%
	Gui, 2:Add, Edit, x116 y280 w100 h20 vStake4VPP, %Stake4VPP%
	Gui, 2:Add, Edit, x116 y300 w100 h20 vStake5VPP, %Stake5VPP%
	Gui, 2:Add, Edit, x116 y320 w100 h20 vStake6VPP, %Stake6VPP%
	Gui, 2:Add, Edit, x226 y280 w100 h20 vStake7VPP, %Stake7VPP%
	Gui, 2:Add, Edit, x226 y300 w100 h20 vStake8VPP, %Stake8VPP%
	Gui, 2:Add, Edit, x226 y320 w100 h20 vStake9VPP, %Stake9VPP%
	Gui, 2:Font, s8 cDefault Bold
	If ColorsBox = 1            
			Gui, 2:Add, CheckBox, x8 y350 w105 h20 Checked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
	else, 	Gui, 2:Add, CheckBox, x8 y350 w105 h20 Unchecked%ColorsBox% vColorsBox, %A_Space%Unique Colors:
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x116 y353 w220 h20 , Colors reset to default if disabled
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Edit, x6 y370 w100 h20 vColor1, %Color1%
	Gui, 2:Add, Edit, x6 y390 w100 h20 vColor2, %Color2%
	Gui, 2:Add, Edit, x6 y410 w100 h20 vColor3, %Color3%
	Gui, 2:Add, Edit, x116 y370 w100 h20 vColor4, %Color4%
	Gui, 2:Add, Edit, x116 y390 w100 h20 vColor5, %Color5%
	Gui, 2:Add, Edit, x116 y410 w100 h20 vColor6, %Color6%
	Gui, 2:Add, Edit, x226 y370 w100 h20 vColor7, %Color7%
	Gui, 2:Add, Edit, x226 y390 w100 h20 vColor8, %Color8%
	Gui, 2:Add, Edit, x226 y410 w100 h20 vColor9, %Color9%
	Gui, 2:Add, Button, x118 y465 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y465 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y491 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Options         
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x8 y32 w220 h20 , Background Color
	Gui, 2:Add, Edit, x226 y30 w100 h20 vGUIColor, %GUIColor%
	Gui, 2:Add, Text, x8 y52 w220 h20 , Digit Color
	Gui, 2:Add, Edit, x226 y50 w100 h20 vNumColor, %NumColor%
	Gui, 2:Add, Text, x8 y72 w220 h20 , Caption Color
	Gui, 2:Add, Edit, x226 y70 w100 h20 vTextColor, %TextColor%
	Gui, 2:Add, Text, x8 y92 w220 h20 , Separator Color
	Gui, 2:Add, Edit, x226 y90 w100 h20 vSeparatorColor, %SeparatorColor%
	If GoalBox = 1              
			Gui, 2:Add, CheckBox, x8 y110 w200 h20 Checked%GoalBox% vGoalBox, Achievement Color
	else, 	Gui, 2:Add, CheckBox, x8 y110 w200 h20 Unchecked%GoalBox% vGoalBox, Achievement Color
	Gui, 2:Add, Edit, x226 y110 w100 h20 vNumColorGoal, %NumColorGoal%
	If WarnBox = 1              
			Gui, 2:Add, CheckBox, x8 y130 w200 h20 Checked%WarnBox% vWarnBox, Warning Color
	else, 	Gui, 2:Add, CheckBox, x8 y130 w200 h20 Unchecked%WarnBox% vWarnBox, Warning Color
	Gui, 2:Add, Edit, x226 y130 w100 h20 vNumColorWarn, %NumColorWarn%
	If BreakBox = 1             
			Gui, 2:Add, CheckBox, x8 y150 w200 h20 Checked%BreakBox% vBreakBox, Sync Break Clock Color
	else, 	Gui, 2:Add, CheckBox, x8 y150 w200 h20 Unchecked%BreakBox% vBreakBox, Sync Break Clock Color
	Gui, 2:Add, Edit, x226 y150 w100 h20 vClockColorBreak, %ClockColorBreak%
	Gui, 2:Add, Text, x8 y182 w220 h20 , Multitabling Ratio 
	Gui, 2:Add, Edit, x226 y180 w40 h20 vMinMTRatio, %MinMTRatio%
	Gui, 2:Add, Text, x274 y182 w10 h20 , - 
	Gui, 2:Add, Edit, x286 y180 w40 h20 vMaxMTRatio, %MaxMTRatio%
	Gui, 2:Add, Text, x8 y202 w220 h20 , Destinated Games Per Session
	Gui, 2:Add, Edit, x226 y200 w100 h20 vTotalLimit, %TotalLimit%
	Gui, 2:Add, Text, x8 y222 w220 h20 , Destinated Session Time (hh:mm)
	Gui, 2:Add, Edit, x226 y220 w100 h20 vSessionTimeGoal, %SessionTimeGoal%
	Gui, 2:Add, Text, x8 y242 w220 h20 , Average Buy-In
	Gui, 2:Add, Text, x220 y242 w8 h20 , $
	Gui, 2:Add, Edit, x226 y240 w40 h20 vMinABI, %MinABI%
	Gui, 2:Add, Text, x270 y242 w20 h20 , -  $
	Gui, 2:Add, Edit, x286 y240 w40 h20 vMaxABI, %MaxABI%
	Gui, 2:Add, Text, x8 y262 w220 h20 , Investment Limit
	Gui, 2:Add, Text, x220 y262 w8 h20 , $
	Gui, 2:Add, Edit, x226 y260 w100 h20 vMaxInvest, %MaxInvest%
	Gui, 2:Add, Text, x8 y282 w220 h20 , Rebuy Multiplicator
	Gui, 2:Add, Edit, x226 y280 w100 h20 vRebuyMulti, %RebuyMulti%
	Gui, 2:Add, Text, x8 y302 w220 h20 , VPP Goal
	Gui, 2:Add, Edit, x226 y300 w100 h20 vVPPGoal, %VPPGoal%
	Gui, 2:Add, Text, x8 y332 w420 h20 , VIP Status
	If (BronzeBox = 1) or (GoldBox = 1) or (PlatinBox = 1) or (SNBox = 1) or (SNEBox = 1) 
			Gui, 2:Add, CheckBox, x117 y330 w45 h20 Unchecked%SilverBox% vSilverBox, Silver
	else, 	Gui, 2:Add, CheckBox, x117 y330 w45 h20 Checked%SilverBox% vSilverBox, Silver
	If (BronzeBox = 1) or (SilverBox = 1) or (PlatinBox = 1) or (SNBox = 1) or (SNEBox = 1) 
			Gui, 2:Add, CheckBox, x163 y330 w40 h20 Unchecked%GoldBox% vGoldBox, Gold
	else, 	Gui, 2:Add, CheckBox, x163 y330 w40 h20 Checked%GoldBox% vGoldBox, Gold
	If (BronzeBox = 1) or (GoldBox = 1) or (SilverBox = 1) or (SNBox = 1) or (SNEBox = 1) 
			Gui, 2:Add, CheckBox, x205 y330 w45 h20 Unchecked%PlatinBox% vPlatinBox, Platin
	else, 	Gui, 2:Add, CheckBox, x205 y330 w45 h20 Checked%PlatinBox% vPlatinBox, Platin
	If (BronzeBox = 1) or (GoldBox = 1) or (PlatinBox = 1) or (SilverBox = 1) or (SNEBox = 1) 
			Gui, 2:Add, CheckBox, x250 y330 w35 h20 Unchecked%SNBox% vSNBox, SN
	else, 	Gui, 2:Add, CheckBox, x250 y330 w35 h20 Checked%SNBox% vSNBox, SN
	If (BronzeBox = 1) or (GoldBox = 1) or (PlatinBox = 1) or (SNBox = 1) or (SilverBox = 1) 
			Gui, 2:Add, CheckBox, x285 y330 w100 h20 Unchecked%SNEBox% vSNEBox, SNE
	else, 	Gui, 2:Add, CheckBox, x285 y330 w100 h20 Checked%SNEBox% vSNEBox, SNE
	Gui, 2:Add, Text, x14 y347 w20 h14 , |_
	If RakeBox = 0              
			Gui, 2:Add, CheckBox, x28 y350 w200 h20 Unchecked%RakeBox% vRakeBox, Independent Rakeback Percentage
	else, 	Gui, 2:Add, CheckBox, x28 y350 w200 h20 Checked%RakeBox% vRakeBox, Independent Rakeback Percentage
	Gui, 2:Add, Edit, x226 y350 w100 h20 vRakeback, %Rakeback%
	If BustBox = 0              
			Gui, 2:Add, CheckBox, x8 y380 w100 h20 Unchecked%BustBox% vBustBox, Bustout Sound
	else, 	Gui, 2:Add, CheckBox, x8 y380 w100 h20 Checked%BustBox% vBustBox, Bustout Sound
	Gui, 2:Add, Edit, x126 y380 w200 h20 vSoundBust, %SoundBust%
	If AchieveBox = 0           
			Gui, 2:Add, CheckBox, x8 y400 w115 h20 Unchecked%GoalBox% vAchieveBox, Achievement Sound
	else, 	Gui, 2:Add, CheckBox, x8 y400 w115 h20 Checked%GoalBox% vAchieveBox, Achievement Sound
	Gui, 2:Add, Edit, x126 y400 w200 h20 vSoundAchieve, %SoundAchieve%
	Gui, 2:Add, Text, x14 y417 w20 h14 , |_
	If (IntervalBox = 1) and (AchieveBox = 1)
			Gui, 2:Add, CheckBox, x28 y420 w200 h20 Checked%IntervalBox% vIntervalBox, Repetition Interval
	else, 	Gui, 2:Add, CheckBox, x28 y420 w200 h20 Unchecked%IntervalBox% vIntervalBox, Repetition Interval
	Gui, 2:Add, Edit, x226 y420 w100 h20 vSoundInterval, %SoundInterval%
	Gui, 2:Add, Text, x34 y436 w30 h20 , |__
	Gui, 2:Add, Text, x55 y442 w400 h20 ,This sound applies only for "Destinated Games"
	Gui, 2:Add, Button, x118 y465 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y465 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y491 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Hotkeys         
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x6 y30 w240 h20 , Table Slots
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x110 y30 w240 h20 , X
	Gui, 2:Add, Text, x160 y30 w240 h20 , Y
	Gui, 2:Add, Text, x210 y30 w240 h20 , Hotkey
	Gui, 2:Add, Text, x8 y52 w80 h20 , Slot 1 
	Gui, 2:Add, Edit, x106 y50 w40 h20 vSlotA1x, %SlotA1x%
	Gui, 2:Add, Edit, x156 y50 w40 h20 vSlotA1y, %SlotA1y%
	Gui, 2:Add, Edit, x206 y50 w120 h20 vSlotA1Key, %SlotA1Key%
	Gui, 2:Add, Text, x8 y72 w240 h20 , Slot 2
	Gui, 2:Add, Edit, x106 y70 w40 h20 vSlotA2x, %SlotA2x%
	Gui, 2:Add, Edit, x156 y70 w40 h20 vSlotA2y, %SlotA2y%
	Gui, 2:Add, Edit, x206 y70 w120 h20 vSlotA2Key, %SlotA2Key%
	Gui, 2:Add, Text, x8 y92 w240 h20 , Slot 3
	Gui, 2:Add, Edit, x106 y90 w40 h20 vSlotA3x, %SlotA3x%
	Gui, 2:Add, Edit, x156 y90 w40 h20 vSlotA3y, %SlotA3y%
	Gui, 2:Add, Edit, x206 y90 w120 h20 vSlotA3Key, %SlotA3Key%
	Gui, 2:Add, Text, x8 y112 w240 h20 , Slot 4
	Gui, 2:Add, Edit, x106 y110 w40 h20 vSlotA4x, %SlotA4x%
	Gui, 2:Add, Edit, x156 y110 w40 h20 vSlotA4y, %SlotA4y%
	Gui, 2:Add, Edit, x206 y110 w120 h20 vSlotA4Key, %SlotA4Key%
	Gui, 2:Add, Text, x8 y132 w80 h20 , Slot 5 
	Gui, 2:Add, Edit, x106 y130 w40 h20 vSlotB1x, %SlotB1x%
	Gui, 2:Add, Edit, x156 y130 w40 h20 vSlotB1y, %SlotB1y%
	Gui, 2:Add, Edit, x206 y130 w120 h20 vSlotB1Key, %SlotB1Key%
	Gui, 2:Add, Text, x8 y152 w240 h20 , Slot 6
	Gui, 2:Add, Edit, x106 y150 w40 h20 vSlotB2x, %SlotB2x%
	Gui, 2:Add, Edit, x156 y150 w40 h20 vSlotB2y, %SlotB2y%
	Gui, 2:Add, Edit, x206 y150 w120 h20 vSlotB2Key, %SlotB2Key%
	Gui, 2:Add, Text, x8 y172 w240 h20 , Slot 7
	Gui, 2:Add, Edit, x106 y170 w40 h20 vSlotB3x, %SlotB3x%
	Gui, 2:Add, Edit, x156 y170 w40 h20 vSlotB3y, %SlotB3y%
	Gui, 2:Add, Edit, x206 y170 w120 h20 vSlotB3Key, %SlotB3Key%
	Gui, 2:Add, Text, x8 y192 w240 h20 , Slot 8
	Gui, 2:Add, Edit, x106 y190 w40 h20 vSlotB4x, %SlotB4x%
	Gui, 2:Add, Edit, x156 y190 w40 h20 vSlotB4y, %SlotB4y%
	Gui, 2:Add, Edit, x206 y190 w120 h20 vSlotB4Key, %SlotB4Key%
	Gui, 2:Add, Text, x8 y212 w80 h20 , Slot 9 
	Gui, 2:Add, Edit, x106 y210 w40 h20 vSlotC1x, %SlotC1x%
	Gui, 2:Add, Edit, x156 y210 w40 h20 vSlotC1y, %SlotC1y%
	Gui, 2:Add, Edit, x206 y210 w120 h20 vSlotC1Key, %SlotC1Key%
	Gui, 2:Add, Text, x8 y232 w240 h20 , Slot 10
	Gui, 2:Add, Edit, x106 y230 w40 h20 vSlotC2x, %SlotC2x%
	Gui, 2:Add, Edit, x156 y230 w40 h20 vSlotC2y, %SlotC2y%
	Gui, 2:Add, Edit, x206 y230 w120 h20 vSlotC2Key, %SlotC2Key%
	Gui, 2:Add, Text, x8 y252 w240 h20 , Slot 11
	Gui, 2:Add, Edit, x106 y250 w40 h20 vSlotC3x, %SlotC3x%
	Gui, 2:Add, Edit, x156 y250 w40 h20 vSlotC3y, %SlotC3y%
	Gui, 2:Add, Edit, x206 y250 w120 h20 vSlotC3Key, %SlotC3Key%
	Gui, 2:Add, Text, x8 y272 w240 h20 , Slot 12
	Gui, 2:Add, Edit, x106 y270 w40 h20 vSlotC4x, %SlotC4x%
	Gui, 2:Add, Edit, x156 y270 w40 h20 vSlotC4y, %SlotC4y%
	Gui, 2:Add, Edit, x206 y270 w120 h20 vSlotC4Key, %SlotC4Key%
	Gui, 2:Add, Text, x8 y302 w180 h20 , Reset Session Time
	Gui, 2:Add, Edit, x206 y300 w120 h20 vReset, %Reset%
	Gui, 2:Add, Text, x8 y322 w180 h20 , Increase Session Time By 1
	Gui, 2:Add, Edit, x206 y320 w120 h20 vIncrease, %Increase%
	Gui, 2:Add, Text, x8 y342 w180 h20 , Close
	Gui, 2:Add, Edit, x206 y340 w120 h20 vClose, %Close%
	Gui, 2:Font, s8 cFF0000 Norm
	Gui, 2:Add, Text, x18 y380 w300 h20 , You can find a list of modifier symbols to define hotkeys under:
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x62 y410 w300 h20 , Help > AutoHotkey Help > Hotkeys
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Button, x118 y465 w40 h20 gSave,Save
	Gui, 2:Add, Button, x163 y465 w50 h20 gCancel,Cancel
	Gui, 2:Font, s8 cFF0000 Bold
	Gui, 2:Add, Text, x84 y491 w220 h20 , Note: Saving Restarts Script
;--------------------------------------------------------------------------------------------------------------------------------
	Gui, 2:Tab, Types           
	Gui, 2:Font, s8 cDefault Bold
	Gui, 2:Add, Text, x8 y32 w240 h20 , Game Types Description: 
	Gui, 2:Font, s8 cDefault Norm
	Gui, 2:Add, Text, x8 y60 w400 h20 , Game Types refer %A_Space%to %A_Space%the term %A_Space%inside %A_Space%the square brackets %A_Space%in %A_Space%the
	Gui, 2:Add, Text, x8 y77 w400 h20 , target windows' %A_Space%titles. For 9max regular speed games, whose titles
	Gui, 2:Add, Text, x8 y94 w400 h20 , lack such a term, %A_Space% just type "9-Max", and for 9max turbos just type  
	Gui, 2:Add, Text, x8 y111 w400 h20, "Turbo". The following definitions group games as described:    
	Gui, 2:Font, s8 cDefault Bold     
	Gui, 2:Add, Text, x8 y145 w400 h20, HU 
	Gui, 2:Add, Text, x8 y162 w400 h20, HUSTT    
	Gui, 2:Add, Text, x8 y179 w400 h20, 6-Max    
	Gui, 2:Add, Text, x8 y196 w400 h20, 9-Max, Turbo 
	Gui, 2:Add, Text, x8 y213 w400 h20, 18    
	Gui, 2:Add, Text, x8 y230 w400 h20, 45   
	Gui, 2:Add, Text, x8 y247 w400 h20, 180       
	Gui, 2:Add, Text, x8 y264 w400 h20, 180 Players, Turbo      
	Gui, 2:Add, Text, x8 y281 w400 h20, Gtd      
	Gui, 2:Add, Text, x8 y298 w400 h20, Cash      
	Gui, 2:Add, Text, x8 y315 w400 h20, NoType    
	Gui, 2:Font, s8 cDefault Norm     
	Gui, 2:Add, Text, x130 y145 w400 h20, - any HU SNG, including MTSNG
	Gui, 2:Add, Text, x130 y162 w400 h20, - any HU STT
	Gui, 2:Add, Text, x130 y179 w400 h20, - any 6-handed STT     
	Gui, 2:Add, Text, x130 y196 w400 h20, - any 9-handed Turbo STT, incl. KO's    
	Gui, 2:Add, Text, x130 y213 w400 h20, - any 9-handed 18man SNG      
	Gui, 2:Add, Text, x130 y230 w400 h20, - any 45 player SNG      
	Gui, 2:Add, Text, x130 y247 w400 h20, - any 180 player SNG    
	Gui, 2:Add, Text, x130 y264 w400 h20, - any 180 player Turbo SNG  
	Gui, 2:Add, Text, x130 y281 w400 h20, - any Gtd MTT regardless of stake
	Gui, 2:Add, Text, x130 y298 w100 h20, - cash games    
	Gui, 2:Font, s8 cFF0000 Norm     
	Gui, 2:Add, Text, x196 y298 w200 h20, (don't use for SNG/MTT)   
	Gui, 2:Font, s8 cDefault Norm     
	Gui, 2:Add, Text, x130 y315 w400 h20, - disregards game type (see below)
	Gui, 2:Add, Text, x8 y349 w400 h20, To avoid accidental groupings, make sure to define the whole term
	Gui, 2:Add, Text, x8 y366 w400 h20, inside the brackets. For examle, don't just type %A_Space%"18 Players" %A_Space%if you 
	Gui, 2:Add, Text, x8 y383 w400 h20, want to define 18man Turbos; Instead, type "18 Players, Turbo".  
	Gui, 2:Add, Text, x8 y417 w400 h20, When using the "NoType" definition, only tables whose titles begin
	Gui, 2:Add, Text, x8 y434 w400 h20, with your stake definition will be considered. %A_Space%The Bigger $5.50, for 
	Gui, 2:Add, Text, x8 y451 w400 h20, instance, will not be considered if you define the stake as "$5.50".
return                          
;================================================================================================================================ 	
;================================================== GUI MENU HANDLERS =========================================================== 	;|
SettingsHelp:                  
	IfWinExist AutoHotkey Help  
		WinActivate             
	else                        
		{                       
		RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
		Run %ahkInstallDir%\AutoHotKey.chm
		}                       
return                          
;================================================================================================================================
SettingsSpy:                
	RegRead ahkInstallDir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
	Run %ahkInstallDir%\AU3_Spy.exe
return                          
;================================================================================================================================
SettingsColors:             
	Gui, 3:Font, s9 c000000     
	Gui, 3:Add, Text, x10 y8 w180 h20, Can't access browser. Please visit:
	Gui, 3:Add, Edit, x20 y30 w142 h20 vMyEdit, http://html-color-codes.info/
	Gui, 3:Add, Button, x65 y60 w50 h20 gCancel,Cancel
	Gui, 3:-SysMenu             
	Gui, 3:Show, h90 w185, SessionMan - Error 
return                          
;================================================================================================================================
Save:                           
	IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x, 4
	IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y, 4
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log, false 
	Gui, Submit                 
	FileDelete, %A_ScriptDir%\SessionMan.ini
	Gosub CheckIni              
	Gosub UpdateIni             
	Reload                      
return                          
;================================================================================================================================
Cancel:                         
	Gui, Destroy                
Return        
;================================================================================================================================
GuiClose:                       
	Gosub, UpdateLog            
	ExitApp                     
return	                  
;================================================================================================================================ 	
;=================================================== GENERAL LABELS ============================================================= 	;|
Stakes: 																															;|
	num = 0 
	Loop, 9
		{
		num += 1
		r := c%num%                     
		t := t%num%  
		Stake := Stake%num%
		Type := Type%num%           
		Counter = Counter%num%         
		Gosub Counter               
		c%num% := c                     
		t%num% := t
		}       
return	                     
;================================================================================================================================
Counter:																													   		;|
	If Type = 18                
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [18 Players`, Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [18 Players] ahk_class PokerStarsTableFrameClass
		}                       
	else, if Type = HUSTT       
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [HU`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [HU`, Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v3, count, %Stake% NL Hold'em [HU`, Hyper-Turbo`, 2 Players] ahk_class PokerStarsTableFrameClass
		WinGet, v4, count, %Stake% NL Hold'em [HU`, Deep`, No Blind Increases] ahk_class PokerStarsTableFrameClass
		}                       
	else, if InStr(Type, "9-Max, Turbo",0)
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [Turbo] ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em [Turbo`, Knockout] ahk_class PokerStarsTableFrameClass
		}                       
	else, if InStr(Type, "9-Max",0)
		{                       
		WinGet, v1, count, %Stake% NL Hold'em - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v2, count, %Stake% NL Hold'em  - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v3, count, %Stake% NL Hold'em   - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v4, count, %Stake% NL Hold'em    - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v5, count, %Stake% NL Hold'em     - Blinds ahk_class PokerStarsTableFrameClass
		WinGet, v6, count, %Stake% NL Hold'em      - Blinds ahk_class PokerStarsTableFrameClass
		}                       
	else, if Type = Gtd         
		{                       
		SetTitleMatchMode, 2    
		WinGet, v1, count, Gtd ahk_class PokerStarsTableFrameClass
		SetTitleMatchMode, 1    
		}                       
	else, if Type = Cash        
		{                       
		SetTitleMatchMode, 2    
		WinGet, v1, count, %Stake% ahk_class PokerStarsTableFrameClass
		SetTitleMatchMode, 1    
		}                       
	else, if Type = NoType      
		{                       
		WinGet, v1, count, %Stake% ahk_class PokerStarsTableFrameClass
		}                       
	else                        
		{                       
		WinGet, v1, count, %Stake% NL Hold'em [%Type% ahk_class PokerStarsTableFrameClass
		}                       
	Tables := v1 + v2 + v3 + v4 + v5 + v6
	c = 0                       
	Loop, %Tables%              
		{	                    
		c += 1                  
		}                       
	If (c != c%Counter%last)    
		{                       
		If (t = 0)              
			{	                
			GuiControl,, %Counter%, 0
			r = 0               
			}                   
		If (t < c)              
			{                   
			t := c - 1          
			}                   
		If (c > r)              
			{                   
			t += 1              
			GuiControl,, %Counter%, %c% / %t%
			r := c              
			}                   
		else, if (c < r)        
			{                   
			GuiControl,, %Counter%, %c% / %t%
			r := c              
			}                   
		c%Counter%last := c	    
		}	                    
	v1 = 0                      
	v2 = 0                      
	v3 = 0                      
	v4 = 0                      
	v5 = 0                      
	v6 = 0  
return                             
;================================================================================================================================
Buyin:																															   	;|
	CurrentInvest:=0.00         
	CurrentInvest_TournamentCounter:=0
	Buyin_Euro:=0.00            
	Buyin_Euro_TournamentCounter:=0
	Buyin_Session:=0.00	        
	Buyin_Session_TournamentCounter:=0		
	Winget,Ps_Hwnd_list,List,Ahk_Class PokerStarsTableFrameClass
	Loop %Ps_Hwnd_List%         
		{                       
		Hwnd:=Ps_Hwnd_List%A_index%
		IF  !(Buyin_%hwnd%)     
			{                   
			WingetTitle,Title,Ahk_id%Hwnd%
			IF Instr(Title,"Tournament")
				{               
				IF Buyin_%Hwnd%:=GetBuyin(Title,Buyin_%Hwnd%_Currency)
					{           
					BuyIn_hwnd_list:=BuyIn_hwnd_list ? BuyIn_hwnd_list "," Hwnd : Hwnd
					TotalInvest:=Round(TotalInvest+Buyin_%Hwnd%,2)
						TotalInvest_TournamentCounter+=1
					}           
				}               
			}			        
		}	                    
	Loop,Parse,Buyin_Hwnd_List,`,,
		{                       
		Hwnd:=A_LoopField       
		If WinExist("ahk_id" Hwnd)
			{                   
			Currency:=Buyin_%hwnd%_Currency	
			Buyin:=Round(Buyin_%hwnd%,2)
			If (Currency="$")   
				{	            
				CurrentInvest:=Round(CurrentInvest+Buyin,2)
				CurrentInvest_TournamentCounter+=1
				}               
			else, if (Currency="€")
				{		        
				Buyin_Euro:=Round(Buyin_Euro+Buyin,2)
				Buyin_Euro_TournamentCounter+=1
				}		        
			Buyin_Session:=Round(Buyin_Session+Buyin,2)
			Buyin_Session_TournamentCounter+=1
			}                   
		else                    
			{                   
			Temp_list:="," Buyin_Hwnd_List "," 
			StringReplace,Temp_list,Temp_list,`,Hwnd`,,,    
			StringTrimLeft,Temp_list,Temp_list,1
			StringTrimRight,Buyin_Hwnd_List,Temp_list,1       
			}                   
		}		                
	If (CurrentInvest_Save != CurrentInvest) Or (BuyIn_Euro_Save != BuyIn_Euro) 
		{                       
		BuyIn_Euro_Save:=BuyIn_Euro	
		BuyIn_Euro_Avg:= Round(BuyIn_Euro/BuyIn_Euro_TournamentCounter,2)		
		CurrentInvest_Save:=CurrentInvest
		CurrentABI:=Round(CurrentInvest/CurrentInvest_TournamentCounter,2)
		BuyIn_Session_Avg:=Round(BuyIn_Session/BuyIn_Session_TournamentCounter,2)
		TotalABI:=Round(TotalInvest/TotalInvest_TournamentCounter,2)
		IfInString, CurrentABI, .00
			StringReplace, CurrentABI, CurrentABI, .00,	
		IfInString, CurrentInvest, .00
			StringReplace, CurrentInvest, CurrentInvest, .00,		
		IfInString, TotalABI, .00
			StringReplace, TotalABI, TotalABI, .00,		
		IfInString, TotalInvest, .00
			StringReplace, TotalInvest, TotalInvest, .00,	
		GuiControl,,AvgBI,% "$" CurrentABI " / $" TotalABI ""
		GuiControl,,Investment,% "$" CurrentInvest " / $" TotalInvest ""
		}                       
	If (TotalABI = 0)    
		{                       
		Gui, Font, s11 c%NumColor%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}                       
	else, if (TotalABI > MaxABI) or (TotalABI < MinABI) and (WarnBox = 1)
		{                       
		Gui, Font, s11 c%NumColorWarn%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}                       
	else, if (TotalABI <= MaxABI) and (TotalABI >= MinABI) and (GoalBox = 1)
		{                       
		Gui, Font, s11 c%NumColorGoal%
		Gui, Font, Norm         
		GuiControl, Font, AvgBI
		}	                    
	If (TotalInvest > MaxInvest) and (WarnBox = 1)
		{                       
		Gui, Font, s11 c%NumColorWarn%
		Gui, Font, Norm         
		GuiControl, Font, Investment
		}                       
	else                        
		{                       
		Gui, Font, s11 c%NumColor%
		Gui, Font, Norm         
		GuiControl, Font, Investment
		}	                    
	GetBuyin(Title,byref currency="",Byref BuyinText="")
		{     
		Global RebuyMulti
		Static CurrencyList:="$,€"
		Haystack:=Substr(Title, Instr(Title,"Sat:")+1) 
		Loop,Parse,Currencylist,`,
			{                   
			If ((StartPosBuyin := Instr(Haystack,A_loopField)) And (EndPosBuyin := Instr(Haystack,A_space,"",StartPosBuyin)))
				{               
				BuyinText:=Substr(Haystack,StartPosBuyin ,(EndPosBuyin - StartPosBuyin))
				Currency=%A_loopField%
				Buyin:=BuyinText
				StringReplace,Buyin,Buyin,%Currency%,, 
				IfInString, Buyin, +R
					{	        
					StringReplace,Buyin,Buyin,+R,, 
					Buyin := Buyin * RebuyMulti					
					}            
				If Buyin is not number
					{           
					Buyin:=0    
					currency:=  
					buyinText:=    
					}           
				Break           
				}               
			}                   
		Return Buyin            
		} 
	Gosub Points	
return
;================================================================================================================================
Points:																																;|
	VPP1 := t1 * Stake1VPP      															
	VPP2 := t2 * Stake2VPP      
	VPP3 := t3 * Stake3VPP      
	VPP4 := t4 * Stake4VPP      
	VPP5 := t5 * Stake5VPP      
	VPP6 := t6 * Stake6VPP      
	VPP7 := t7 * Stake7VPP      
	VPP8 := t8 * Stake8VPP      
	VPP9 := t9 * Stake9VPP	    
	VPP := Round(VPP1+VPP2+VPP3+VPP4+VPP5+VPP6+VPP7+VPP8+VPP9,2)	
	FPP := VPP * VIPMulti	
	Rake := Round(VPP/5.5, 2)
	If RakeBox = 1
		RB := Round(Rake*Rakeback/100, 2) 
	else
		RB := Round(FPP*Value, 2)  
	IfInString, Rake, .00        
		StringReplace, Rake, Rake, .00,                      
	IfInString, RB, .00        
		StringReplace, RB, RB, .00, 
	If (VPP >= VPPGoal) and (GoalBox = 1)
		{                       
		Gui, Font, s10 c%NumColorGoal%
		GuiControl, Font, VPP   
		}	                    
	If VPP >= 10000             
		{                       
		VK = k                  
		VPP := Round(VPP/1000,5)
		StringTrimRight, VPP, VPP, 4
		IfInString, VPP, .0     
			StringReplace, VPP, VPP, .0,
		}                       
	else, if VPP >= 1000        
		{                       
		VK = k                  
		VPP := Round(VPP/1000,5)
		StringTrimRight, VPP, VPP, 3
		}	                    
	IfInString, VPP, .00        
		StringReplace, VPP, VPP, .00,		
	Loop, 9                     
		{                       
		N += 1                  
		IfInString, VPP, .%N%0  
			{                   
			StringTrimRight, VPP, VPP, 1
			break               
			}	                
		}		                
	N = 0                       
    GuiControl,, VPP, %VPP%%VK% 
;--------------------------------------------------------------------------------------------------------------------------------
	FPP := Round(FPP,2)	        
	If FPP >= 10000             
		{                       
		FK = k                  
		FPP := Round(FPP/1000,5)
		StringTrimRight, FPP, FPP, 4
		IfInString, FPP, .0     
			StringReplace, FPP, FPP, .0,
		}                       
	else, if FPP >= 1000        
		{                       
		FK = k                  
		FPP := Round(FPP/1000,5)
		StringTrimRight, FPP, FPP, 3
		}	                    
	IfInString, FPP, .00        
		StringReplace, FPP, FPP, .00,				
	Loop, 9                     
		{                       
		N += 1                  
		IfInString, FPP, .%N%0  
			{                   
			StringTrimRight, FPP, FPP, 1
			break               
			}	                
		}		                
	N = 0                       
    GuiControl,, FPP, %FPP%%FK%                
    GuiControl,, Rake, $%Rake%              
    GuiControl,, Rakeback, $%RB%
return	                        
;================================================================================================================================ 
Timers:  																													   		;|
	FormatTime, Time, %A_Now%, H:mm
	GuiControl,, Clock, %Time%  
	StringTrimLeft, TimeOnly, A_Now, 10
	StringTrimRight, Minutes, TimeOnly, 2
	If BreakBox = 1             
		{                       
		IfGreaterOrEqual, Minutes, 55
			{                   
			Gui, Font, s20 c%ClockColorBreak%
			Gui, Font, Bold     
			GuiControl, Font, Clock
			}                   
		else                    
			{                   
			Gui, Font, s20 c%NumColor%
			Gui, Font, Bold     
			GuiControl, Font, Clock
			}                   
		}                       
	else                        
		{                       
		Gui, Font, s20 c%NumColor%
		Gui, Font, Bold         
		GuiControl, Font, Clock 
		}                       
;--------------------------------------------------------------------------------------------------------------------------------
	IfWinExist, ahk_class PokerStarsTableFrameClass
		{  
		If (Minutes != Var)         
			{                       
			M2 += 1                 
			Var := Minutes          
			}                       
		If (M2 > 9)                 
			{                       
			M1 += 1                 
			M2 = 0                  
			}                       
		If (M1 > 5)                 
			{                       
			H2 += 1                 
			M1 = 0                  
			M2 = 0                  
			}                       
		If (H2 > 9)                 
			{                       
			H1 += 1                 
			H2 = 0                  
			M1 = 0                  
			M2 = 0                  
			}	                    
		Runtime = %H1%%H2%:%M1%%M2% 
		If (Runtime >= SessionTimeGoal) and (GoalBox = 1)
			{                       
			Gui, Font, s14 c%NumColorGoal%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			} 
		else
		    {          
			Gui, Font, s14 c%NumColor%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			}
		If (H1 = 0)                 
			GuiControl,, SessionTime, %H2%:%M1%%M2%
		else, GuiControl,, SessionTime, %H1%%H2%:%M1%%M2%
		} 
	else
		{
		If (H1 = 0)                 
			GuiControl,, SessionTime, %H2%:%M1%%M2%
		If (M2 = -1)    
			{
			Gui, Font, s14 c%NumColor%
			Gui, Font, Norm           
			GuiControl, Font, SessionTime 
			GuiControl,, SessionTime, -
			}
		else
			{
			Gui, Font, s14 c%NumColorWarn%
			Gui, Font, Norm         
			GuiControl, Font, SessionTime
			}
		}
;--------------------------------------------------------------------------------------------------------------------------------
	S := ((H1 * 600) + (H2 * 60) + (M1 * 10) + M2) / 60
	S := Round(S,6)             
	Games := (t0 - c0) / S      
	Games := Round(Games,1)     
	IfInString, Games, .0       
		StringReplace, Games, Games, .0,
	If (Games = 0)              
		Games = -               
	GuiControl,, Games, %Games% 
return	
;================================================================================================================================
CheckLog:																													   		;|
	IfNotExist, %A_ScriptDir%\SessionMan.log.ini
		IniWrite, 0 (logging disabled), %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = true           
		{                       
		IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		IniRead, GamesLogged, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		If GamesLogged != 0 Game(s)
			{                   
			SessionCount += 1   
			IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		IniWrite, %Start%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Start
		IniWrite, still running, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
		IniWrite, n/a, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
		IniWrite, 0 Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		Menu Tray, Check, Enable Logging
		}                       
return                          
;================================================================================================================================
UpdateLog:																													   		;|
	IniRead, Logging, %A_ScriptDir%\SessionMan.ini, Logging, Log 
	If Logging = true           
		{                       
		IniRead, SessionCount, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged
		IniWrite, %SessionCount%, %A_ScriptDir%\SessionMan.log.ini, Sessions, Logged                    
		FormatTime, Finish, %A_Now%, ddd d.M.yyyy H:mm:ss
		IniWrite, %Finish%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Finish
		IniWrite, %H1%%H2%:%M1%%M2%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Time
		Completed := t0 - c0    
		IniWrite, %t0% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Total
		IniWrite, %Completed% Game(s), %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Completed
		If Completed != 0       
			{                   
			If (H = 0) and (M1 = 0) and (M2 = 0)
				Games := Completed
			IniWrite, %Games%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Games/h
			IniWrite, $%TotalABI%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, ABI
			IniWrite, $%TotalInvest%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Invested
			IniWrite, %VPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, VPP
			IniWrite, %FPP%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, FPP
			IniWrite, $%Rake%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Rake
			IniWrite, $%RB%, %A_ScriptDir%\SessionMan.log.ini, Session %SessionCount%, Rakeback
			FileAppend, `n, %A_ScriptDir%\SessionMan.log.ini
			}                   
		}                       
return         
;================================================================================================================================
CheckIni:																													   		;|
	IfNotExist, %A_ScriptDir%\SessionMan.ini
		{                       
		IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, x
		IniWrite, 4, %A_ScriptDir%\SessionMan.ini, GuiPos, y
		FileAppend, `n, %A_ScriptDir%\SessionMan.ini
		IniWrite, false, %A_ScriptDir%\SessionMan.ini, Logging, Log
		}                       
return	                                         
;================================================================================================================================
UpdateIni:																													   		;|
	IniWrite, %Build%, %A_ScriptDir%\SessionMan.ini, Version, Version
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	IniWrite, %xpos%, %A_ScriptDir%\SessionMan.ini, GuiPos, x
	IniWrite, %ypos%, %A_ScriptDir%\SessionMan.ini, GuiPos, y
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	IniWrite, %Logging%, %A_ScriptDir%\SessionMan.ini, Logging, Log
	If LCaption                  
		IniWrite, %LCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, LCaption
	If MCaption                  
		IniWrite, %MCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, MCaption
	If RCaption                  
		IniWrite, %RCaption%, %A_ScriptDir%\SessionMan.ini, Stakes, RCaption
	If Stake1                   
		IniWrite, %Stake1%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1
	If Stake2                   
		IniWrite, %Stake2%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2
	If Stake3                   
		IniWrite, %Stake3%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3
	If Stake4                   
		IniWrite, %Stake4%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4
	If Stake5                   
		IniWrite, %Stake5%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5
	If Stake6                   
		IniWrite, %Stake6%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6
	If Stake7                   
		IniWrite, %Stake7%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7
	If Stake8                   
		IniWrite, %Stake8%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8
	If Stake9                   
		IniWrite, %Stake9%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9
	If Type1                    
		IniWrite, %Type1%, %A_ScriptDir%\SessionMan.ini, Stakes, Type1
	If Type2                    
		IniWrite, %Type2%, %A_ScriptDir%\SessionMan.ini, Stakes, Type2
	If Type3                    
		IniWrite, %Type3%, %A_ScriptDir%\SessionMan.ini, Stakes, Type3
	If Type4                    
		IniWrite, %Type4%, %A_ScriptDir%\SessionMan.ini, Stakes, Type4
	If Type5                    
		IniWrite, %Type5%, %A_ScriptDir%\SessionMan.ini, Stakes, Type5
	If Type6                    
		IniWrite, %Type6%, %A_ScriptDir%\SessionMan.ini, Stakes, Type6
	If Type7                    
		IniWrite, %Type7%, %A_ScriptDir%\SessionMan.ini, Stakes, Type7
	If Type8                    
		IniWrite, %Type8%, %A_ScriptDir%\SessionMan.ini, Stakes, Type8
	If Type9                    
		IniWrite, %Type9%, %A_ScriptDir%\SessionMan.ini, Stakes, Type9
	If Stake1VPP                
		IniWrite, %Stake1VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP
	If Stake2VPP                
		IniWrite, %Stake2VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP
	If Stake3VPP                
		IniWrite, %Stake3VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP
	If Stake4VPP                
		IniWrite, %Stake4VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP
	If Stake5VPP                
		IniWrite, %Stake5VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP
	If Stake6VPP                
		IniWrite, %Stake6VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP
	If Stake7VPP                
		IniWrite, %Stake7VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP
	If Stake8VPP                
		IniWrite, %Stake8VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP
	If Stake9VPP                
		IniWrite, %Stake9VPP%, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP
	If ColorsBox                
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox
	If Color1                   
		IniWrite, %Color1%, %A_ScriptDir%\SessionMan.ini, Stakes, Color1
	If Color2                   
		IniWrite, %Color2%, %A_ScriptDir%\SessionMan.ini, Stakes, Color2
	If Color3                   
		IniWrite, %Color3%, %A_ScriptDir%\SessionMan.ini, Stakes, Color3
	If Color4                   
		IniWrite, %Color4%, %A_ScriptDir%\SessionMan.ini, Stakes, Color4
	If Color5                   
		IniWrite, %Color5%, %A_ScriptDir%\SessionMan.ini, Stakes, Color5
	If Color6                   
		IniWrite, %Color6%, %A_ScriptDir%\SessionMan.ini, Stakes, Color6
	If Color7                   
		IniWrite, %Color7%, %A_ScriptDir%\SessionMan.ini, Stakes, Color7
	If Color8                   
		IniWrite, %Color8%, %A_ScriptDir%\SessionMan.ini, Stakes, Color8
	If Color9                   
		IniWrite, %Color9%, %A_ScriptDir%\SessionMan.ini, Stakes, Color9
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If GUIColor                 
		IniWrite, %GUIColor%, %A_ScriptDir%\SessionMan.ini, Options, GUIColor
	If NumColor                 
		IniWrite, %NumColor%, %A_ScriptDir%\SessionMan.ini, Options, NumColor
	If TextColor                
		IniWrite, %TextColor%, %A_ScriptDir%\SessionMan.ini, Options, TextColor
	If SeparatorColor           
		IniWrite, %SeparatorColor%, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor
	If GoalBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, GoalBox
	If NumColorGoal             
		IniWrite, %NumColorGoal%, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal
	If WarnBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, WarnBox
	If NumColorWarn             
		IniWrite, %NumColorWarn%, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn
	If BreakBox                 
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BreakBox
	If ClockColorBreak          
		IniWrite, %ClockColorBreak%, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak
	If MinMTRatio               
		IniWrite, %MinMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio
	If MaxMTRatio               
		IniWrite, %MaxMTRatio%, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio
	If TotalLimit               
		IniWrite, %TotalLimit%, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit
	If SessionTimeGoal          
		IniWrite, %SessionTimeGoal%, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal
	If MinABI                   
		IniWrite, %MinABI%, %A_ScriptDir%\SessionMan.ini, Options, MinABI
	If MaxABI                   
		IniWrite, %MaxABI%, %A_ScriptDir%\SessionMan.ini, Options, MaxABI
	If MaxInvest                
		IniWrite, %MaxInvest%, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest
	If RebuyMulti                 
		IniWrite, %RebuyMulti%, %A_ScriptDir%\SessionMan.ini, Options, RebuyMulti
	If VPPGoal                  
		IniWrite, %VPPGoal%, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal
	If SilverBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, SilverBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, SilverBox
	If GoldBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, GoldBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, GoldBox
	If PlatinBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, PlatinBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, PlatinBox
	If SNBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, SNBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, SNBox
	If SNEBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, SNEBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, SNEBox
	If RakeBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, RakeBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, RakeBox
	If Rakeback
		IniWrite, %Rakeback%, %A_ScriptDir%\SessionMan.ini, Options, Rakeback
	If BustBox                  
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, BustBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, BustBox
	If SoundBust                
		IniWrite, %SoundBust%, %A_ScriptDir%\SessionMan.ini, Options, SoundBust
	If AchieveBox               
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox
	If SoundAchieve             
		IniWrite, %SoundAchieve%, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve
	If IntervalBox              
			IniWrite, 1, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
	else, 	IniWrite, 0, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox
	If SoundInterval            
		IniWrite, %SoundInterval%, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If SlotA1x                  
		IniWrite, %SlotA1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x
	If SlotA2x                  
		IniWrite, %SlotA2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x
	If SlotA3x                  
		IniWrite, %SlotA3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x
	If SlotA4x                  
		IniWrite, %SlotA4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x
	If SlotB1x                  
		IniWrite, %SlotB1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x
	If SlotB2x                  
		IniWrite, %SlotB2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x
	If SlotB3x                  
		IniWrite, %SlotB3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x
	If SlotB4x                  
		IniWrite, %SlotB4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x
	If SlotC1x                  
		IniWrite, %SlotC1x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x
	If SlotC2x                  
		IniWrite, %SlotC2x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x
	If SlotC3x                  
		IniWrite, %SlotC3x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x
	If SlotC4x                  
		IniWrite, %SlotC4x%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x
	If SlotA1y                  
		IniWrite, %SlotA1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y
	If SlotA2y                  
		IniWrite, %SlotA2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y
	If SlotA3y                  
		IniWrite, %SlotA3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y
	If SlotA4y                  
		IniWrite, %SlotA4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y
	If SlotB1y                  
		IniWrite, %SlotB1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y
	If SlotB2y                  
		IniWrite, %SlotB2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y
	If SlotB3y                  
		IniWrite, %SlotB3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y
	If SlotB4y                  
		IniWrite, %SlotB4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y
	If SlotC1y                  
		IniWrite, %SlotC1y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y
	If SlotC2y                  
		IniWrite, %SlotC2y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y
	If SlotC3y                  
		IniWrite, %SlotC3y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y
	If SlotC4y                  
		IniWrite, %SlotC4y%, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y
	FileAppend, `n, %A_ScriptDir%\SessionMan.ini
	If SlotA1Key                
		IniWrite, %SlotA1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key
	If SlotA2Key                
		IniWrite, %SlotA2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key
	If SlotA3Key                
		IniWrite, %SlotA3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key
	If SlotA4Key                
		IniWrite, %SlotA4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key
	If SlotB1Key                
		IniWrite, %SlotB1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key
	If SlotB2Key                
		IniWrite, %SlotB2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key
	If SlotB3Key                
		IniWrite, %SlotB3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key
	If SlotB4Key                
		IniWrite, %SlotB4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key
	If SlotC1Key                
		IniWrite, %SlotC1Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key
	If SlotC2Key                
		IniWrite, %SlotC2Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key
	If SlotC3Key                
		IniWrite, %SlotC3Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key
	If SlotC4Key                
		IniWrite, %SlotC4Key%, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key
	If Reset                    
		IniWrite, %Reset%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset
	If Increase                 
		IniWrite, %Increase%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase
	If Close                    
		IniWrite, %Close%, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close	
return                          
;================================================================================================================================
ReadIni:																													   		;|
	IniRead, xpos, %A_ScriptDir%\SessionMan.ini, GuiPos, x
	IniRead, ypos, %A_ScriptDir%\SessionMan.ini, GuiPos, y	
	IniRead, LCaption, %A_ScriptDir%\SessionMan.ini, Stakes, LCaption, 180s
	IniRead, MCaption, %A_ScriptDir%\SessionMan.ini, Stakes, MCaption, 45s
	IniRead, RCaption, %A_ScriptDir%\SessionMan.ini, Stakes, RCaption, 18s
	IniRead, Stake1, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1, $3.50+R
	IniRead, Stake2, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2, $8.00
	IniRead, Stake3, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3, $15.00
	IniRead, Stake4, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4, $3.50
	IniRead, Stake5, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5, $7.00
	IniRead, Stake6, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6, $15.00
	IniRead, Stake7, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7, $3.50
	IniRead, Stake8, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8, $7.00
	IniRead, Stake9, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9, $15.00
	IniRead, Type1, %A_ScriptDir%\SessionMan.ini, Stakes, Type1, 180
	IniRead, Type2, %A_ScriptDir%\SessionMan.ini, Stakes, Type2, 180
	IniRead, Type3, %A_ScriptDir%\SessionMan.ini, Stakes, Type3, 180
	IniRead, Type4, %A_ScriptDir%\SessionMan.ini, Stakes, Type4, 45
	IniRead, Type5, %A_ScriptDir%\SessionMan.ini, Stakes, Type5, 45
	IniRead, Type6, %A_ScriptDir%\SessionMan.ini, Stakes, Type6, 45
	IniRead, Type7, %A_ScriptDir%\SessionMan.ini, Stakes, Type7, 18
	IniRead, Type8, %A_ScriptDir%\SessionMan.ini, Stakes, Type8, 18
	IniRead, Type9, %A_ScriptDir%\SessionMan.ini, Stakes, Type9, 18
	IniRead, Stake1VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake1VPP, 1.71					 
	IniRead, Stake2VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake2VPP, 3.63													
	IniRead, Stake3VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake3VPP, 6.77												
	IniRead, Stake4VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake4VPP, 1.71											 
	IniRead, Stake5VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake5VPP, 3.19					 
	IniRead, Stake6VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake6VPP, 6.71													
	IniRead, Stake7VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake7VPP, 1.87												
	IniRead, Stake8VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake8VPP, 3.03											 
	IniRead, Stake9VPP, %A_ScriptDir%\SessionMan.ini, Stakes, Stake9VPP, 6.11			
	IniRead, Color1, %A_ScriptDir%\SessionMan.ini, Stakes, Color1, ff0000
	IniRead, Color2, %A_ScriptDir%\SessionMan.ini, Stakes, Color2, ff5500
	IniRead, Color3, %A_ScriptDir%\SessionMan.ini, Stakes, Color3, ffaa00
	IniRead, Color4, %A_ScriptDir%\SessionMan.ini, Stakes, Color4, 00ff55
	IniRead, Color5, %A_ScriptDir%\SessionMan.ini, Stakes, Color5, 005555
	IniRead, Color6, %A_ScriptDir%\SessionMan.ini, Stakes, Color6, 00aaaa
	IniRead, Color7, %A_ScriptDir%\SessionMan.ini, Stakes, Color7, 0033ff
	IniRead, Color8, %A_ScriptDir%\SessionMan.ini, Stakes, Color8, 5555ff
	IniRead, Color9, %A_ScriptDir%\SessionMan.ini, Stakes, Color9, aa55ff 
	IniRead, ColorsBox, %A_ScriptDir%\SessionMan.ini, Stakes, ColorsBox, 0
	IniRead, GUIColor, %A_ScriptDir%\SessionMan.ini, Options, GUIColor, 383838
	IniRead, NumColor, %A_ScriptDir%\SessionMan.ini, Options, NumColor, 999999
	IniRead, TextColor, %A_ScriptDir%\SessionMan.ini, Options, TextColor, Black
	IniRead, SeparatorColor, %A_ScriptDir%\SessionMan.ini, Options, SeparatorColor, 282828
	IniRead, GoalBox, %A_ScriptDir%\SessionMan.ini, Options, GoalBox, 1 
	IniRead, NumColorGoal, %A_ScriptDir%\SessionMan.ini, Options, NumColorGoal, 33ff33
	IniRead, WarnBox, %A_ScriptDir%\SessionMan.ini, Options, WarnBox, 1 
	IniRead, NumColorWarn, %A_ScriptDir%\SessionMan.ini, Options, NumColorWarn, Red
	IniRead, BreakBox, %A_ScriptDir%\SessionMan.ini, Options, BreakBox, 1
	IniRead, ClockColorBreak, %A_ScriptDir%\SessionMan.ini, Options, ClockColorBreak, Red
	IniRead, MinMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MinMTRatio, 16
	IniRead, MaxMTRatio, %A_ScriptDir%\SessionMan.ini, Options, MaxMTRatio, 20
	IniRead, TotalLimit, %A_ScriptDir%\SessionMan.ini, Options, TotalLimit, 150
	IniRead, SessionTimeGoal, %A_ScriptDir%\SessionMan.ini, Options, SessionTimeGoal, 06:00
	IniRead, MinABI, %A_ScriptDir%\SessionMan.ini, Options, MinABI, 5
	IniRead, MaxABI, %A_ScriptDir%\SessionMan.ini, Options, MaxABI, 7
	IniRead, MaxInvest, %A_ScriptDir%\SessionMan.ini, Options, MaxInvest, 1000
	IniRead, RebuyMulti, %A_ScriptDir%\SessionMan.ini, Options, RebuyMulti, 3
	IniRead, VPPGoal, %A_ScriptDir%\SessionMan.ini, Options, VPPGoal, 375
	IniRead, SilverBox, %A_ScriptDir%\SessionMan.ini, Options, SilverBox, 0
	IniRead, GoldBox, %A_ScriptDir%\SessionMan.ini, Options, GoldBox, 1
	IniRead, PlatinBox, %A_ScriptDir%\SessionMan.ini, Options, PlatinBox, 0
	IniRead, SNBox, %A_ScriptDir%\SessionMan.ini, Options, SNBox, 0
	IniRead, SNEBox, %A_ScriptDir%\SessionMan.ini, Options, SNEBox, 0
	IniRead, RakeBox, %A_ScriptDir%\SessionMan.ini, Options, RakeBox, 0
	IniRead, Rakeback, %A_ScriptDir%\SessionMan.ini, Options, Rakeback, 17.6
	IniRead, BustBox, %A_ScriptDir%\SessionMan.ini, Options, BustBox, 0
	IniRead, SoundBust, %A_ScriptDir%\SessionMan.ini, Options, SoundBust, C:\Program Files (x86)\PokerStars\snd\bust.wav
	IniRead, AchieveBox, %A_ScriptDir%\SessionMan.ini, Options, AchieveBox, 0	
	IniRead, SoundAchieve, %A_ScriptDir%\SessionMan.ini, Options, SoundAchieve, C:\Program Files (x86)\PokerStars\snd\ding.wav
	IniRead, IntervalBox, %A_ScriptDir%\SessionMan.ini, Options, IntervalBox, 0
	IniRead, SoundInterval, %A_ScriptDir%\SessionMan.ini, Options, SoundInterval, 25
	IniRead, SlotA1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1x, 304
	IniRead, SlotA2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2x, 1112
	IniRead, SlotA3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3x, 1920
	IniRead, SlotA4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4x, 2728
	IniRead, SlotB1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1x, 304
	IniRead, SlotB2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2x, 1112
	IniRead, SlotB3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3x, 1920
	IniRead, SlotB4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4x, 2728
	IniRead, SlotC1x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1x, 304
	IniRead, SlotC2x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2x, 1112
	IniRead, SlotC3x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3x, 1920
	IniRead, SlotC4x, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4x, 2728
	IniRead, SlotA1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA1y, 0
	IniRead, SlotA2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA2y, 0
	IniRead, SlotA3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA3y, 0
	IniRead, SlotA4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotA4y, 0
	IniRead, SlotB1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB1y, 584
	IniRead, SlotB2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB2y, 584
	IniRead, SlotB3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB3y, 584
	IniRead, SlotB4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotB4y, 584	
	IniRead, SlotC1y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC1y, 299
	IniRead, SlotC2y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC2y, 299
	IniRead, SlotC3y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC3y, 299
	IniRead, SlotC4y, %A_ScriptDir%\SessionMan.ini, Coords, SlotC4y, 299
	IniRead, SlotA1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA1Key, F1
	IniRead, SlotA2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA2Key, F2
	IniRead, SlotA3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA3Key, F3
	IniRead, SlotA4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotA4Key, F4
	IniRead, SlotB1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB1Key, F5
	IniRead, SlotB2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB2Key, F6
	IniRead, SlotB3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB3Key, F7
	IniRead, SlotB4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotB4Key, F8
	IniRead, SlotC1Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC1Key, F9
	IniRead, SlotC2Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC2Key, F10
	IniRead, SlotC3Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC3Key, F11
	IniRead, SlotC4Key, %A_ScriptDir%\SessionMan.ini, Hotkeys, SlotC4Key, F12
	IniRead, Reset, %A_ScriptDir%\SessionMan.ini, Hotkeys, Reset, CTRL+F9
	IniRead, Increase, %A_ScriptDir%\SessionMan.ini, Hotkeys, Increase, CTRL+F10
	IniRead, Close, %A_ScriptDir%\SessionMan.ini, Hotkeys, Close, CTRL+Q
return     
;================================================================================================================================ 
;=================================================== HOTKEY LABELS ============================================================== 	;|
TimeReset:				;counter (SessionTime) reset
	{                           
	FormatTime, Start, %A_Now%, ddd d.M.yyyy HH:mm:ss
	H1 = 0                      
	H2 = 0                      
	M1 = 0                      
	M2 = 0                      
	Gui, Font, s14 c%NumColor%  
	Gui, Font, Norm             
	GuiControl, Font, SessionTime
	GuiControl,, SessionTime, %H2%:%M1%%M2%
	Gosub CheckLog          
	}                           
return                          
;--------------------------------------------------------------------------------------------------------------------------------
TimeIncrease:				;counter (SessionTime) + 1
	Var = -1                    
return                          
;--------------------------------------------------------- SLOT1 ----------------------------------------------------------------
Slot1:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA1x%, %SlotA1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT2 ----------------------------------------------------------------
Slot2:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA2x%, %SlotA2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT3 ----------------------------------------------------------------
Slot3:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA3x%, %SlotA3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT4 ----------------------------------------------------------------
Slot4:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotA4x%, %SlotA4y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT5 ----------------------------------------------------------------
Slot5:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB1x%, %SlotB1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT6 ----------------------------------------------------------------
Slot6:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB2x%, %SlotB2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT7 ----------------------------------------------------------------
Slot7:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB3x%, %SlotB3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT8 ----------------------------------------------------------------
Slot8:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotB4x%, %SlotB4y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT9 ----------------------------------------------------------------
Slot9:                            
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC1x%, %SlotC1y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT10 ---------------------------------------------------------------
Slot10:                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC2x%, %SlotC2y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT11 ---------------------------------------------------------------
Slot11:                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC3x%, %SlotC3y%
	else, return                
	}                           
return                          
;--------------------------------------------------------- SLOT12 ---------------------------------------------------------------
Slot12:                           
	{                           
	IfWinActive, ahk_class PokerStarsTableFrameClass
		WinMove, %SlotC4x%, %SlotC4y%
	else, return                
	}                           
return   
;================================================================================================================================	;>

Last edited by Baobhan-Sith; 11-30-2013 at 09:13 PM.
Table Counter AHK for PokerStars Quote
12-15-2013 , 01:05 AM
Time for another useless update, even if it's only to show how pompous and self-important a person I just became.

Changes:
- added a progress window
- added a context menu upon right-clicking the main window
- pause function will now only pause the counters, but not the clock and other functions
- both main window and progress window visually indicate the pause state
- re-implemented the pause hotkey
- added a color code generator (source: http://ahkscript.org/boards/viewtopic.php?f=6&t=65)
- you can now save and restore the positions of main~, progress~, and settings window via the context menu (all at once obv)
- some minor things and fixes






Download SessionMan2.6.3.ahk (ul.to)
Table Counter AHK for PokerStars Quote
12-21-2013 , 05:02 AM
not tried yet, but it looks awesome Baobhan-Sith
Table Counter AHK for PokerStars Quote
01-06-2014 , 01:45 PM
Will you accept a few $$ tip Sith (dont want to be insulting... If so whats your stars acc) Love the script and the updates.
Used to use the basic one from months and months ago and just checked back as wanted to get VPP updates and seen how many features you added, and the GUI too. Very handy.

Couple of requests:
Ability to change amount of columns in the software - atm you have 3 by default, 180s, 45s, 18s. I'm hoping to change this to just the 2 (mtts & 18s).
& Ability to change amount of rows. Atm you have 3 under each column, personally I'd like this to be 4 ( so 2 columns by 4 rows).
Was wondering if its possible for you to add this to the GUI, or if not inform me how to manually edit (its a lot more complex than used to be as you've made it all so much prettier).

Cheers
Table Counter AHK for PokerStars Quote
01-06-2014 , 03:28 PM
Thanks for the feedback. I was thinking about adding one or 2 different layouts anyway, 2x4 is in the making.

Note that by now setting up MTT counters is a bit inconvenient due to the many different buy-ins, but I'm looking to improve that as well. By now, with 4 MTT counters you can only count 4 unique buy-ins using the NoType definition as the Gtd definition disregards the buy-in (don't use NoType and Gtd at once as that'll most likely lead to double counts). Also, by now the Big $109, for instance, will not be counted towards $109 MTTs using NoType due to the term "The Big".

Will take me some days but as a temporary workaround you can config the script eg. as follows, just assign the background color to Stake5 to make it invisible, and make sure to define a game/stake you don't play:




Table Counter AHK for PokerStars Quote
01-06-2014 , 04:00 PM
Quote:
Originally Posted by Baobhan-Sith
Thanks for the feedback. I was thinking about adding one or 2 different layouts anyway, 2x4 is in the making.

Note that by now setting up MTT counters is a bit inconvenient due to the many different buy-ins, but I'm looking to improve that as well. By now, with 4 MTT counters you can only count 4 unique buy-ins using the NoType definition as the Gtd definition disregards the buy-in (don't use NoType and Gtd at once as that'll most likely lead to double counts). Also, by now the Big $109, for instance, will not be counted towards $109 MTTs using NoType due to the term "The Big".

Will take me some days but as a temporary workaround you can config the script eg. as follows, just assign the background color to Stake5 to make it invisible, and make sure to define a game/stake you don't play:




Ah wow I didn't even think about the mtts being counted - was just presuming that was too hard, so was specifying 'gtd' and $109 for one and $44 for another, my two most regular tournies played, cool that i can use notype to hopefully add them all up.

Thanks for idea re colouring too and to blank out middle to make them seperate, good thinking.

Let me know if you accept donations
Table Counter AHK for PokerStars Quote
01-07-2014 , 12:02 PM
Hey Baobhan-Sith, can u help us here...
http://forumserver.twoplustwo.com/sh...&postcount=286

Thanks
Table Counter AHK for PokerStars Quote
01-12-2014 , 06:28 AM
Hi Bao very awesome work indeed!

However I am getting this error message when I try to go into the settings:

http://gyazo.com/def2840f4d043d22d228ea1aea4048e1

As a result all the tabs in the settings box are empty
Table Counter AHK for PokerStars Quote
01-12-2014 , 12:19 PM
Weird, this doesn't happen with ahk 1.0.48.05. Either use this version, or try replacing Unchecked with Checked. Prolly have to do this for every CheckBox command.

You could then as well delete the If line as well as the else line, unless an If...and command is used to define the checkbox state (eg. for IntervalBox). To avoid confusion, just don't delete anything.

Last edited by Baobhan-Sith; 01-12-2014 at 12:28 PM.
Table Counter AHK for PokerStars Quote
01-12-2014 , 12:31 PM
Im clueless with these things so not sure where that is im currently trying to edit the script so its just $7/$15 18 and $7/$15 45 mans so looks less clutter without 180s but its not going to plan:

http://gyazo.com/3771794eb24df7e4fc213c53998e355f

Also change the rake to fit Plat star status but with the error I keep getting I cant do that, you think if you have a bit of spare time you could change that for me? and if not to much trouble change the colour to black background white data text and red for the titles such as vpp, fpp total tables, abi etc? Sorry for being cheeky just struggling a bit
Table Counter AHK for PokerStars Quote
01-12-2014 , 01:02 PM
Are you still getting an error after replacing Unchecked with Checked for every checkbox?

Which ahk version are you using?

Don't mess with the code as that makes it impossible for me to troubleshoot, just configure the script using the settings window. To make the left row (180s) invisible, just use unique colors and apply whatever you use as background color (default = 383838) to the left row as shown here, and use Main Window - Digit Color (default = 999999) for all the other stakes.

edit:
Quote:
Originally Posted by OditeRussia
just $7/$15 18 and $7/$15 45 mans

if not to much trouble change the colour to black background white data text and red for the titles such as vpp, fpp total tables, abi etc?
Spoiler:




Last edited by Baobhan-Sith; 01-12-2014 at 01:16 PM.
Table Counter AHK for PokerStars Quote
01-12-2014 , 01:15 PM
I can not see any where to replace unchecked with checked is this right click script and edit?

Because if its under any of these tabs I cant see anything:

http://gyazo.com/ea44395cb96be4782cba70faf9c20e9f

I am using the latest version of AHK
Table Counter AHK for PokerStars Quote
01-12-2014 , 01:21 PM
Using the latest ahk version will prolly cause even more issues than that, and making the script compatible will prolly not happen anytime soon. Please install 1.0.48.05 from here:

http://www.autohotkey.com/board/topi...asic-versions/

Most poker scripts require this version anyway so there's basically no downside.

You can then run the script without any tweaks.
Table Counter AHK for PokerStars Quote
01-12-2014 , 01:22 PM
Cool thanks
Table Counter AHK for PokerStars Quote
01-14-2014 , 09:26 PM
Another suggestion: Get the script to remember the position it was saved in. It seems to always revert to x0 y0 so top left, and i have to manually move it.
Thanks
Table Counter AHK for PokerStars Quote
01-15-2014 , 12:09 AM
It's already implemented, just move the windows (main/progress/settings) where you want them to be, rightclick the main GUI (or tray icon) -> Save Position(s). Latest version also has an option to restore positions.

I'm afraid I won't get the layout options etc done this month as it's gonna be quite time intensive and I'm busy irl and grinding, but I'll be around for minor fixes if you find any. Hope you'll get by with the current version for a bit.
Table Counter AHK for PokerStars Quote
01-15-2014 , 11:54 AM
Thats awesome its built in, just tested and it worked great, thanks!
Look forward to the other layout in Feb, thanks again.
Table Counter AHK for PokerStars Quote

      
m