By HalvSame. Discussion thread on FlopTurnRiver.com is here. Discussion thread on 2p2 is here


BigPotGrabber

Supported poker sites: PartyPoker, PokerStars, FullTilt, Prima, iPoker, Cryptologic

This script will maintain a list of all seen pots over x big blinds in size. From this list you can bring up a trimmed version of the hand history text, making it easier to pay attention to important pots when multitabling. You'll need to make sure that the HandHistory folders are up to date, the easiest way to do this is by using PokerTracker's "Move processed hands" feature. I might try to fix this in a later version.

As of version 1.6 the script is dependent on XMLRead.ahk by Titan (http://www.autohotkey.com/forum/topic12004.html), which is included in the attatched zip-file.

Also included in the zip-file are resized versions of the Waffle card mod (http://matt.mondrary.com/party/). If you want to use different cards, replace the files in the gfx folder with your own mod. Be sure to follow the same naming scheme, ie "As.bmp" etc. If you don't want to use the converter feature at all, just delete the gfx folder and set "convert = 0" in the script options.

To use on Prima, make sure that the chatbox is set to No Player Chat. Due to limitations in the chat details stack sizes are unavailable, and also the only hole cards shown are the ones seen at showdown. There is a bug somewhere in the Convert function for Prima, sometimes it shows two hands stuck together, with missing cards on the flop etc. Gonna try to fix this sometime.

bigpotgrabbercustomuy2

How To Use This Script

  1. Read instructions for AutoHotkey, and make sure you have the latest version installed.

  2. Read all instructions on this page.

  3. Download and extract attached zip-file.

  4. Open script file in a text editor and edit settings.

  5. Double-click the file to run the script.

  6. When a big pot hand is added to the list, double left-click the row to open the HH.

  7. Double right-click a row to remove it from the list.

  8. Click the "Clear"-button to remove all hands from the list.

  9. Click the "Copy"-button to copy the selected HH to the clipboard.

  10. Double-click the HH-text to move the HH-window on top of the table it belongs to.

  11. Changing the threshold in the GUI will affect current session only (to permanently change it, edit the threshold variable at the beginning of the script)

Todo

Version History

1.7 November 4th 2007

1.6 August 4th 2007

1.51 May 14th 2007:

1.4 April 17th 2007:

1.3 April 8th 2007:

1.2 April 5th 2007:

1.1 April 4th 2007: Added PokerStars support

1.0 April 3rd 2007: Initial release, Party support only

Download

BigPotGrabber-1.73.zip

Script Code

;-------------------------------------------------------------
;------------------- BigPotGrabber v1.73 ----------------------
;-------------------------------------------------------------

; Date: Nov 9th 2007
; Author: HalvSame
; FlopTurnRiver.com discussion thread: http://www.flopturnriver.com/phpBB2/viewtopic.php?p=492260
;
; Thanks to Titan for XMLRead.ahk (http://www.autohotkey.com/forum/topic12004.html)

#NoEnv
#include XMLRead.ahk
SetTitleMatchMode 2


;----------START CONFIG (edit only below here)-------------------------------;


debug_enabled = 0                       ;set to 1 to enable writing debug log

interval := 30                          ;seconds between updates, shorter intervals means more resource intensive
threshold = 100                         ;how many big blinds is a big pot?

beep = 1                                ;beep when a big pot is spotted?
                                        ;Set to 1 to use system speaker, set to the path to a sound file,
                                        ;or set to one of the *xx system sounds (see http://www.autohotkey.com/docs/commands/SoundPlay.htm)

alwaysOnTop = 1                         ;set to 1 to keep the HH window always on top
listAlwaysOnTop = 0                     ;set to 1 to keep the list window always on top

autoOpenHH = 1                          ;set to 1 to automatically open HH window when a new hand is added
autoRemoveHand = 1                      ;set to 1 to automatically remove hand from list when the HH window is closed

trim = 1                                ;set to 1 to trim HH when using text view
convert = 1                             ;set to 1 to show a converted hh instead of the standard text

fontSize = 12                           ;size of the font in the converted HH
foldColor = gray                        ;color for the "fold" text in the converted HH
betColor = red                          ;color for the "bet" text in the converted HH
raiseColor = red                        ;color for the "raise" text in the converted HH
textColor = black                       ;color for other text

backgroundColor = white                 ;this can be a color's name or its hex code
transparency = 255                      ;set the window's transparency (0-255)
        
posX = 1832                             ;where to put the GUI 
posY = 30                               

primaName = UserName                    ;screen name on Prima Poker

cryptoHistoryPath = C:\Program Files\InterPoker\log\C123456789                  ;path to Cryptologic HH folder incl user name
ftpHistoryPath = C:\Program Files\Full Tilt Poker\HandHistory\UserName          ;path to FTP HH folder incl user name
iPokerHistoryPath = C:\Program Files\iPokerSkin\History\ABC12345678             ;path to iPoker HH folder incl user name
partyHistoryPath = C:\Program Files\PartyGaming\PartyPoker\HandHistory\UserName ;path to Party HH folder incl user name
starsHistoryPath = C:\Program Files\PokerStars\HandHistory\UserName             ;path to Stars HH folder incl user name


;----------END CONFIG (edit only above here)---------------------------------;

;-----write settings to log
s =
(
Settings:
threshold: %threshold%
backgroundColor: %backgroundColor%
textColor: %textColor%
starsHistoryPath: %starsHistoryPath%
ftpHistoryPath: %ftpHistoryPath%
autoOpenHH: %autoOpenHH%
autoRemoveHand: %autoRemoveHand%
trim: %trim%
convert: %convert%
foldColor: %foldColor%
betColor: %betColor%
raiseColor: %raiseColor%
interval: %interval%
)
Debug(s)
grabbedHands =
row =
InitList()
interval *= 1000
SetTimer, Spot, %interval%
return

;-----goes through all the tables and spots big pots
Spot:
SpotParty()
SpotStars()
SpotFtp()
SpotPrima()
SpotIpoker()
SpotCrypto()
return

;-------------------------------------------------------------------------------------------
;----CRYPTO----------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------


;-----reads the Crypto HH files to spot big pots
SpotCrypto()
{
        global cryptoHistoryPath, threshold, grabbedHands

        FileList =
        folderList =    

        ;--- find the newest folder
        Loop, %cryptoHistoryPath%\*, 2
                folderList = %folderlist%%A_loopFileName%`n
        Sort, folderList, R

        StringSplit, folderList, folderList, `n

        path = %cryptoHistoryPath%\%folderList1%

        ;--- find all .log-files in the folder
        Loop, %path%\*.log
                FileList = %FileList%%A_LoopFileName%`n

        Loop, parse, FileList, `n
        {
                StringTrimRight, number, a_loopfield, 4
                if number IS NOT number
                   continue

                ifInString, grabbedHands, %number%`n
                        continue

                ;---- read content of file
                FileRead, content, %path%\%A_LoopField%
        
                StringLen, length, content
                if (length = 0)
                        continue

                GrabbedHands = %number%`n%GrabbedHands%

                s = Read hand %number%
                Debug(s)

                IfInString, content, $
                        currency = $
                else
                  IfInString, content, £
                        currency = £
                else
                  IfInString, content, €
                        currency = €

                StringReplace, content, content, %currency%, $, , all

                ;read table name
                StringMid, table, content, InStr(content, " """) +2, InStr(content, """ ") - InStr(content, " """) -2
                
                ;--- read bb amount
                StringMid, bb, content, InStr(content, "/$") +2, InStr(content, ")") - InStr(content, "/$") -2

                ;--- read pot size, add to list if big
                StringMid, amount, content, InStr(content, "Total pot $") + 11, InStr(content, " Main pot $") - InStr(content, "Total pot $") - 11

                if(amount > (bb*threshold))
                {
                        StringReplace, content, content, $, %currency%, , All
                        AddToList("crypto", amount, table, content)
                        Debug(content)
                }
        }
}

;--- removes unneeded lines from the Crypto HH
TrimCrypto(hh)
{
        str =
        Loop, parse, hh, `n
        {       
                IfInString, A_loopfield, ----- SUMMARY -----
                        break

                if a_index >2
                {
                        IfNotInString, A_Loopfield, ----- HOLE CARDS -----
                        {
                                IfNotInString, A_Loopfield, sits out
                                {
                                        IfNotInString, A_Loopfield, joins the table at seat
                                        {
                                                IfNotInString, A_Loopfield, Returned uncalled
                                                {
                                                        IfNotInString, A_Loopfield, sits back
                                                                str = %str%%A_LoopField%`n
                                                }
                                        }
                                }
                        }
                }
        }
