Code:
;;;
;;; Jackpot Poker PT4 Tournament Summary Generator
;;;
;;; Creates tournament summaries for WPN Jackpot Poker tournaments that
;;; can be imported to PokerTracker 4 so that winnings are accurately recorded.
;;;
;;; Author: 2+2 user Max Cut
;;; June 2015
;;; Most recent update: July 12, 2016
;;;
#SingleInstance Force
#NoEnv
#Persistent
;;;
;;; Build the GUI
;;;
Menu, HelpMenu, Add, &Help, Help
Menu, HelpMenu, Add, &2+2 thread, 2p2Thread
Menu, HelpMenu, Add, &About, About
Menu, MyMenuBar, Add, &Help, :HelpMenu
Gui, Menu, MyMenuBar
Gui, Add, Text, x18 y13 w80, Screen Name
Gui, Add, Button, x10 y40 w80 h22 gResultsSelect, Results File
Gui, Add, Button, x10 y70 w80 h22 gOutputSelect, Output Folder
Gui, Add, Checkbox, x315 y39 w55 vCashesOnly Checked, Cashes Only
Gui, Add, Checkbox, x315 y75 w55 vAllFirst, All 1st
Gui, Add, Edit, x95 y10 w130 Left vScreenname
Gui, Add, Edit, x95 y40 w215 Left vResultsFile
Gui, Add, Edit, x95 y70 w215 Left vOutputFolder
Gui, Add, Progress, x230 y9 w140 h22 -Smooth Disabled
Gui, Font, c008800 s10
Gui, Add, Text, x230 w140 y9 h22 Center 0x200 BackgroundTrans gGenerateSummaries, Generate Summaries
FullGui := WinExist()
Gui, Show, h100 w 380, Jackpot Poker TS Generator
Gui, Submit, NoHide
return
;;;
;;; Help dialog.
;;;
Help:
helpText =
( LTrim
Jakpot Poker Tournament summary Generator
Creates PokerTracker 4 tournament summaries for WPN Jackpot Poker tournaments so that winnings are acurately recorded.
Steps for use:
1) Navigate in poker client to "My Account" --> "Transactions".
2) From the "Poker Statistics" options, select "Tournaments" (not to be confused with "Tournament History").
3) Select desired date range and specify number of records per page; click the "Submit" button.
4) Copy and paste the entire tournament results into a text file (no need for the colum headers or totals at the bottom).
5) Enter screen name.
6) Enter/select the results file (created in step 4).
7) Enter/select an output folder for tournament summaries.
8) If you wish it to write a summary for all games, uncheck "Cashes Only".
9) If you wish it to always write "1st place" rather than blank, check "All 1st".
9) Push Generate Summaries button.
10) In the PokerTracker client, import the tournament summaries by navigating to "Play Poker" --> "Get Hands from Disk" --> "Select Directory" to choose the output folder.
2+2 thread (link available in help menu) :
http://forumserver.twoplustwo.com/218/winning-poker-network/jackpot-poker-pt4-tournament-summary-generator-1536354/
)
MsgBox,, Jackpot Poker TS generator: HELP, %helpText%
return
;;;
;;; Link to 2+2 thread
;;;
2p2Thread:
Run http://forumserver.twoplustwo.com/218/winning-poker-network/jackpot-poker-pt4-tournament-summary-generator-1536354/
return
;;;
;;; About dialog.
;;;
About:
aboutText =
( LTrim
Jackpot Poker TS Generator is free from 2+2 member Max Cut.
)
MsgBox,, Jackpot Poker TS generator: ABOUT, %aboutText%
return
;;;
;;; Dialog for selecting results file.
;;;
ResultsSelect:
FileSelectFile, SelectedFile, 3, , Select results file..., Text Documents (*.txt)
If SelectedFile =
{
if ResultsFile =
{
MsgBox,, Jackpot Poker TS generator: ERROR, Please select a results file...
}
}
else
{
ResultsFile := SelectedFile
GuiControl, , ResultsFile, %SelectedFile%
}
return
;;;
;;; Dialog for selecting output folder
;;;
OutputSelect:
FileSelectFolder, SelectedFolder,, 3, Select output folder...
If SelectedFolder =
{
if OutputFolder =
{
MsgBox,, Jackpot Poker TS generator: ERROR, Please select a folder for the tournament summaries...
}
}
else
{
OutputFolder := SelectedFolder
GuiControl, , OutputFolder, %SelectedFolder%
}
return
;;;
;;; Generate PT4 tournament summaries from
;;; results file and write them to output folder
;;;
GenerateSummaries:
Gui, Submit, NoHide
;;; Basic error chaecking
If ScreenName =
{
MsgBox,, Jackpot Poker TS generator: ERROR, Please enter a screen name...
return
}
If ResultsFile =
{
MsgBox,, Jackpot Poker TS generator: ERROR, Please select a results file...
return
}
FileRead, results, %ResultsFile%
If ErrorLevel
{
MsgBox,, Jackpot Poker TS generator: ERROR, Error reading results file: `"%ResultsFile%`".`n`nPlease select a results file...
return
}
IfNotExist, %OutputFolder%
{
MsgBox,, Jackpot Poker TS generator: ERROR, Folder `"%OutputFolder%`" not found.`n`nPlease select a folder for the tournament summaries...
return
}
;;; Number of TS written.
TScount := 0
Loop, Parse, results, `n
{
;;; line will hold a line from the results file.
;;; line4 will hold the game type -- looking for Jackpot games.
line4 =
StringSplit, line, A_LoopField, %A_Space%%A_Tab%
winnings := SubStr(line22, 2)
;;; Only generating TS for Jackpot Poker...
IfNotInString, line4, Jackpot
{
;;; or WSOJ.
IfNotInString, line5, Jackpot
continue
}
;;; Only need to make TS when there are winnings.
if (0 >= winnings)
{
if (CashesOnly) {
continue
}
}
StringSplit, dateParts, line29, /
SetFormat, FloatFast, 02
startyear := dateParts3
startmonth := dateParts1 + 0.0
startday := dateParts2 + 0.0
StringSplit, dateParts, line32, /
SetFormat, FloatFast, 02
endyear := dateParts3
endmonth := dateParts1 + 0.0
endday := dateParts2 + 0.0
tsdate = %endyear%%endmonth%%endday%
;;; We leave finish position blank sine PT4 already figured it out from
;;; the hand history and there is no way to always tell from the report data.
;;; Seems to import fine this way.
finishpos =
if (AllFirst) {
finishpos = 1
}
;;; tstext is the tournament summary text.
tstext1 =
tstext1 =
( LTrim
PokerTracker 4 Tournament Summary
Site: Yatahay Network
Game: %line2%
Tournament #: %line1%
Started: %startyear%/%startmonth%/%startday%
Finished: %endyear%/%endmonth%/%endday%
)
;;; Account for Sit&Crush fee which is not reported as rake
SetFormat, FloatFast, 0.2
StringTrimLeft, fee, line10, 1
adjFee := fee / 0.75
;;; $3 WSOJ get rounded up apparently.
IfInString, line4, WSOP
{
IfInString, line6, $2.82
{
adjFee := 0.18
}
}
tstext2 =
tstext2 =
( LTrim
Buyin: %line6%
Fee: $%adjFee%
Table Type: STT (3 max) Hyper-Turbo SNG LOTTERY
Tourney Type: No Limit
Players: 3
Place: %finishpos%, Player: %ScreenName%, Won: %line22%,
)
;;; tspath is the path of the output tournament summary file to create.
tspath = %OutputFolder%\T#%line1% - %line6% + $%adjFee% - %tsdate% - Summary.txt
;;; Overwrite existing summary.
IfExist, %tspath%
{
FileDelete, %tspath%
}
;;; Write the tournament summary.
FileAppend, %tstext1%%tstext2%, %tspath%
if (not ErrorLevel)
{
TScount++
}
}
;;; Report number of tournament summaries generated.
MsgBox, %TScount% tournament summaries written to folder %OutputFolder%
return
;;; Shut it down!
GuiClose:
ExitApp
return