Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2006, 12:35 AM
marathoner1977 marathoner1977 is offline
Senior Member
 
Join Date: May 2005
Posts: 121
Default iWitness - Need to upgrade from 10 to 12 tables?????

I know that the LONG post on iWitness discusses this, but I am very confused how to do modify line 183, etc... from 10 to 12 tables to observe? Does anyone know if the iWitness link will be upgraded to handle 12 tables, so I cut just re-install soon? Or could someone explain exactly how to do this manually?

TY
Reply With Quote
  #2  
Old 07-30-2006, 02:15 PM
marathoner1977 marathoner1977 is offline
Senior Member
 
Join Date: May 2005
Posts: 121
Default Re: iWitness - Need to upgrade from 10 to 12 tables?????

Anyone?
Reply With Quote
  #3  
Old 07-31-2006, 03:33 AM
MKR MKR is offline
Senior Member
 
Join Date: Oct 2003
Posts: 229
Default Re: iWitness -This handles 12 party tables

This modified script gets me 12 party tables:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; auto-execute section ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

string = -----------------------------------------------------------------------------------------------------------------------------`n
Log(string)

OnExit, ExitSub

period = 300000

version = iWitness v2.14

;Load preferences
IniRead, gui_x, iWitness.ini, Prefs, gui_x, Center
IniRead, gui_y, iWitness.ini, Prefs, gui_y
IniRead, gui_w, iWitness.ini, Prefs, gui_w, 500
IniRead, gui_h, iWitness.ini, Prefs, gui_h, 400
IniRead, open_password, iWitness.ini, Prefs, open_password, Yes
IniRead, login_on_first_client, iWitness.ini, Prefs, LogInOnFirstClient, Yes
IniRead, party_loc, iWitness.ini, Prefs, Party location, C:\Program Files\PartyGaming\PartyGaming.exe
IniRead, logging, iWitness.ini, Prefs, Logging, Yes
IniRead, auto_start, iWitness.ini, Prefs, auto_start, no
IniRead, tooltips, iWitness.ini, Prefs, tooltips, Yes
IniRead, sus_hotkeys, iWitness.ini, prefs, sus_hotkeys, no
IniRead, play_and_witness, iWitness.ini, Prefs, PlayAndWitness, no
IniRead, hand_history_folder, iWitness.ini, Prefs, HHFolder, blank
IniRead, SafeMode, iWitness.ini, Prefs, SafeMode, Yes
IniRead, EscapeTables, iWitness.ini, Prefs, EscapeTables, no

;create an array of usernames (if we have some)
;we have to find out if the current username was already recorded
;if not, it's added to the list
usernames = 0
Loop
{
IniRead, username%A_Index%, iWitness.ini, Accounts, username%A_Index%
If username%A_Index% = Error
Break
usernames++
}
Loop, %usernames%
{
If username%A_Index% = %A_UserName%
{
already_listed = Yes
Break
}
}
If already_listed <> Yes
{
our_num := usernames + 1
If our_num = 1
{
IniWrite, Yes, iWitness.ini, LoginPrefs, %A_UserName%
max_tables = 12
}
username%our_num% = %A_UserName%
usernames++
}
IniDelete, iWitness.ini, Accounts ;delte this section and write it back (in case this account wasn't recorded yet)
Loop, %usernames%
{
this_username := username%A_Index%
IniWrite, %this_username%, iWitness.ini, Accounts, username%A_Index%
}


FormatTime, Time

string =
(
%time%`n%a_workingdir%`n%a_ahkversion%`n%a_osversi on%`n%version%`ncompiled: %a_iscompiled%
)
Log(string)

;Setup Tray
Menu, Tray, NoStandard
Menu, Tray, DeleteAll
Menu, Tray, Add, Show, Show
Menu, Tray, Add
Menu, Tray, Add, About, About
Menu, Tray, Add, Help, Help
Menu, Tray, Add
Menu, Tray, Add, Auto-Login, Auto-Login
If open_password = Yes
Menu, Tray, Check, Auto-Login
Loop, %usernames% ;add the usernames to the "login on.." menu and check if needed
{
this_username := username%A_Index%
Menu, Login on..., Add, %this_username%, LoginPrefs
IniRead, Check, iWitness.ini, LoginPrefs, %this_username%
If Check = Yes
Menu, Login on..., Check, %this_username%
}
Menu, Tray, Add, Login on..., :Login on...
Menu, Tray, Add
Menu, Options, Add, Enable Logging, Logging
If logging = Yes
Menu, Options, Check, Enable Logging
Menu, Options, Add, Safe mode, SafeMode
If SafeMode = Yes
Menu, Options, Check, Safe mode
Menu, Options, Add, Tooltips, Tooltips
If tooltips = Yes
Menu, Options, Check, Tooltips
Menu, Options, Add, Auto-Start, AutoStart
If auto_start = Yes
Menu, Options, Check, Auto-Start
Menu, Options, Add, Suspend Hotkeys, SuspendHotkeys
If sus_hotkeys = Yes
Menu, Options, Check, Suspend Hotkeys
Menu, Tray, Add, Options, :Options
Menu, Tray, Add
Menu, Play && Witness, Add, Play && Witness, PlayAndWitness
If play_and_witness = Yes
Menu, Play && Witness, Check, Play && Witness
Menu, Play && Witness, Add, Escape tables, EscapeTables
If EscapeTables = Yes
Menu, Play && Witness, Check, Escape tables
Menu, Play && Witness, Add, Reset%A_Tab%Ctrl+R, Reset
Menu, Tray, Add, Play && Witness, :Play && Witness
Menu, Tray, Add
Menu, Tray, Add, Close Tables, CloseAll
Menu, Tray, Add, Tile Tables, Tile
Menu, Tray, Add, Refresh Players%A_Tab%Ctrl+P, UpdatePlayers
Menu, Tray, Add, Refresh Tables%A_Tab%Ctrl+T, OpenTables
Menu, Tray, Add
Menu, Tray, Add, Exit, Exit
Menu, Tray, Default, Show
Menu, Tray, Tip, %version%

margin_x := 2*1.25*8

Gui, +Resize +LastFound
Gui, Color, FFFACD
Gui, Font, Arial c1C1C1C
Gui, Add, Tab, vMyTab Buttons, Witness|Groups

;Witness Tab
Gui, Tab, 1
Gui, Add, Text, vtxt_tables Section, Tables:
Gui, Add, ListView, Sort +LV0x1 BackgroundFFFFF0 C36648B vgui_tableList gShowSelectedTable, Priority|Table|Game|Limit|Players|Client
Gui, Add, Text, vtxt_clients ys, Clients:
Gui, Add, ListView, Sort +LV0x1 BackgroundFFFFF0 CFF6347 vgui_clientList, Client|User Name|Machine|Tables
Gui, Add, Button, vgui_gobutton2 w30 Section gGuiGo,Go
Gui, Add, Button, vgui_stopbutton2 w30 ys gGuiStop, Stop