return str
}

;--- converts Crypto HH using card images etc
ConvertCrypto(hh)
{
        global
        Gui, 3:Destroy
        Gui, 3:Margin, 1, 1
        Gui, 3:Font, s%fontSize%

        StringSplit, hh,hh,[

        Loop, %hh0%
        {
                foldCount = 0
                next := A_index + 1
                str := hh%A_index%

                StringGetPos, count, hh%next%, ]
                
                StringLeft, card, hh%next%, count
                StringSplit, cards, card, %a_space%

                Loop, Parse, str, `r`n
                {
                        ifInString, A_loopfield, %a_space%folds
                        {
                                foldCount++
                                continue
                        }

                        if A_loopfield  !=
                        {
                                if A_loopfield != %A_space%
                                {
                                        if(foldCount > 0)
                                        {
                                                foldText = %foldCount% fold
                                                if foldCount > 1
                                                        foldText = %foldText%s

                                                Gui, 3:Add, Text, xm c%foldColor% Section italic gMoveToTable , %foldText%
                                                foldCount = 0
                                        }
                
                                        color= %textColor%
                                        IfInString, A_loopfield, %a_space%bets%a_space%
                                                color=%betColor%
                                        IfInString, A_loopfield, %a_space%raises%a_space%
                                                color=%raiseColor%

                                        Gui, 3:Add, Text, xm c%Color% Section gMoveToTable, %a_loopfield%       
                                }
                        }
                }

                Loop, %cards0%
                {               
                        file := cards%A_index%                  
                        Gui, 3:Add, Picture, ys gMoveToTable, gfx\%file%.bmp
                }
                
                StringTrimLeft, hh%next%, hh%next%, count + 1
        }
        
        Gui, 3:Color, %backgroundColor%

        WinGetPos,x, y, , , BigPotGrabber
        Gui, 3:show, x%x% y%y%, Big Pot HH
        
        WinGetPos,x, y, w, , Big Pot HH
        x -= w
        Gui, 3:Show, x%x% y%y%, Big Pot HH

        if AlwaysOnTop
                WinSet, AlwaysOnTop, on, Big Pot HH
        
        WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH
}


