Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance,Force
numtables:=0
TotalTabelsOpend:=0
Menu,TableCounter,Add,Minimize To Tray,Minimize
Menu,TableCounter,Add,Reset Counter, ResetCounter
Menu,Tablecounter,Add,Exit,GuiClose
Gui -MaximizeBox -MinimizeBox +AlwaysOnTop +Caption +LastFound ; Change +/- Caption To remove Or Add titlebar
Gui, Color, 000000
Gui, Font, s20 cWhite, Verdana
Gui,Margin,10,10
Gui, Add, Text, vMyControl Center,0000
Gui, Add, Text, y+ cGreen vTotalTabelsOpend Center,0000
Gui, Show, AutoSize , Tbls
TabelCounterHwnd:=winExist()
OnMessage(0x201, "WM_LBUTTONDOWN")
SetTimer,TableCounter,1000
REturn
; NumTables counts evry table ( also Non Seated tables and the Replayer )
; TotalTabelsOpend only Counts tables where you where Seated
; RightClick the window to Get a menu to Reset Or Close TableCounter | Minimize To Tray
; Hold Left button down to drag window
; Change -Caption To Remove Titlebar or +Caption To Add Titlebar
TableCounter:
numtables := 0
;snippet will find all pokerstars windows
WinGet, Id, list, ahk_class PokerStarsTableFrameClass,, Program Manager
Loop,%Id%
{
Hwnd:=id%A_index%
numtables += 1
IF Hwnd not in %TableHwndList%
{
WinGettitle,Title,ahk_id%hwnd%
IF Instr(Title," Logged In as ")
{
TableHwndList:= TableHwndList ? TableHwndList . "," . Hwnd : Hwnd
TotalTabelsOpend+=1
}
}
}
if (numtables != lasttables) OR (SaveTotalTabelsOpend != TotalTabelsOpend)
{
IF TrayCounter
WinSetTitle,Ahk_id%TabelCounterHwnd%,,%numtables% / %TotalTabelsOpend%
GuiControl,, MyControl, %numtables%
lasttables = %numtables%
SaveTotalTabelsOpend = %TotalTabelsOpend%
GuiControl,, TotalTabelsOpend,%TotalTabelsOpend%
}
return
Minimize:
Gui,Minimize
WinSetTitle,Ahk_id%TabelCounterHwnd%,,%numtables% / %TotalTabelsOpend%
Return
GuiSize:
TrayCounter := A_EventInfo=1 ? 1 : 0
Return
GuiContextMenu:
Menu, TableCounter, Show
Return
ResetCounter:
TotalTabelsOpend:=0
GuiControl,, TotalTabelsOpend,0
Return
GuiClose:
ExitApp
Return
Mimimize to tray funtion Added
Note To myzelf dont Program and do 6 miljoen things at the same time
bug fix Total Counter reset
Last edited by mister x; 12-03-2010 at 04:52 PM.