;Groups Tab
Gui, Tab, 2
Gui, Add, Text, vtext_game Section, Game:
Gui, Add, DDL, Vwhich_game ggame_selection,
(
Limit Hold'em|No-Limit Hold'em|Pot-Limit Hold'em|Omaha|Omaha Hi-Lo|Pot-Limit Omaha|Pot-Limit Omaha Hi-Lo|7 Card Stud|7 Stud Hi-Lo|Beginners (Limit)|Beginners (NL)|Jackpot (Bad Beat)|Jackpot
(High Hand)|SNG (NL Hold'em)|SNG (PL Hold'em)|SNG (Limit Hold'em)|SNG (Omaha Hi-Lo)|SNG (PL Omaha Hi-Lo)|SNG (7 Card Stud)|SNG (7 Stud Hi-Lo)
)
Gui, Add, Text, ys Section, Limit:
Gui, Add, DDL, Vwhich_limit gprefs,
Gui, Add, Text, vmin_players_txt ys Section, Min Players:
Gui, Add, DropDownList, vplayers_min w40 gprefs, 2|3|4|5|6|7|8|9|10
Gui, Add, Text, vtables_tops_txt, Max tables:
Gui, Add, DropDownList, vtables_tops w30 gprefs, ---|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|2 0
Gui, Add, Text, vmin_pot_txt, Min. avg. pot:
Gui, Add, Edit, vmin_pot w30 r1 Number gprefs
Gui, Add, Radio, vgui_typebox Checked x%margin_x% Section gfull, Full
Gui, Add, Radio, vgui_typebox2 ys Section g6max, 6max
Gui, Add, Radio, vgui_speed ys Section gSpeed, speed
Gui, Add, ListView, vListViewEdit x%margin_x% r1 LV0x8000 NoSortHdr Grid BackgroundFFFFF0 C36648B gAdd_Rule, Priority|Game|6max/Full|Limit|Players|Tables|Pot
Gui, Add, ListView, vListViewPrefs x%margin_x% -Hdr -LV0x4 Sort Grid BackgroundFFFFF0 C36648B gEdit_Rule, Priority|Game|6max/Full|Limit|Players|Tables|Pot
LV_ModifyCol(1, "Integer")
;Add the icon if it exists.
IfExist, iWitness.ico
Menu, Tray, Icon, iWitness.ico, 1
;Disable the stop button at startup.
GuiControl, Disable, gui_stopbutton
GuiControl, Disable, gui_stopbutton2

Gosub, ReadPrefs
Gosub, full
Gui, ListView, ListViewEdit
LV_Delete()
Mode = Add

max_tables := RecordClients("yes")
;Log the max tables
string = max_tables = %max_tables%
Log(string)
;Log whether the .ini exists.
IfExist, iWitness.ini
string = .ini exists.
Else
string = .ini does Not Exist.
Log(string)

If tooltips = Yes
SetTimer, Tip, 1000

If this_client <> 1 ;better not let them mess with the prefs if the other client's already going
{
GuiControl, Disable, which_game
GuiControl, Disable, which_limit
GuiControl, Disable, players_min
GuiControl, Disable, Priority
GuiControl, Disable, 6max
GuiControl, Disable, Full
GuiControl, Disable, ListViewEdit
}

If (gui_x = "center" OR gui_x < 0)
Gui, Show, Center w%gui_w% h%gui_h%, iWitness (Client %this_client%)
Else
Gui, Show, x%gui_x% y%gui_y% w%gui_w% h%gui_h%, iWitness (Client %this_client%)

If auto_start = Yes
Gosub, GuiGo
Return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; subroutines ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;________________________________________ gui labels ________________________________________
GuiSize:
If ErrorLevel = 1
{
Gui, Hide
Return
}
Sleep, 50

GuiControlGet, players_min, Pos
GuiControlGet, which_limit, Pos

GuiControl, Move, gui_gobutton, % "x" A_GuiWidth/2 - 50 - 1.25*8/2 "y" players_minY + players_minH + 20
GuiControl, Move, gui_stopbutton, % "x" A_GuiWidth/2 + 1.25*8/2 "y" players_minY + players_minH + 20
GuiControlGet, which_game, Pos
GuiControl, Move, gui_typebox, % "y" which_gameY + which_gameH + 1.25*8 "x" which_gameX
GuiControl, Move, gui_typebox2, % "y" which_gameY + which_gameH + 1.25*8
GuiControl, Move, gui_Speed, % "y" which_gameY + which_gameH + 1.25*8

GuiControl, Move, ListViewEdit, % "y" which_gameY + which_gameH*2 + 1.25*8*2 "w" A_GuiWidth - margin_x*2
GuiControlGet, ListViewEdit, Pos
GuiControl, Move, ListViewPrefs, % "y" ListViewEditY + ListViewEditH + 1.25*8 "w" A_GuiWidth - margin_x*2 "h" A_GuiHeight - (ListViewEditY + ListViewEditH + 1.25*8*2)

GuiControlGet, min_players_txt, Pos
GuiControl, Move, players_min, % "w" min_players_txtW
GuiControl, Move, tables_tops_txt, % "x" min_players_txtW + min_players_txtX + 1.25*8 "y" min_players_txtY
GuiControlGet, tables_tops_txt, Pos
GuiControl, Move, tables_tops, % "x" min_players_txtW + min_players_txtX + 1.25*8 "y" min_players_txtY + min_players_txtH + .75*8 "w" tables_tops_txtW
GuiControlGet, tables_tops_txt, Pos
GuiControl, Move, min_pot_txt, % "x" tables_tops_txtX + tables_tops_txtW + 1.75*8 "y" min_players_txtY
GuiControlGet, min_pot_txt, Pos
GuiControl, Move, min_pot, % "x" tables_tops_txtX + tables_tops_txtW + 1.75*8 "y" min_players_txtY + min_players_txtH + .75*8 "w" min_pot_txtW ; "h" 18

GuiControlGet, txt_tables, Pos
GuiControl, Move, gui_tableList, % "y" txt_tablesY + txt_tablesH + .75*8 "h" A_GuiHeight - (txt_tablesY + txt_tablesH + 1.25*8*2 + .75*8) "w" (A_GuiWidth - txt_tablesX)/1.5
GuiControl, Move, gui_clientList, % "x" (A_GuiWidth - txt_tablesX)/1.5 + 1.25*8*3 "w" (A_GuiWidth - txt_tablesX)/3 - 1.25*8*3 "h" ((A_GuiHeight - (txt_tablesY + txt_tablesH + .75*8*2))/3)*2
GuiControl, Move, txt_clients, % "x" (A_GuiWidth - txt_tablesX)/1.5 + 1.25*8*3
GuiControlGet, gui_clientList, Pos
GuiControl, Move, gui_gobutton2, % "x" gui_clientListX "y" gui_clientListY + gui_clientListH + 1.25*8
GuiControl, Move, gui_stopbutton2, % "x" gui_clientListX + 30 + 1.25*8 "y" gui_clientListY + gui_clientListH + 1.25*8

Gui, ListView, gui_tableList
LV_ModifyCol(1, ((A_GuiWidth - txt_tablesX)/1.5)/12)
LV_ModifyCol(2, ((A_GuiWidth - txt_tablesX)/1.5)/4)
LV_ModifyCol(3, ((A_GuiWidth - txt_tablesX)/1.5)/3.5)
LV_ModifyCol(4, ((A_GuiWidth - txt_tablesX)/1.5)/6)
LV_ModifyCol(5, ((A_GuiWidth - txt_tablesX)/1.5)/12)
LV_ModifyCol(6, ((A_GuiWidth - txt_tablesX)/1.5)/12)

Gui, ListView, gui_clientlist
LV_ModifyCol(1, ((A_GuiWidth - txt_tablesX)/3 - 1.25*8*2)/6)
LV_ModifyCol(2, ((A_GuiWidth - txt_tablesX)/3 - 1.25*8*2)/6*3)
LV_ModifyCol(3, 0)
LV_ModifyCol(4, ((A_GuiWidth - txt_tablesX)/3 - 1.25*8*2)/6)

Gui, ListView, ListViewEdit
LV_ModifyCol(1, (A_GuiWidth - margin_x*2)/20)
LV_ModifyCol(2, (A_GuiWidth - margin_x*2)/3)
LV_ModifyCol(3, (A_GuiWidth - margin_x*2)/7)
LV_ModifyCol(4, (A_GuiWidth - margin_x*2)/6)
LV_ModifyCol(5, (A_GuiWidth - margin_x*2)/10)
LV_ModifyCol(6, (A_GuiWidth - margin_x*2)/12)
LV_ModifyCol(7, (A_GuiWidth - margin_x*2)/10)

Gui, ListView, ListViewPrefs
LV_ModifyCol(1, (A_GuiWidth - margin_x*2)/20)
LV_ModifyCol(2, (A_GuiWidth - margin_x*2)/3)
LV_ModifyCol(3, (A_GuiWidth - margin_x*2)/7)
LV_ModifyCol(4, (A_GuiWidth - margin_x*2)/6)
LV_ModifyCol(5, (A_GuiWidth - margin_x*2)/10)
LV_ModifyCol(6, (A_GuiWidth - margin_x*2)/12)
LV_ModifyCol(7, (A_GuiWidth - margin_x*2)/10)

WinSet, Redraw

iWitness_w = %A_GuiWidth%
iWitness_h = %A_GuiHeight%
Return

GuiClose:
ExitApp
Return

gui2_buttonOK:
Gui, 2: Destroy
Gui, 1: -Disabled
Return

;________________________________________ tray menu labels ________________________________________

Exit:
Gosub, ExitSub
Return

Show:
Gui, Show
Return

;Displays the About Tooltip
About:
TrayTip, %version%,Authors: SamIAm & Roland`nEmail: iWitness@overcards.com`n`nAll rights reserved., , 1
Return

;Displays the Help page.
Help:
Run, http://overcards.com/wiki/moin.cgi/iWitness
Return

;En/disables logging
Logging:
If logging = no
{
Menu, Options, Check, Enable Logging
logging = Yes
}
Else
{
Menu, Options, UnCheck, Enable Logging
logging = no
}
Return

;this handles login/log out for every username
LoginPrefs:
IniRead, yes_no, iWitness.ini, LoginPrefs, %A_ThisMenuItem%
If yes_no = Yes
{
Menu, Login on..., UnCheck, %A_ThisMenuItem%
IniWrite, no, iWitness.ini, LoginPrefs, %A_ThisMenuItem%
max_tables = 4 ;switch to logged out mining, so max_tables has to be 4
}
Else
{
Menu, Login on..., Check, %A_ThisMenuItem%
IniWrite, Yes, iWitness.ini, LoginPrefs, %A_ThisMenuItem%
max_tables = 12
}
Return

;Sets the auto-login gui according to the prefs.
Auto-Login:
If open_password = Yes
{
Menu, Tray, UnCheck, Auto-Login
open_password = no
}
Else
{
Menu, Tray, Check, Auto-Login
open_password = Yes
}
Return

SafeMode:
If SafeMode = Yes
{
SafeMode = no
Menu, Options, UnCheck, Safe mode
}
Else
{
SafeMode = Yes
Menu, Options, Check, Safe mode
}
Return

AutoStart:
If auto_start = no
{
auto_start = Yes
Menu, Options, Check, Auto-Start
}
Else
{
auto_start = no
Menu, Options, UnCheck, Auto-Start
}
Return

SuspendHotkeys:
If sus_hotkeys = no
{
Menu, Options, Check, Suspend Hotkeys
sus_hotkeys = Yes
}
Else
{
Menu, Options, UnCheck, Suspend Hotkeys
sus_hotkeys = no
}
Return

Tooltips:
If tooltips = Yes
{
Menu, Options, UnCheck, Tooltips
SetTimer, Tip, Off
tooltips = no
}
Else
{
Menu, Options, Check, Tooltips
SetTimer, Tip, On
tooltips = Yes
}
Return

Reset:
Check("clear_tables_to_escape")
Return

PlayAndWitness:
If play_and_witness = Yes
{
play_and_witness = no
Menu, Play && Witness, UnCheck, Play && Witness
}
Else
{
Gui, +OwnDialogs
If (hand_history_folder = "blank" OR FileExist(hand_history_folder) = "")
FileSelectFolder, hand_history_folder, C:\Programs\PartyGaming\PartyPoker\HandHistory, 0, Select the folder <your screenname> in the HandHistory folder:
If hand_history_folder =
Return
play_and_witness = Yes
Menu, Play && Witness, Check, Play && Witness
}
Return

EscapeTables:
If EscapeTables = Yes
{
EscapeTables = no
Menu, Play && Witness, UnCheck, Escape tables
}
Else
{
EscapeTables = Yes
Menu, Play && Witness, Check, Escape tables
}
Return


;Closes all tables.
;now we also delete the tables we closed from the list (duplicating the behavior of the Check() function)
CloseAll:
CloseAll()
Return

;Displays all tables.
Tile:
SetTitleMatchMode, 2
WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com
o := - 30
Loop, %id%
{
StringTrimRight, this_id, id%A_Index%, 0
WinActivate, ahk_id%this_id%
}
Loop, %id%
{
o += 30
StringTrimRight, this_id, id%A_Index%, 0
WinMove, ahk_id%this_id%, , o, o
}
Return

;________________________________________ gui control labels ________________________________________

;
6max:
game_type = 6max
IfNotInString, which_game, SNG
{
GuiControl, , players_min, |2|3|4|5|6
GuiControl, Choose, players_min, % players_min - 1
}
Else
GuiControl, Choose, players_min, |1
Gosub, prefs
Return

full:
game_type = full
IfNotInString, which_game, SNG
{
GuiControl, , players_min, |2|3|4|5|6|7|8|9|10
GuiControl, Choose, players_min, % players_min - 1
}
Else
GuiControl, Choose, players_min, |1
Gosub, prefs
Return

Speed:
game_type = speed
Gosub, prefs
Return



Add_Rule:
If A_GuiEvent = DoubleClick
{
rules =
Gui, ListView, ListViewEdit
Loop, 7
{
LV_GetText(rule, 1, A_Index)
If rule =
{
message = Missing Criteria, Your rule is Not complete.`nPlease fill in the missing criteria.
Message(message)
Return
}
rule%A_Index% = %rule%
}