;-------------------------------------------------------------------------------------------
;----PARTY----------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------

;-----reads the Party HH files to spot big pots
SpotParty()
{
        global partyHistoryPath
        global threshold
        global grabbedHands

        FileList =
        folderList =    
        
        ;--- find the newest folder
        Loop, %partyHistoryPath%\*, 2
                folderList = %folderlist%%A_loopFileName%`n
        Sort, folderList, R
        StringSplit, folderList, folderList, `n

        path = %partyHistoryPath%\%folderList1%

        ;--- find all .txt-files in the folder
        Loop, %path%\*.txt
                FileList = %FileList%%A_LoopFileName%`n

        Loop, parse, FileList, `n
        {
                if A_LoopField =
                        continue
                
                ;---- get table name from file title
                StringSplit, table, A_LoopField, _
                table := table1

                ;---- read content of file and split into individual hands
                ;since Party separates the hands by writing a NULL character, we need to replace those characters in memory.
                ;(see http://www.autohotkey.com/forum/viewtopic.php?p=91578#91578)
                
                file = %path%\%A_LoopField%

                SetBatchLines, -1                  ; Run at top speed! 

                FileGetSize, dataSz  , %file%     ; StrLen() will not work with binary data 
                FileRead   , binData , %file%     ; Read the whole binary file into a variable 

                Pointer := &binData 

                Loop, %dataSz%                     ;Parse the binary data for NULL terminator 
                If ( *(Pointer+(A_Index-1)) = 0 ) ; If Chr(0) found replace it with Chr(167)/§ 
                        DllCall( "RtlFillMemory", UInt, Pointer+(A_Index-1), Int,1, UChar,167 )

                StringSplit, hand, binData, §

                ;---- read all hands to grab new pots
                Loop, %hand0%
                {
                        current := hand%a_index%
                        if current =
                                continue

                ;---- read hand number, proceed if not already in list
                StringLeft, number, current, 16
                Loop, Parse, GrabbedHands, `n
                {
                        if (number = A_LoopField)
                        {
                                AlreadyGrabbed = 1
                                break
                        }
                }

                if (AlreadyGrabbed != 1)
                {
                        s = Read hand %number%
                        Debug(s)

                        GrabbedHands = %number%`n%GrabbedHands%
                        
                                ;--- read bb amount
                                StringGetPos, start, current, big blind [$
                                StringGetPos, count, current, USD, , start
                                start+=13
                                count -= start

                                StringMid, bb, current, start, count

                                ;--- read pot size, add to list if big
                                StringGetPos, start, current, %a_space%wins $, R1
                                StringGetPos, count, current, USD, , start
                                start+=8
                                count -= start                          
                
                                StringMid, amount, current, start, count
                                StringReplace, amount, amount, `,
                                
                                if(amount > (bb*threshold))
                                {               
                                        AddToList("party", amount, table, current)
                                        Debug(current)
                                }
                        }
                AlreadyGrabbed = 0                                      
                }
        }
}

;--- removes unneeded lines from the Party HH
TrimParty(hh)
{
        str =
        Loop, parse, hh, `n
        {       
                if (A_index > 8)
                {
                        IfNotInString, A_Loopfield, >You have options at
                        {
                                IfNotInString, A_Loopfield, has joined the table.
                                {
                                        IfNotInString, A_Loopfield, has left the table.
                                        {
                                                IfNotInString, A_Loopfield, Dealing down cards
                                                        str = %str%%A_LoopField%`n
                                        }
                                }
                        }
                }
        }
return str
}

;--- converts Party HH using card images etc
ConvertParty(hh)
{
        global
        Gui, 3:Destroy
        Gui, 3:Margin, 1, 1
        Gui, 3:Font, s%fontSize%
        
        StringReplace, hh, hh,[%A_space%, §, All
        StringReplace, hh, hh,%A_space%], #, All

        StringSplit, hh,hh,§
        
        Loop, %hh0%
        {
                foldCount = 0
                next := A_index + 1
                str := hh%A_index%
                
                StringGetPos, count, hh%next%, #
        
                StringLeft, card, hh%next%, count
                
                StringReplace, card, card, %a_space%,  ,All
                StringReplace, card, card, `,,  ,All

                Loop, Parse, str, `r`n
                {
                        ifInString, A_loopfield, %a_space%folds
                        {
                                foldCount++
                                continue
                        }
                        
                        IfInString, A_loopfield, :%A_space%
                        {
                                IfNotInString,A_LoopField, Seat
                                        continue
                        }

                        if A_loopfield  !=
                        {
                                if A_loopfield != %A_space%
                                {
                                        IfNotInString, A_loopfield, is the button
                                        {
                                                IfNotInString, A_loopfield, (Real Money)
                                                {
                                                        IfNotInString, A_loopfield, Texas Hold'em - 
                                                        { 
                                                                IfNotInString, A_loopfield, Hand History for Game
                                                                {
                                                                        IfNotInString, A_loopfield, #Game no :
                                                                        {
                                                                                IfNotInString, A_loopfield, Game #
                                                                                {
                                                                                        IfNotInString, A_loopfield, wins the pot (
                                                                                        {
                                                                                                IfNotInString, A_loopfield, Dealing down cards
                                                                                                {
                                                                                                        IfNotInString, A_Loopfield, >You have options at
                                                                                                        {
                                                                                                                IfNotInString, A_Loopfield, The time at which hand ended
                                                                                                                {
                                                                                                                        StringLeft, first, A_loopfield, 2
                                                                                                                        if first != %A_space%(
                                                                                                                        {                                               
                                                                                                                                if(foldCount > 0)
                                                                                                                                {
                                                                                                                                        foldText = %foldCount% fold
                                                                                                                                        if foldCount > 1
                                                                                                                                        foldText = %foldText%s
                                                                                                                                        
                                                                                                                                        Gui, 3:Add, Text, xm c%foldColor% Section italic gMoveToTable, %foldText%
                                                                                                                                        foldCount = 0
                                                                                                                                }
                                                                                                                        }
                                                                                                                                                                                                                                        
                                                                                                                color= %textColor%
                                                                                                                IfInString, A_loopfield, %a_space%bets%a_space%
                                                                                                                                                                        color=%betColor%
                                                                                                                IfInString, A_loopfield, %a_space%raises%a_space%
                                                                                                                        color=%raiseColor%
                
                                                                                                                Gui, 3:Add, Text, xm c%Color% Section gMoveToTable, %a_loopfield%
                                                                                                                }                                                                                       
                                                                                                        }
                                                                                                }
                                                                                        }
                                                                                }
                                                                        }
                                                                }                       
                                                        }
                                                }
                                        }       
                                }       
                        }
                }
                IfNotInString, used, %card%
                {
                        Loop, parse, card
                        {
                                StringLeft, file, card, 2
                                Gui, 3:Add, Picture, ys, gfx\%file%.bmp
                                StringTrimLeft, card, card, 2                           
                        }
                        if cards0 > 0
                                used = %used% %card%
                }
                
                StringTrimLeft, hh%next%, hh%next%, count + 1
        }       
        used =
        
        Gui, 3:Color, %backgroundColor%

        WinGetPos,x, y, , , BigPotGrabber
        Gui, 3:show, x%x% y%y%, Big Pot HH
        
        WinGetPos,x, y, w, , Big Pot HH
        x -= w
        Gui, 3:Show, x%x% y%y%, Big Pot HH
        
        if AlwaysOnTop
                WinSet, AlwaysOnTop, on, Big Pot HH
        
        WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH           
}

;----reads the Stars HH folder to spot big pots
SpotStars()
{
        global starsHistoryPath
        global threshold
        global grabbedHands

        FileList =
        
        Loop, %starsHistoryPath%\*.*
                FileList = %FileList%%A_LoopFileName%`n

        Loop, parse, FileList, `n
        {
                if A_LoopField =
                        continue
                
                ;---- get table name from file title
                StringTrimLeft, table, a_loopfield, InStr(a_loopfield, " ")
                StringTrimRight, table, table, StrLen(table) - InStr(table, " - ") + 1

                ;---- get bb amount from file title
                StringTrimLeft, bb, a_loopfield, InStr(a_loopfield, "-$") +1
                StringTrimRight, bb, bb, StrLen(bb) - InStr(bb, " ") + 1
                
                ;---- read content of file and split into individual hands
                FileRead, content, %starsHistoryPath%\%A_LoopField%
                
                StringReplace, newcontent, content, `r`n`r`n`r`n`r`n, §, All
                StringSplit, hand, newcontent, §

                Loop, %hand0%
                {
                        current := hand%a_index%
                        if current =
                                continue
                        
                        ;---- read hand number, proceed if not already in list
                        StringGetPos, number, current, :
                        StringLeft, number, current, number

                        Loop, Parse, GrabbedHands, `n
                        {
                                if (number = A_LoopField)
                                {
                                        AlreadyGrabbed = 1
                                        break
                                }
                        }

                        if (AlreadyGrabbed != 1)
                        {
                                s = Read hand %number%
                                Debug(s)

                                GrabbedHands = %number%`n%GrabbedHands%

                                ;--- read pot size, add to list if big
                                StringGetPos, start, current, Total pot $
                                StringGetPos, count, current, | Rake $
                                start += 12
                                count -= start                  
                
                                StringMid, amount, current, start, count
                                
                                if(amount > (bb*threshold))
                                {       
                                        AddToList("stars", amount, table, current)
                                        Debug(current)
                                }
                        }
                AlreadyGrabbed = 0                                      
                }
        }
}

;----reads the FTP HH folder to spot big pots
SpotFtp()
{
        global ftpHistoryPath
        global threshold
        global grabbedHands

        FileList =
        
        Loop, %ftpHistoryPath%\*.*
                FileList = %FileList%%A_LoopFileName%`n

        Loop, parse, FileList, `n
        {
                if A_LoopField =
                        continue
                
                ;---- get table name from file title
                StringTrimLeft, table, a_loopfield, InStr(a_loopfield, " ")
                StringTrimRight, table, table, StrLen(table) - InStr(table, " - ") + 1

                ;---- get bb amount from file title
                StringTrimLeft, bb, a_loopfield, InStr(a_loopfield, "-$") +1
                StringTrimRight, bb, bb, StrLen(bb) - InStr(bb, " ") + 1
                
                ;---- read content of file and split into individual hands
                FileRead, content, %ftpHistoryPath%\%A_LoopField%
                
                StringReplace, newcontent, content, `r`n`r`n`r`n`r`n, §, All
                StringSplit, hand, newcontent, §

                Loop, %hand0%
                {
                        current := hand%a_index%
                        if current =
                                continue

                        
                        ;---- read hand number, proceed if not already in list
                        StringGetPos, number, current, :
                        StringLeft, number, current, number

                        Loop, Parse, GrabbedHands, `n
                        {
                                if (number = A_LoopField)
                                {
                                        AlreadyGrabbed = 1
                                        break
                                }
                        }

                        if (AlreadyGrabbed != 1)
                        {
                                s = Read hand %number%
                                Debug(s)

                                GrabbedHands = %number%`n%GrabbedHands%

                                ;--- read pot size, add to list if big
                                StringGetPos, start, current, Total pot $
                                StringGetPos, count, current, | Rake $
                                start += 12
                                count -= start                  
                
                                StringMid, amount, current, start, count
                                
                                if(amount > (bb*threshold))
                                {       
                                        AddToList("ftp", amount, table, current)
                                        Debug(current)
                                }
                        }
                AlreadyGrabbed = 0                                      
                }
        }
}

;--- removes unneeded lines from the Stars/FTP HH
TrimStarsFTP(hh)
{
        str =
        Loop, parse, hh, `n
        {       
                if (A_index > 1)
                {                       
                        IfNotInString, A_loopfield, Table '
                        {
                                IfNotInString, A_loopfield, is sitting out
                                {
                                        IfNotInString, A_loopfield, The button is in seat #
                                        {
                                                IfNotInString, A_LoopField, *** HOLE CARDS ***
                                                {
                                                        IfNotInString, A_LoopField, Board [
                                                        {
                                                                IfNotInString, A_Loopfield, %a_space%folded%a_space%
                                                                {
                                                                        IfNotInString, A_Loopfield, (folded)
                                                                        {
                                                                                IfNotInString, A_Loopfield, said,
                                                                                {
                                                                                        IfNotInString, A_Loopfield, %a_space%adds%a_space%
                                                                                        {
                                                                                                IfNotInString, A_Loopfield, %a_space%is feeling%a_space%
                                                                                                {
                                                                                                        IfNotInString, A_Loopfield, %a_space%is feeling%a_space%
                                                                                                        {                                                                                               
                                                                                                                str = %str%%A_LoopField%`n
                                                                                                        }
                                                                                                }
                                                                                        }
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }       
                                }
                        }                       
                }
        }
        return str
}