Gui, ListView, ListViewPrefs
LV_Add("", rule1, rule2, rule3, rule4, rule5, rule6, rule7)
LV_ModifyCol(1, "Integer Sort")
Gosub, RecordPrefs
Gui, ListView, ListViewEdit
LV_Delete(1)
Mode = Add
}
Else if A_GuiEvent = R
{
Gui, ListView, ListViewEdit
LV_Delete(1)
}
Return

Edit_Rule:
If A_GuiEvent = R
{
Gui, ListView, ListViewPrefs
LV_Delete(A_EventInfo)
Gosub, RecordPrefs
LV_Delete()
Gosub, ReadPrefs
Return
}
Else if A_GuiEvent = DoubleClick
{
Mode = Edit
Gui, ListView, ListViewEdit
LV_Delete(1)
Gui, ListView, ListViewPrefs
Loop, 7
{
LV_GetText(rule, A_EventInfo, A_Index)
rule%A_Index% = %rule%
}
Gui, ListView, ListViewEdit
LV_Add("", rule1, rule2, rule3, rule4, rule5, rule6, rule7)
GuiControl, Choose, which_game, %rule2%
Gosub, game_selection
GuiControl, Choose, which_limit, %rule4%
GuiControl, Choose, players_min, % rule5 - 1
GuiControl, Choose, tables_tops, % rule6 + 1
StringTrimLeft, rule7, rule7, 1
GuiControl, , min_pot, %rule7%
Gosub, prefs

Gui, ListView, ListViewPrefs
LV_Delete(A_EventInfo)
}
Return

prefs:
n =
Gui, Submit, NoHide
IfInString, which_game, SNG
GuiControl, Show, gui_speed
Else
GuiControl, Hide, gui_speed

If (which_game = "7 Card Stud" OR which_game = "7 Stud Hi-Lo" OR which_game = "Beginners (Limit)" Or which_game = "Beginners (NL)")
{
GuiControl, Hide, gui_typebox
GuiControl, Hide, gui_typebox2
game_type = full
}
Else
{
GuiControl, Show, gui_typebox
GuiControl, Show, gui_typebox2
If (InStr(which_game, "SNG") <> 0 And InStr(which_game, "NL Hold'em") = 0)
GuiControl, Disable, gui_typebox2
Else
GuiControl, Enable, gui_typebox2
}

If Mode = Add
{
Gui, ListView, ListViewPrefs
n := LV_GetCount() + 1
}
Else
{
Gui, ListView, ListViewEdit
LV_GetText(n, 1, 1)
}
Gui, ListView, ListViewEdit
LV_Delete(1)
If min_pot =
min_pot = 0
LV_Add("", n, which_game, game_type, which_limit, players_min, tables_tops, "$" min_pot)
Return

game_selection:
Gui, Submit, NoHide
If which_game = Limit Hold'em
GuiControl, , which_limit, |$100/$200|$50/$100|$30/$60|$20/$40|$15/$30|$10/$20|$5/$10|$3/$6|$2/$4|$1/$2|$0.50/$1
Else if which_game = No-Limit Hold'em
GuiControl, , which_limit, |$10/20 NL|$5/10 NL|$3/6 NL|$2/4 NL|$1/2 NL|$0.50/1 NL|$0.25/0.50 NL|$0.10/0.25 NL
Else if (which_game = "Pot-Limit Hold'em" OR which_game = "Pot-Limit Omaha" OR which_game = "Pot-Limit Omaha Hi-Lo")
GuiControl, , which_limit, |$10/20 PL|$5/10 PL|$3/6 PL|$2/4 PL|$1/2 PL|$0.50/1 PL|$0.25/0.50 PL|$0.10/0.25 PL
Else if (which_game = "Omaha" OR which_game = "Omaha Hi-Lo" OR which_game = "7 Card Stud" OR which_game = "7 Stud Hi-Lo")
GuiControl, , which_limit, |$30/$60|$20/$40|$15/$30|$10/$20|$5/$10|$3/$6|$2/$4|$1/$2|$0.50/$1
Else if which_game = Beginners (Limit)
GuiControl, , which_limit, |$0.05/$0.10|$0.10/$0.20|$0.15/$0.30|$0.25/$0.50|$0.50/$1|$1/$2
Else if which_game = Beginners (NL)
GuiControl, , which_limit, |$0.02/$0.04|$0.05/$0.10|$0.02/$0.04|$0.10/$0.20|$0.25/$0.50
Else if (which_game = "Jackpot (High Hand)" OR which_game = "Jackpot (Bad Beat)")
GuiControl, , which_limit, |$15/$30|$10/$20|$5/$10|$3/$6|$2/$4
Else if (InStr(which_game, "SNG") <> 0 And InStr(which_game, "Hold'em") <> 0)
GuiControl, , which_limit, |$530|$215|$109|$77|$55|$33|$22|$11|$6
Else if (InStr(which_game, "SNG") <> 0)
GuiControl, , which_limit, |$109|$77|$55|$33|$22|$11|$6
If ((which_game = "7 Card Stud" OR which_game = "7 Stud Hi-Lo") And InStr(which_game, "SNG") = 0)
GuiControl, , players_min, |2|3|4|5|6|7|8
Else if (game_type = "full" And InStr(which_game, "SNG") = 0)
GuiControl, , players_min, |2|3|4|5|6|7|8|9|10
Else if (game_type = "6max" And InStr(which_game, "SNG") = 0)
GuiControl, , players_min, |2|3|4|5|6
Else
{
GuiControl, , players_min, |---
GuiControl, Choose, players_min, |1
}
Gosub, prefs
Return

RecordPrefs:
IniDelete, iWitness.ini, Rules
Gui, ListView, ListViewPrefs
criteria = game,6max?,Limit,players,tables_tops,min_pot
i = 1
Loop, Parse, criteria, `,
{
i++
crit = %A_LoopField%
total_rules := LV_GetCount()
Loop, %total_rules%
{
LV_GetText(this_crit, A_Index, i)
%crit%%A_Index% = %this_crit%
IniWrite, %this_crit%, iWitness.ini, Rules, %crit%%A_Index%
}
}
IniWrite, %total_rules%, iWitness.ini, Rules, total_rules
Return

;Read the rules from the .ini and display them in the listView.
ReadPrefs:
IniRead, total_rules, iWitness.ini, Rules, total_rules
Gui, ListView, ListViewPrefs
Loop, %total_rules%
{
IniRead, game%A_Index%, iWitness.ini, Rules, game%A_Index%
IniRead, 6max?%A_Index%, iWitness.ini, Rules, 6max?%A_Index%
IniRead, Limit%A_Index%, iWitness.ini, Rules, Limit%A_Index%
IniRead, players%A_Index%, iWitness.ini, Rules, players%A_Index%
IniRead, tables_tops%A_Index%, iWitness.ini, Rules, tables_tops%A_Index%
IniRead, min_pot%A_Index%, iWitness.ini, Rules, min_pot%A_Index%
}
Loop, %total_rules%
{
LV_Add("", A_Index, game%A_Index%, 6max?%A_Index%, Limit%A_Index%, players%A_Index%, tables_tops%A_Index%, min_pot%A_Index%)
}
LV_ModifyCol(1, "Integer Sort")
Return

;Restore the table highlighted in the TableList.
ShowSelectedTable:
Gui, ListView, gui_tableList
LV_GetText(selected_table, A_EventInfo, 2)
WinRestore, %selected_table%
WinMove, %selected_table%, , 0, 0
Return

;Go.
GuiGo:
IniRead, total_rules, iWitness.ini, Rules, total_rules
If (total_rules = "ERROR" OR total_rules = 0)
{
message = You didn't create any rules!`nPlease go to the "Groups" Tab And make some.
Message(message)
Return
}

TableMode := GetMode()
If TableMode = Normal
period = 300000
Else
period = 10000

string = Safe mode: %SafeMode%
Log(string)

;Disable preference buttons.
GuiControl, Disable, gui_gobutton2
GuiControl, Disable, which_game
GuiControl, Disable, which_limit
GuiControl, Disable, players_min
GuiControl, Disable, Priority
GuiControl, Disable, 6max
GuiControl, Disable, Full
GuiControl, Disable, ListViewEdit
GuiControl, Disable, tables_tops
GuiControl, Disable, min_pot
;Enable the stop button.
GuiControl, Enable, gui_stopbutton2
RecordClients("no")
Sleep, 1000
Gosub, OpenTables
SetTimer, OpenTables, %period%
Return

GuiStop:
SetTimer, OpenTables, Off
GuiControl, Disable, gui_stopbutton2
GuiControl, Enable, gui_gobutton2
GuiControl, Enable, which_game
GuiControl, Enable, which_limit
GuiControl, Enable, players_min
GuiControl, Enable, Priority
GuiControl, Enable, 6max
GuiControl, Enable, Full
GuiControl, Enable, ListViewEdit
GuiControl, Enable, tables_tops
GuiControl, Enable, min_pot
Return

;________________________________________ exit subroutine ________________________________________

ExitSub:
WinGetPos, x, y, , , iWitness
IniWrite, %iWitness_w%, iWitness.ini, Prefs, gui_w
IniWrite, %iWitness_h%, iWitness.ini, Prefs, gui_h
IniWrite, %x%, iWitness.ini, Prefs, gui_x
IniWrite, %y%, iWitness.ini, Prefs, gui_y
IniWrite, %open_password%, iWitness.ini, Prefs, open_password
IniWrite, %login_on_first_client%, iWitness.ini, Prefs, LogInOnFirstClient
IniWrite, %logging%, iWitness.ini, Prefs, Logging
IniWrite, %auto_start%, iWitness.ini, Prefs, auto_start
IniWrite, %tooltips%, iWitness.ini, Prefs, tooltips
IniWrite, %sus_hotkeys%, iWitness.ini, prefs, sus_hotkeys
IniWrite, %play_and_witness%, iWitness.ini, Prefs, PlayAndWitness
IniWrite, %hand_history_folder%, iWitness.ini, Prefs, HHFolder
IniWrite, %SafeMode%, iWitness.ini, Prefs, SafeMode
IniWrite, %EscapeTables%, iWitness.ini, Prefs, EscapeTables
FileDelete, %A_UserName%.%A_ComputerName%.ini