;--- converts Stars HH using card images etc
ConvertStars(hh)
{       
        global
        Gui, 3:Destroy
        Gui, 3:Margin, 1, 1     
        Gui, 3:Font, s%fontSize%

        StringSplit, hh,hh,[

        Loop, %hh0%
        {
                foldCount = 0
                next := A_index + 1
                str := hh%A_index%

                StringGetPos, count, hh%next%, ]
                
                StringLeft, card, hh%next%, count
                StringSplit, cards, card, %a_space%

                Loop, Parse, str, `r`n
                {
                        ifInString, A_loopfield, %a_space%shows%a_space%
                        {                               
                                cards0 := 0
                                continue
                        }

                        ifInString, A_loopfield, %a_space%folds
                        {
                                foldCount++
                                continue
                        }

                        if A_loopfield  !=
                        {
                                if A_loopfield != %A_space%
                                {
                                        IfNotInString, A_loopfield, wins the pot (
                                        {
                                                StringLeft, first, A_loopfield, 2
                                                if first != %A_space%(
                                                {                                               
                                                        if(foldCount > 0)
                                                        {
                                                                foldText = %foldCount% fold
                                                                if foldCount > 1
                                                                        foldText = %foldText%s
                                                                Gui, 3:Add, Text, xm c%foldColor% Section italic gMoveToTable, %foldText%
                                                                foldCount = 0
                                                        }
                                                        color= %textColor%
                                                        IfInString, A_loopfield, %a_space%bets%a_space%
                                                                color=%betColor%
                                                        IfInString, A_loopfield, %a_space%raises%a_space%
                                                                color=%raiseColor%

                                                Gui, 3:Add, Text, xm c%Color% Section gMoveToTable, %a_loopfield%       
                                                }
                                        }
                                }
                        }
                }       

                IfNotInString, used, %card%
                {
                        Loop, %cards0%
                        {               
                                file := cards%A_index%
                        
                                        Gui, 3:Add, Picture, ys gMoveToTable, gfx\%file%.bmp
                        }
                        if cards0 > 0
                                used = %used% %card%
                }
                
                StringTrimLeft, hh%next%, hh%next%, count + 1
        }

        used =
        
        Gui, 3:Color, %backgroundColor%

        WinGetPos,x, y, , , BigPotGrabber
        Gui, 3:show, x%x% y%y%, Big Pot HH
        
        WinGetPos,x, y, w, , Big Pot HH
        x -= w
        Gui, 3:Show, x%x% y%y%, Big Pot HH

        if AlwaysOnTop
                WinSet, AlwaysOnTop, on, Big Pot HH
        
        WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH
}

ConvertFTP(hh)
{
        global
        Gui, 3:Destroy
        Gui, 3:Margin, 1, 1
        Gui, 3:Font, s%fontSize%

        StringSplit, hh,hh,[

        Loop, %hh0%
        {
                foldCount = 0
                next := A_index + 1
                str := hh%A_index%

                StringGetPos, count, hh%next%, ]
                
                StringLeft, card, hh%next%, count
                StringSplit, cards, card, %a_space%

                Loop, Parse, str, `r`n
                {
                        ifInString, A_loopfield, %a_space%shows%a_space%
                        {                               
                                cards0 := 0
                                continue
                        }

                        ifInString, A_loopfield, %a_space%folds
                        {
                                foldCount++
                                continue
                        }
                        
                        IfInString, A_loopfield, :%A_space%
                        {
                                IfNotInString,A_LoopField, Seat
                                        continue
                        }

                        if A_loopfield  !=
                        {
                                if A_loopfield != %A_space%
                                {
                                        IfNotInString, A_loopfield, wins the pot (
                                        {
                                                StringLeft, first, A_loopfield, 2
                                                if first != %A_space%(
                                                {                                               
                                                        if(foldCount > 0)
                                                        {
                                                                foldText = %foldCount% fold
                                                                if foldCount > 1
                                                                        foldText = %foldText%s
                                                                Gui, 3:Add, Text, xm c%foldColor% Section italic gMoveToTable, %foldText%
                                                                foldCount = 0
                                                        }
                                                        color= %textColor%
                                                        IfInString, A_loopfield, %a_space%bets%a_space%
                                                                color=%betColor%
                                                        IfInString, A_loopfield, %a_space%raises%a_space%
                                                                color=%raiseColor%

                                                Gui, 3:Add, Text, xm c%Color% Section gMoveToTable, %a_loopfield%       
                                                }
                                        }
                                }
                        }
                }       

                IfNotInString, used, %card%
                {
                        Loop, %cards0%
                        {               
                                file := cards%A_index%
                        
                                        Gui, 3:Add, Picture, ys gMoveToTable, gfx\%file%.bmp
                        }
                        if cards0 > 0
                                used = %used% %card%
                }
                
                StringTrimLeft, hh%next%, hh%next%, count + 1
        }

        used =
        
        Gui, 3:Color, %backgroundColor%

        WinGetPos,x, y, , , BigPotGrabber
        Gui, 3:show, x%x% y%y%, Big Pot HH
        
        WinGetPos,x, y, w, , Big Pot HH
        x -= w
        Gui, 3:Show, x%x% y%y%, Big Pot HH

        if AlwaysOnTop
                WinSet, AlwaysOnTop, on, Big Pot HH
        
        WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH

}


SpotPrima()
{

        global GrabbedHands
        global threshold
        global primaName

        WinGet, tables, list, ahk_class POPUP_INT_DLG_WINDOW

        Loop, %tables%
        {       
                table := tables%a_index%
                
                WinGetTitle, title, ahk_id %table%

                ;read bb amount from title
                StringGetPos, start, title, $, R1
                start +=2
                StringGetPos, count, title, %a_space%, , (start - 1)
                count -= start
                count ++
                StringMid, bb, title, start, %count%

                ;read the name of the table
                StringGetPos, pos, title, %a_space%[
                StringLeft, tableName, title, pos
                StringGetPos, pos, tableName, %a_space%, R1
                StringTrimLeft, tableName, tableName, pos + 1
                                
                ;read chat box and split into individual hands
                ControlGetText, hh, RichEdit20W3, ahk_id%table%

                ;don't spot pots if we're not seated
                IfNotInString, hh, %primaName%
                        continue

                StringReplace, hh, hh, > Game #%a_space%, §, , all
                StringSplit, hh, hh, §

                Loop, %hh0%
                {                       
                        current := hh%a_index%
                        IfInString, current, Welcome to
                                continue

                        ;---- read hand number, proceed if not already in list
                        StringLeft, number, current, 13
                        
                        Loop, Parse, GrabbedHands, `n
                        {
                                if (number = A_LoopField)
                                {
                                        AlreadyGrabbed = 1
                                        break
                                }
                        }       

                        if (AlreadyGrabbed != 1)
                        {                               
                                s = Read hand %number%
                                Debug(s)                
                                
                                current = %nextblinds%%current%

                                nextBlinds =
                                
                                StringGetPos, start, current, posted small blind, R1
                                StringLen, length, current
                                length -= start
                
                                StringRight, nextBlinds, current, length
                                StringTrimRight, current, current, length

                                StringGetPos, start, current, >, R1
                                StringLen, length, current
                                length -= start 
                                
                                StringRight, poster, current, length                    
                                StringTrimRight, current, current, length                       
                        
                                nextBlinds = %poster%%nextBlinds%

                                ;--- read pot size, add to list if big
                                StringGetPos, start, current, %a_space%wins $, R1
                                
                                start += 7                      
                                StringLen, length, current
                                length -= start

                                StringRight, amount, current, length
                                StringGetPos, pos, amount, %a_space%
                                
                                if pos > 0
                                        StringLeft, amount, amount, pos

                                StringGetPos, pos, amount, `n
                                
                                if pos > 0
                                        StringLeft, amount, amount, pos - 1

                                if(amount > (bb*threshold))
                                {                                       
                                        AddToList("prima", amount, tableName, current)
                                        Debug(current)
                                }
                                if amount
                                        GrabbedHands = %number%`n%GrabbedHands%         
                        }
                
                AlreadyGrabbed = 0                                      
                }
        }
}

;--- removes unneeded lines from the Prima HH
TrimPrima(hh)
{       
        str =
        Loop, parse, hh, `n
        {
                StringReplace, next, a_loopfield, >%a_space%, , all

                IfNotInString, next, starting.
                {                       
                        IfNotInString, next, sits down
                        {
                                IfNotInString, next, will be dealt in after the dealer button has passed
                                {
                                        IfNotInString, next, seconds to respond
                                        {
                                                IfNotInString, next, left the table
                                                {
                                                        IfNotInString, next, is waiting for the big blind to play
                                                        {
                                                                IfNotInString, next, has reconnected
                                                                {
                                                                        IfNotInString, next, is sitting out
                                                                        {
                                                                                IfNotInString, next, An action was taken on behalf of
                                                                                {
                                                                                        IfNotInString, next, to the table
                                                                                        {
                                                                                                str = %str%%next%`n
                                                                                        }
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }
                                }
                        }
                }
        }       
        return str
}

ConvertPrima(hh)
{
        global
        Gui, 3:Destroy
        Gui, 3:Margin, 1, 1
        Gui, 3:Font, s%fontSize%
        
        StringReplace, hh, hh, ($, $, All

        StringSplit, hh,hh,(
        
        Loop, %hh0%
        {
                foldCount = 0
                next := A_index + 1
                str := hh%A_index%

                StringGetPos, count, hh%next%, %a_space%)
        
                StringLeft, card, hh%next%, count
                StringReplace, card, card, 10, T, All   

                StringSplit, cards, card, %a_space%

                Loop, Parse, str, `r`n
                {
                        ifInString, A_loopfield, %a_space%folded
                        {
                                foldCount++
                                continue
                        }               

                        if A_loopfield  !=
                        {
                                if A_loopfield != %A_space%
                                {
                                        IfNotInString, A_loopfield, %a_space%wins%a_space% (
                                        {
                                                if(foldCount > 0)
                                                {
                                                        foldText = %foldCount% fold
                                                        if foldCount > 1
                                                                foldText = %foldText%s
                                                        Gui, 3:Add, Text, xm c%foldColor% Section italic gMoveToTable, %foldText%
                                                        foldCount = 0
                                                }

                                                color= %textColor%
                                                IfInString, A_loopfield, bet for
                                                        color=%betColor%
                                                IfInString, A_loopfield, raised for
                                                        color=%raiseColor%
                                                IfInString, A_loopfield, went all-in for
                                                        color=%raiseColor%

                                                Gui, 3:Add, Text, xm c%Color% Section gMoveToTable, %a_loopfield%       
                                        }
                                }
                        }
                }       

                Loop, %cards0%
                {
                        file := cards%A_index%
                        IfNotInString, used, %file%
                                Gui, 3:Add, Picture, ys gMoveToTable, gfx\%file%.bmp
                }
                if cards0 > 0
                        used = %used% %card%

                StringTrimLeft, hh%next%, hh%next%, count + 2
        }
        
        used = 
        Gui, 3:Color, %backgroundColor%

        WinGetPos,x, y, , , BigPotGrabber
        Gui, 3:show, x%x% y%y%, Big Pot HH
        
        WinGetPos,x, y, w, , Big Pot HH
        x -= w
        Gui, 3:Show, x%x% y%y%, Big Pot HH

        if AlwaysOnTop
                WinSet, AlwaysOnTop, on, Big Pot HH

        WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH   
}


InitList()
{
        global
        Gui, Add, ListView, r8 w210 gMyListView, $|Table|HH|Site
        LV_ModifyCol(3,0)
        LV_ModifyCol(4,0)
        Gui, Add, Button, Section gClear, Clear

        Gui, Add, Button, ys gCopy, Copy
        Gui, Add, Edit, gThreshold ys w50
        Gui, Add, UpDown, vThreshold gThreshold range1-10000, %threshold%

        Gui, Show, ,BigPotGrabber
        
        if listAlwaysOnTop
                WinSet, AlwaysOnTop, on, BigPotGrabber

        WinSet, TransColor, EEEEE1 %transparency%, BigPotGrabber
        WinMove, BigPotGrabber, , %posX%, %posY%
        return
}       

;--- "Copy"-button, copies selected HH to the clipboard
Copy:
sel:=LV_GetNext()

LV_GetText(hh, sel, 3)
CLipboard := hh
return

;--- "Clear"-button, removes all HH's from the list
Clear:
LV_Delete()
return

;---- "Threshold"-spinner, adjusts the threshold
Threshold:
Gui, Submit, NoHide
return

;--- handles clicking in the list
MyListView:
if A_GuiEvent = DoubleClick
{
        LV_GetText(table, A_EventInfo, 2)
        LV_GetText(hh, A_EventInfo, 3)
        LV_GetText(site, A_EventInfo, 4)
        
        row := A_EventInfo

        if (convert = 1)
        {
                if (site = "stars")
                        ConvertStars(trimStarsFTP(hh))
                if (site = "ftp")
                        ConvertFTP(trimStarsFTP(hh))
                if (site = "party")
                        ConvertParty(trimParty(hh))
                if (site = "prima")
                        ConvertPrima(trimPrima(hh))
                if (site = "ipoker")
                        ConvertIpoker(hh)
                if (site = "crypto")
                        ConvertCrypto(trimCrypto(hh))
        }

        else
        {
                if (trim = 1)
                {
                        if (site = "stars" or site = "ftp")
                                hh := trimStarsFTP(hh)
                        if (site = "party")
                                hh := trimParty(hh)
                        if (site = "prima")
                                hh := trimPrima(hh)
                        if (site = "crypto")
                                hh := trimCrypto(hh)
                }

                WinGetPos,x, y, , , BigPotGrabber
                
                Gui, 2:Destroy
                Gui, 2:Font, s%fontSize%
                Gui, 2:Color, %backgroundColor%
                Gui, 2:Add, Text, c%textColor% gMoveToTable, %hh%
                Gui, 2:Show, x%x% y%y%, Big Pot HH

                WinGetPos,x, y, w, , Big Pot HH
                x -= w
                Gui, 2:Show, x%x% y%y%, Big Pot HH
                
                if AlwaysOnTop
                        WinSet, AlwaysOnTop, on, Big Pot HH

                WinSet, TransColor, EEEEE1 %transparency%, Big Pot HH   
        }
}

if A_GuiEvent = R
{
        LV_Delete(A_EventInfo)
}
return

GuiClose:
ExitApp

2GuiClose:
3GuiClose:
if (autoRemoveHand = 1)
{       
        Gui, 1:default
        if (row > 0)
                LV_Delete(row)
        row := 0
}
Gui, 2:Destroy
Gui, 3:Destroy
return

;-----Adds a big pot entry to the gui
AddToList(site, amount, table, hh)
{
        global
        IfWinNotExist, Big Pot HH
        {
                if (autoOpenHH = 1)
                {
                        if (convert = 1)
                        {
                                if (site = "stars")
                                        ConvertStars(trimStarsFTP(hh))
                                if (site = "ftp")
                                        ConvertFTP(trimStarsFTP(hh))
                                if (site = "party")
                                        ConvertParty(trimParty(hh))
                                if (site = "prima")
                                        ConvertPrima(trimPrima(hh))
                                if (site = "ipoker")
                                  ConvertIpoker(hh)
                                if (site = "crypto")
                                  ConvertCrypto(trimCrypto(hh))
                        }
                        else            
                        {
                                if (trim = 1)
                                {
                                        if (site = "stars" or site = "ftp")