IniDelete, iWitness.ini, Accounts ;delte this section and write it back (in case this account wasn't recorded yet)
Loop, %usernames%
{
this_username := username%A_Index%
IniWrite, %this_username%, iWitness.ini, Accounts, username%A_Index%
}
string = `niWitness exits
Log(string)
ExitApp
Return

;________________________________________ timers subroutines ________________________________________

OpenTables:
Gui, ListView, gui_tableList
If (TableMode = "SNG" And LV_GetCount() = max_tables)
{
period = 60000
string = Opened 10 (4) SNGs, resetting period to 1 min
Log(string)
SetTimer, OpenTables, %period%
}

string = TableMode: %TableMode%
Log(string)

OpenTables()
RecordTables()
MinimizeAll()
UpdatePlayers()
Return

UpdatePlayers:
UpdatePlayers()
Return

Tip:
IfWinNotActive, iWitness
{
ToolTip
Return
}
MouseGetPos,,,window, ACtrl
WinGetTitle, is_iW, ahk_id%window%
IfNotInString, is_iW, iWitness
Return
Tip =

If ACtrl = SysListView324
Tip = double Click to Edit a row.`ndouble Right Click to Delete it

If (ACtrl = "SysListView323" OR ACtrl = "SysHeader323")
Tip = double Click to Add a new Group`ndouble Right Click to Delete this row

If ACtrl = SysListView321
Tip = You may double Click to Restore a table

If ACtrl <> %LastCtrl%
{
ToolTip, %Tip%
LastCtrl = %ACtrl%
}
Return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hotkeys; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

^P::
If sus_hotkeys = no
UpdatePlayers()
Return
^T::
If sus_hotkeys = no
Gosub, OpenTables
Return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Send the lobby to %game_type%
NavigateToGameType(game_type)
{
;Log beginning of journey.
string = Trying to navigate to %game_type%.
Log(string)
global lobby_id
static game_prev

ErrorLevel = 0

If (game_type = game_prev
OR (game_type = "7 Card Stud" And game_prev = "7 Stud Hi-Lo")
OR (game_type = "7 Stud Hi-Lo" And game_prev = "7 Card Stud")
OR (game_type = "Omaha" And game_prev = "Omaha Hi-Lo")
OR (game_type = "Omaha Hi-Lo" And game_prev = "Omaha")
OR (game_type = "Pot-Limit Omaha" And game_prev = "Pot-Limit Omaha Hi-Lo")
OR (game_type = "Pot-Limit Omaha Hi-Lo" And game_prev = "Pot-Limit Omaha")
OR (game_type = "Beginners (Limit)" And game_prev = "Beginners (NL)")
OR (game_type = "Beginners (NL)" And game_prev = "Beginners (Limit)")
OR (game_type = "Jackpot (Bad Beat)" And game_prev = "Jackpot (High Hand)")
OR (game_type = "Jackpot (High Hand)" And game_prev = "Jackpot (Bad Beat)"))
{
Success = Yes
string = Already at game_type
Log(string)
Return Success
}

IfInString, game_type, SNG
KeysToSend = S
Else if (game_type = "Limit Hold'em")
KeysToSend =
Else
StringLeft, KeysToSend, game_type, 1

WinWait, ahk_id%lobby_id%, , 5
WinActivate
ControlFocus, SysTreeView321
Success = no
Loop, 5
{
ControlSend, SysTreeView321, Cash
Loop, 5
{
ControlGet, is_cash, List, , SysListView321
IfInString, is_cash, $100/$200
{
Continue = no
Break
}
Sleep, 1000
}
If Continue <> no
Continue

Sleep, 2000
ControlSend, SysTreeView321, %KeysToSend%
Sleep, 1000
IfInString, game_type, Pot-Limit Omaha
ControlSend, SysTreeView321, %KeysToSend%
Loop, 5
{
ControlGet, contains_data, List, , SysListView321
IfInString, contains_data, $
{
Success = Yes
Break = Yes
Break
}
Sleep, 1000
}
If Break = Yes
Break
}
If Success <> Yes
TrayTip, Error, Unable to navigate to %game_type%, , 3
is_cash =
contains_data =
game_prev = %game_type%
;Log that we successfully navigated.
If Success = Yes
string = Navigated to %game_type%
Else
string = Couldn't navigate to game_type
Log(string)

Return Success
}


OpenTables()
{
global max_tables, this_client, lobby_id, TableMode, period, SafeMode, EscapeTables
;Open Party if necessary.
OpenParty()
string = OpenTables started.
Log(string)
;Read all the rules from the .ini.
IniRead, total_rules, iWitness.ini, Rules, total_rules
Loop, %total_rules%
{
IniRead, game%A_Index%, iWitness.ini, Rules, game%A_Index%
IniRead, 6max?%A_Index%, iWitness.ini, Rules, 6max?%A_Index%
IniRead, Limit%A_Index%, iWitness.ini, Rules, Limit%A_Index%
IniRead, players%A_Index%, iWitness.ini, Rules, players%A_Index%
IniRead, tables_tops%A_Index%, iWitness.ini, Rules, tables_tops%A_Index%
IniRead, min_pot%A_Index%, iWitness.ini, Rules, min_pot%A_Index%
}
;Log number of rules.
string = -%total_rules% total rules.
Log(string)

tables_to_escape := Check()

;IniRead, num_tables, %A_UserName%.%A_ComputerName%.ini, Tables, NumTables, 0

actual_tables_open := ActualTablesOpen()
tables_to_open := max_tables - actual_tables_open
string = tables_to_open = %tables_to_open%
Log(string)

string = actually_open: %actual_tables_open%
Log(string)


If tables_to_open = 0
Return

Gui, ListView, gui_tableList
If (TableMode = "SNG" And LV_GetCount() <> max_tables)
{
period = 10000
string = Less than 10 (4) SNGs open, resetting period to 10 sec
Log(string)
SetTimer, OpenTables, %period%
}

Gui, ListView, gui_tableList
Loop, % LV_GetCount()
{
LV_GetText(table, A_Index, 2)
match_list = %match_list%,%table%
}
StringTrimLeft, match_list, match_list, 1



Loop, %total_rules%
{
i++
table_list =

tables_in_group = 0
IniRead, tables_tops, iWitness.ini, Rules, tables_tops%i%
If tables_tops is Not Number
tables_tops = 1000
Gui, ListView, gui_tableList
Loop, % LV_GetCount()
{
LV_GetText(p, A_Index, 1)
p = %p%
If p = %i%
tables_in_group++
}
tables_tops -= tables_in_group
If tables_tops = 0
Continue




If (NavigateToGameType(game%i%) <> "yes")
Continue


If (6max?%i% = "6max" And InStr(game%i%, "SNG") = 0)
6max%i% = /6
Else if If (6max?%i% = "6max" And InStr(game%i%, "SNG") <> 0)
6max%i% =
Else if 6max?%i% = speed
6max%i% = Speed
Else
{
If (game%i% = "7 Card Stud" OR game%i% = "7 Stud Hi-Lo")
6max%i% = /8
Else if (InStr(game%i%, "SNG") <> 0)
6max%i% =
Else
6max%i% = /10
}
If (6max?%i% = "6max" And InStr(game%i%, "SNG (NL Hold'em") <> 0)
6max%i% = /6
If (6max?%i% = "full" And InStr(game%i%, "SNG (NL Hold'em") <> 0)
6max%i% = /10

If (game%i% = "Limit Hold'em" OR game%i% = "No-Limit Hold'em" OR game%i% = "Pot-Limit Hold'em")
g%i% =
Else if (game%i% = "Pot-Limit Omaha" OR game%i% = "Pot-Limit Omaha Hi-Lo")
StringReplace, g%i%, game%i%, Pot-Limit, PL
Else if game%i% = Beginners (Limit)
g%i% = Hold'em
Else if game%i% = Beginners (NL)
g%i% = NL Hold'em
Else if game%i% = Jackpot (Bad Beat)
g%i% = Bad Beat Jackpot
Else if game%i% = Jackpot (High Hand)
g%i% = High Hand Jackpot
Else if (game%i% = "SNG (Limit Hold'em)")
g%i% = Hold'em
Else if (InStr(game%i%, "SNG"))
StringMid, g%i%, game%i%, InStr(game%i%, "(") + 1, InStr(game%i%, ")") - InStr(game%i%, "(") - 1
Else
{
g%i% := game%i%
}

StringTrimLeft, min_pot%i%, min_pot%i%, 1


If (InStr(Limit%i%, "NL") <> 0 OR InStr(Limit%i%, "PL") <> 0)
{
StringTrimRight, l%i%, Limit%i%, 3
StringReplace, l%i%, l%i%, /, /$
}
Else
l%i% := Limit%i%

WinWait, ahk_id%lobby_id%
WinActivate
ControlClick, SysListView321
ControlGet, info, List, , SysListView321
Loop, Parse, info, `n
{
If tables_tops = 0
Break


If(InStr(A_LoopField, l%i%) = 0 OR InStr(A_LoopField, 6max%i%) = 0 OR InStr(A_LoopField, g%i%) = 0 OR (g%i% = "Omaha" And InStr(A_LoopField, "Hi-Lo")) OR (g%i% = "PL Omaha" And InStr(A_LoopField, "Hi-Lo")))
Continue
If (InStr(A_LoopField, "Beginners") And InStr(A_LoopField, "NL Hold'em") And g%i% = "Hold'em")
Continue
StringMid, num_players, A_LoopField, InStr(A_LoopField, "/", True, 0) - 1, 2, L
num_players = %num_players%
If (num_players < players%i% And InStr(game%i%, "SNG") = 0)
Continue
If (InStr(game%i%, "SNG") <> 0 And InStr(game%i%, "SNG (NL Hold'em") = 0 And InStr(A_LoopField, "Level 1") = 0)
Continue
If (InStr(game%i%, "SNG (NL Hold'em") <> 0 And InStr(A_LoopField, "Registering") = 0)
Continue
If (InStr(game%i%, "SNG (NL Hold'em") <> 0 And 6max?%i% = "full" And InStr(A_LoopField, "Speed") <> 0)
Continue

StringRight, pot, A_LoopField, StrLen(A_LoopField) - InStr(A_LoopField, "$", True, 0)

If (pot < min_pot%i%)
Continue

StringLeft, table_name, A_LoopField, InStr(A_LoopField, A_Tab) - 1
IfInString, table_name, $
StringLeft, table_name, table_name, InStr(table_name, "$") - 1
IfInString, table_name, (
StringLeft, table_name, table_name, InStr(table_name, "(") - 1

table_name = %table_name%

IfWinExist, %table_name%
{
WinWait, ahk_id%lobby_id%
Continue
}
If table_name in %match_list%
Continue

If EscapeTables = Yes
{
If table_name in %tables_to_escape%
Continue
}

table_to_close =
If tables_opened >= %tables_to_open%
{
Break = no
table_to_close =
Loop, %total_rules%
{
last_rule := total_rules - A_Index + 1

If (last_rule <= i)
Break

Gui, ListView, gui_tableList
Loop, % LV_GetCount()
{
LV_GetText(which_rule, A_Index, 1)
If which_rule = %last_rule%
{
LV_GetText(is_our_client, A_Index, 6)
If is_our_client = %this_client%
{
LV_GetText(table_to_close, A_Index, 2)
If (CheckTable(table_to_close) <> "play")
{
LV_Delete(A_Index)
Break = Yes
Break
}
}
}
}
If Break = Yes
Break
}


If table_to_close <>
{
WinClose, %table_to_close%
WinWaitClose, %table_to_close%, , 3n
}
Else
{
string = OpenTables finished. (couldn't find a table to Close)
Log(string)
Return
}
}


WinWait, ahk_id%lobby_id%
ControlFocus, SysListView321
ControlSendRaw, SysListView321, %table_name%

string = Sent table_name (%table_name%)
Log(string)

ControlGet, is_target, List, Selected, SysListView321

string = Checking target (%is_target%)
Log(string)

IfNotInString, is_target, %table_name%
{

string = ########################Target didn't match table_name
Log(string)

If SafeMode = Yes
SendMessage, 0x115, 1, 0, SysListView321

ControlFocus, SysListView321
ControlClick, SysListView321
Continue
}
ControlFocus, SysListView321
ControlSend, SysListView321, {Enter}

WinWait, %table_name%, , 10

If ErrorLevel = 0
{
string = table succesfully opened
Log(string)

tables_opened++
tables_tops--
Gui, ListView, gui_tableList
;changed it to put the actual number of players in the list - possibly better for play&witness
LV_Add("", i, table_name, game%i%, Limit%i%, num_players, this_client)
match_list = %match_list%,%table_name%
}
Else
{

string = Table could Not be opened
Log(string)
IfWinExist, PartyPoker.com, You already have ;_______QUICK HACK
{
string = Error - Already opened 10 (4) tables
Log(string)
WinClose
Return
}


SetTitleMatchMode, 2
WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com
Loop, %id%
{
StringTrimRight, this_id, id%A_Index%, 0
WinGetTitle, this_title, ahk_id%this_id%
If this_title Not Contains %match_list%
{
string = Closing table %this_title%
Log(string)

PostMessage, 0x112, 0xF060,,, ahk_id%this_id%
Break
}
}
}

WinActivate, ahk_id%lobby_id%
WinWaitActive, ahk_id%lobby_id%, , 2
If SafeMode = Yes
Sleep, 1000
}
}
string = OpenTables finished.
Log(string)
Return
}

;_________________________________________________ __________________________________________________

;Check all tables, both here and networked. If here, ensure that they meet criteria.
Check(clear_tables_to_escape = "")
{
global lobby_id
static tables_to_escape

If clear_tables_to_escape = clear_tables_to_escape
{
tables_to_escape =
Return
}


;Read all the rules from the .ini into memory.
IniRead, total_rules, iWitness.ini, Rules, total_rules
Loop, %total_rules%
{
IniRead, game%A_Index%, iWitness.ini, Rules, game%A_Index%
IniRead, 6max?%A_Index%, iWitness.ini, Rules, 6max?%A_Index%
IniRead, Limit%A_Index%, iWitness.ini, Rules, Limit%A_Index%
IniRead, players%A_Index%, iWitness.ini, Rules, players%A_Index%
IniRead, tables_tops%A_Index%, iWitness.ini, Rules, tables_tops%A_Index%
IniRead, min_pot%A_Index%, iWitness.ini, Rules, min_pot%A_Index%
}
;Findout how many tables we'll have to check.
Loop, 12
{
;Read from the title from the ini.
IniRead, table_to_check%A_Index%, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%, Blank
;If it's blank, it's not a legit table.
If table_to_check%A_Index% = Blank
Break
;Otherwise, inc the number of tables.
tables_to_check++
}

Loop, %total_rules%
{
If min_pot%A_Index% <> $0
{
check_pot = Yes
Break
}
}


;Go through all the tables to be checked
Loop, %tables_to_check%
{
;Grab the table name
StringReplace, table_name, table_to_check%A_Index%, (
StringReplace, table_name, table_name, )
StringTrimRight, table_name, table_name, 1
table_name = %table_name%
;If the window exists
IfWinExist, %table_name%
{

If check_pot = Yes
{
WinActivate, ahk_id%lobby_id%
WinWaitActive, ahk_id%lobby_id%, , 3
Sleep, 500
IniRead, p, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%
StringMid, p, p, InStr(p, "(") + 1, InStr(p, ")") - 1 - InStr(p, "(")
IniRead, game%p%, iWitness.ini, Rules, game%p%

NavigateToGameType(game%p%)

ControlGet, info, List, , SysListView321, ahk_id%lobby_id%
IniRead, min_pot, iWitness.ini, Rules, min_pot%p%
StringTrimLeft, min_pot, min_pot, 1
StringTrimLeft, info, info, InStr(info, table_name) - 1
StringLeft, info, info, InStr(info, "`n")
StringTrimLeft, pot, info, InStr(info, "$", True, 0)
info =
StringReplace, pot, pot, `n, , All
}

WinGetTitle, check_for_SNG
IfNotInString, check_for_SNG, Buy-in.
{
i = 3
seats = 0
;Go through all the "Seat Open" buttons
Loop, 10
{
i++
;If they're visible, this is an empty seat.
ControlGet, is_visible, Visible, , AfxWnd42%i%, %table_name%
If is_visible = 0
seats++
}
}
Else
{
ControlGetText, is_finished, RICHEDIT1
IfInString, is_finished, This tournament has finished
seats = finished
Else
{
ControlGetText, level, static5
StringMid, seats, level, InStr(level, "Level:") + 6, 1
If seats =
seats = Registering
Else
seats = L%seats%
}

}
}
Else
{
tables_to_escape = %table_name%,%tables_to_escape%
Continue
}
;Read the name from the networking .ini.
IniRead, p, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%
StringMid, p, p, InStr(p, "(") + 1, InStr(p, ")") - 1 - InStr(p, "(")
;Stud is special somehow. Who cares? Stud is a dumb game.
If (game%p% = "7 Card Stud" OR game%p% = "7 Stud Hi-Lo")
seats := seats - 2
Else if (6max?%p% = "6max")
seats := seats - 4
;If we have too few players
If (((InStr(game%p%, "SNG") = 0 And seats < players%p%) OR (InStr(game%p%, "SNG") <> 0 And seats = "finished") OR (pot < min_pot)) And CheckTable(table_name) <> "play")
{
;Close the table
WinClose, %table_name%
WinWaitClose, %table_name%, , 3
If ErrorLevel <> 0
{
WinWaitClose, %table_name%, , 5
;____I SUSPECT THE PROBLEMS GOODGUY IS HAVING MIGHT BE DUE TO the table not closing; quick hack
If ErrorLevel <> 0
table_list = %table_list%,%table_name%(%p%)
}
}
;Otherwise add it to the table list.
Else
table_list = %table_list%,%table_name%(%p%)
}
StringTrimLeft, table_list, table_list, 1
;Remove the tables from the networking.ini
IniDelete, %A_UserName%.%A_ComputerName%.ini, Tables
;Go through our table_list and write them all in the networking.ini.
num_tables = 0
Loop, Parse, table_list, `,
{
IniWrite, %A_LoopField%, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%
num_tables++
}
;Record the total number of tables.
IniWrite, %num_tables%, %A_UserName%.%A_ComputerName%.ini, Tables, NumTables
;Empty both the TableList gui and the ClientList gui.
Gui, ListView, gui_TableList
LV_Delete()
Gui, ListView, gui_clientList
LV_Delete()
;Go through all the possible other clients' networking.ini in the folder
Loop, *.ini
{
;iWitness.ini doesn't count.
If A_LoopFileName = iWitness.ini
Continue
;Read the data on that client
IniRead, which_client, %A_WorkingDir%\%A_LoopFileName%, Client, which_client
IniRead, num_tables, %A_WorkingDir%\%A_LoopFileName%, Tables, NumTables, 0
StringLeft, username, A_LoopFileName, InStr(A_LoopFileName, ".") - 1
StringTrimLeft, computername, A_LoopFileName, InStr(A_LoopFileName, ".")
StringTrimRight, computername, computername, 4
;And add them to the clientList.
Gui, ListView, gui_clientList
LV_Add("", which_client, username, computername, num_tables)
client_matchlist =%client_matchlist%,%which_client%
total_clients++
;Go through their tables
Loop, %num_tables%
{
;Grab the name
IniRead, table_n, %A_LoopFileName%, Tables, table%A_Index%
StringLeft, this_table, table_n, InStr(table_n, "(") - 1
StringMid, rule, table_n, InStr(table_n, "(") + 1, InStr(table_n, ")") - InStr(table_n, "(") - 1
;And add it to the tableList.
Gui, ListView, gui_tableList
LV_Add("", rule, this_table, game%rule%, Limit%rule%, players%rule%, which_client)
}
}
;Go through this total list of tables
Gui, ListView, gui_TableList
Loop % LV_GetCount()
{
;And add them together to form the math_list.
LV_GetText(table, A_Index, 2)
match_list = %match_list%,%table%
}
StringTrimLeft, match_list, match_list, 1
Return tables_to_escape
}

;_________________________________________________ ________________________________________________

;Minimizes all Party tables.
MinimizeAll()
{
global period
SetTitleMatchMode, 2
If period = 10000
WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com
Else
{
WinGet, id, List, Good Luck ahk_class #32770
WinMinimize, PartyPoker.com
}
Loop, %id%
{
StringTrimRight, this_id, id%A_Index%, 0
WinGetTitle, title, ahk_id%this_id%
StringLeft, title, title, InStr(title, "-") - 1
If (CheckTable(title) <> "play")
WinMinimize, ahk_id%this_id%
}
Return
}

;_________________________________________________ ________________________________________________
;close all the tables and delete them from the list
CloseAll()
{
global this_client

SetTitleMatchMode, 2
WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com
Loop, %id%
{
StringTrimRight, this_id, id%A_Index%, 0
WinClose, ahk_id%this_id%
}
;Record the total number of tables.
numTables = 0
IniWrite, %num_tables%, %A_UserName%.%A_ComputerName%.ini, Tables, NumTables
;Empty both the TableList gui and the ClientList gui.
Gui, ListView, gui_TableList
LV_Delete()
Gui, ListView, gui_clientList
LV_Delete()
;Go through all the possible other clients' networking.ini in the folder
Loop, *.ini
{
;iWitness.ini doesn't count.
If A_LoopFileName = iWitness.ini
Continue
;Read the data on that client
IniRead, which_client, %A_WorkingDir%\%A_LoopFileName%, Client, which_client
IniRead, num_tables, %A_WorkingDir%\%A_LoopFileName%, Tables, NumTables, 0
StringLeft, username, A_LoopFileName, InStr(A_LoopFileName, ".") - 1
StringTrimLeft, computername, A_LoopFileName, InStr(A_LoopFileName, ".")
StringTrimRight, computername, computername, 4
;And add them to the clientList.
Gui, ListView, gui_clientList
LV_Add("", which_client, username, computername, num_tables)
client_matchlist =%client_matchlist%,%which_client%
total_clients++
;Go through their tables
Loop, %num_tables%
{
;Grab the name
IniRead, table_n, %A_LoopFileName%, Tables, table%A_Index%
StringLeft, this_table, table_n, InStr(table_n, "(") - 1
StringMid, rule, table_n, InStr(table_n, "(") + 1, InStr(table_n, ")") - InStr(table_n, "(") - 1
;And add it to the tableList.
Gui, ListView, gui_tableList
LV_Add("", rule, this_table, game%rule%, Limit%rule%, players%rule%, which_client)
}
}
;Update the client-list.
Gui, ListView, gui_clientList
LV_Delete(this_client)
LV_Add("", this_client, A_UserName, A_ComputerName, 0)
Return
}

;_________________________________________________ _______________________________________________

;Records the list of tables to the networking file.
RecordTables()
{
global this_client
;Delete the old networking file.
IniDelete, %A_UserName%.%A_ComputerName%.ini, Tables
;Go through the list of tables
Gui, ListView, gui_tableList
Loop, % LV_GetCount()
{
LV_GetText(which_client, A_Index, 6)
;Till you find us.
If which_client = %this_client%
{
;Inc the number of tables.
t++
;Grab it's title.
LV_GetText(table, A_Index, 2)
;Grab it's limit.
LV_GetText(rule, A_Index, 1)
;Record.
IniWrite, %table% (%rule%), %A_UserName%.%A_ComputerName%.ini, Tables, table%t%
}
}
;Write number of tables total.
IniWrite, %t%, %A_UserName%.%A_ComputerName%.ini, Tables, NumTables
;Update the client-list.
Gui, ListView, gui_clientList
LV_Delete(this_client)
LV_Add("", this_client, A_UserName, A_ComputerName, t)
Return
}

;_________________________________________________ _______________________

;Displays the list of clients and tables.
;If %record_clients% = 'yes', then it'll return the number of tables to open. (4 or 10)
RecordClients(record_clients)
{
global this_client login_on_first_client
;Empty both ListViews.
Gui, ListView, gui_TableList
LV_Delete()
Gui, ListView, gui_clientList
LV_Delete()
;Go through all possible networking.ini files.
Loop, *.ini
{
;iWitness.ini doesn't count.
If A_LoopFileName = iWitness.ini
Continue
;Read the client's data.
IniRead, which_client, %A_LoopFileName%, Client, which_client
IniRead, num_tables, %A_LoopFileName%, Tables, NumTables, 0
StringLeft, username, A_LoopFileName, InStr(A_LoopFileName, ".") - 1
StringTrimLeft, computername, A_LoopFileName, InStr(A_LoopFileName, ".")
StringTrimRight, computername, computername, 4
;Add it to the client list.
Gui, ListView, gui_clientList
LV_Add("", which_client, username, computername, num_tables)
;Add them to the client_matchlist.
client_matchlist =%client_matchlist%,%which_client%
total_clients++
;Go through their tables
Loop, %num_tables%
{
IniRead, table_n, %A_LoopFileName%, Tables, table%A_Index%
StringLeft, this_table, table_n, InStr(table_n, "(") - 1
StringMid, rule, table_n, InStr(table_n, "(") + 1, InStr(table_n, ")") - InStr(table_n, "(") - 1
;And record them to the tableList.
Gui, ListView, gui_tableList
LV_Add("", rule, this_table, game%rule%, Limit%rule%, players%rule%, which_client)
}
}
Gui, ListView, gui_clientList
;If asked,
If record_clients = Yes
{
StringTrimLeft, client_matchlist, client_matchlist, 1
;Go through the clientlist and determine our client number.
Loop, % total_clients + 1
{
;And if it's not listed,
If A_Index Not in %client_matchlist%
{
;we must be that client.
this_client = %A_Index%
Break
}
}
;Maybe it wasn't recorded.
If this_client =
{
;In that case, we're #1!
this_client = 1
;Write down that we're logged in.
;IniWrite, logged_in, %a_username%.%a_computername%.ini, Logged_In, logged_in
;If the prefs say to login on the first,
;If login_on_first_client = yes
;Set max to 12.
;max_tables = 12
;else
;Otherwise set to 4.
; max_tables = 4
}
;If it was, then we're not the first client.
; else
{
;Write down that we're logged out.
;IniWrite, logged_out, %a_workingdir%\%a_username%.%a_computername%.ini, Logged_In, logged_in
;and set the max tables to 4.
;max_tables = 4
}
;Record our client#.
IniWrite, %this_client%, %A_UserName%.%A_ComputerName%.ini, Client, which_client
LV_Add("", this_client, A_UserName, A_ComputerName, 0)
}
;Return the number of allowed tables.
IniRead, log_in, iWitness.ini, LoginPrefs, %A_UserName% ;now we just use the recorded log-in prefs for this
If log_in = Yes
max_tables = 12
Else
max_tables = 4
Return max_tables
}

;_________________________________________________ ______________________________________

;Opens PartyPoker, if appropriate, logging on as necessary.
OpenParty()
{
global login_on_first_client, open_password, party_loc, max_tables, lobby_id, SafeMode, GotVersion
;If the Party window exists.
IfWinExist, PartyPoker.com
{
;Log that we already have Party.
string = Party's already open.
Log(string)
;Record the ID and we're done.
WinGet, lobby_id

If (SafeMode = "yes" And GotVersion <> "yes")
{
PostMessage, 0x111, 3019
WinWait, PartyPoker.com, PartyGaming Version, 2
WinGetText, version
StringTrimLeft, version, version, 3
WinClose
string = %version%`n
Log(string)
GotVersion = Yes
}

FileDelete, llh.dll
FileDelete, DM.dll
Return
}
;If not,
string = Party Not open.
Log(string)
;If the recorded location is there
IfNotExist, %party_loc%
{
;Ask for it by name.
Gui, +OwnDialogs
FileSelectFile, party_loc, 3, c:\, Select PartyGaming.exe
IniWrite, %party_loc%, iWitness.ini, Prefs, Party location
}
;Now run the location.
string = Loading Party.
Log(string)
Run, %party_loc% -P=PartyPoker
;Wait for it to load, but only 20 seconds.
WinWait, PartyAccount Login, , 20000
If ErrorLevel <> 0
{
message = PartyPoker could Not be opened.
Message(message)
}
;If asked,
IniRead, log_in, iWitness.ini, LoginPrefs, %A_UserName% ;again, use the recorded prefs
If log_in = Yes
max_tables = 12
Else
max_tables = 4
If (open_password = "yes" And max_tables = 12)
{
;login.
string = Logging into Party.
Log(string)
ControlClick, Login, PartyAccount Login
}
Else
{
If max_tables = 12
WinWaitClose, PartyAccount Login
Else
ControlClick, Cancel, PartyAccount Login
}
Loop, 2
{
WinWait, Message from PartyPoker.com, , 5
WinActivate
WinWaitActive, , , 1
PostMessage, 0x112, 0xF060
WinKill
Sleep, 1000
}
WinWait, PartyPoker.com:
WinGet, lobby_id
If (SafeMode = "yes" And GotVersion <> "yes")
{
PostMessage, 0x111, 3019
WinWait, PartyPoker.com, PartyGaming Version
WinGetText, version
StringTrimLeft, version, version, 4
WinClose
string = `n%version%`n
Log(string)
GotVersion = Yes
}
Sleep, 1000
FileDelete, llh.dll
FileDelete, DM.dll
Return
}

;_________________________________________________ ________________________________________________


;Writes %string% to log.txt (if pref has logging on).
Log(string)
{
global logging
If logging = no
Return
FileAppend, %string%`n, Log.txt
}

;_________________________________________________ __________________________________________________ _

UpdatePlayers()
{
global lobby_id
;Read all the rules from the .ini into memory.
IniRead, total_rules, iWitness.ini, Rules, total_rules
Loop, %total_rules%
{
IniRead, game%A_Index%, iWitness.ini, Rules, game%A_Index%
IniRead, 6max?%A_Index%, iWitness.ini, Rules, 6max?%A_Index%
IniRead, Limit%A_Index%, iWitness.ini, Rules, Limit%A_Index%
IniRead, players%A_Index%, iWitness.ini, Rules, players%A_Index%
}
;Findout how many tables we'll have to check.
Loop, 10
{
;Read from the title from the ini.
IniRead, table_to_check%A_Index%, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%, Blank
;If it's blank, it's not a legit table.
If table_to_check%A_Index% = Blank
Break
;Otherwise, inc the number of tables.
tables_to_check++
}
;Go through all the tables to be checked
Loop, %tables_to_check%
{
;Grab the table name
StringReplace, table_name, table_to_check%A_Index%, (
StringReplace, table_name, table_name, )
StringTrimRight, table_name, table_name, 1 ;hmmm this is no good if we have more than 10 rules
table_name = %table_name%
;If the window exists
IfWinExist, %table_name%
{
WinGetTitle, check_for_SNG
IfNotInString, check_for_SNG, Buy-in.
{
i = 3
seats = 0
;Go through all the "Seat Open" buttons
Loop, 10
{
i++
;If they're visible, this is an empty seat.
ControlGet, is_visible, Visible, , AfxWnd42%i%, %table_name%
If is_visible = 0
seats++
}
}
Else
{
ControlGetText, is_finished, RICHEDIT1
IfInString, is_finished, This tournament has finished
seats = finished
Else
{
ControlGetText, level, static5
StringMid, seats, level, InStr(level, "Level:") + 6, 1
If seats =
seats = Registering
Else
seats = L%seats%
}

}



;Read the name from the networking .ini.
IniRead, p, %A_UserName%.%A_ComputerName%.ini, Tables, table%A_Index%
StringMid, p, p, InStr(p, "(") + 1, InStr(p, ")") - 1 - InStr(p, "(")
;Stud is special somehow. Who cares? Stud is a dumb game. (ya, right. you prolly don't even know it's played 8 handed)
If (game%p% = "7 Card Stud" OR game%p% = "7 Stud Hi-Lo")
seats := seats - 2
Else if ((6max?%p% = "6max") And InStr(game%p%, "SNG") = 0)
seats := seats - 4
}
Gui, ListView, gui_tableList
Loop, % LV_GetCount()
{
LV_GetText(table, A_Index, 2)
IfInString, table_name, %table%
{
row = %A_Index%
Loop, 6
LV_GetText(Text%A_Index%, row, A_Index)
LV_Delete(A_Index)
LV_Add("", text1, text2, text3, text4, seats, text6)
Sleep, 50
Break
}
}
}
Return
}

;____________________________________________


;I hate those crappy-looking Msgboxes
Message(message)
{
global gui2_buttonOK, version
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.