View Single Post
  #1  
Old 08-16-2006, 09:33 PM
TheIrishThug TheIrishThug is offline
Senior Member
 
Join Date: Jan 2005
Location: Belligerent and numerous
Posts: 1,819
Default The Absolute Solution - Datamining

The Absolute Solution

This program will datamining Absolute Poker for you.
Hand Histories are saved as [Date]_[Table].txt. The hand histories will default to save into the same folder that the program is saved, this can be changed by using the "Select Save Folder" button.
When "Only Observed Hands" is selected, any hand you play in will be skipped over.
As a hand is loaded, the vital information will be added to the list on the window. Hands are sorted by hand number, therefore, the last hand loaded may not be the last hand on the list. Double clicking on a hand that is listed on the window will bring up a second window with the text of that hand.

Note:
Opening and Closing tables.
This is not part of the program yet, but I will be working on it. I still need to look into the iWitness code and see what will need to be changed.

The following is the AutoHotkey code. You will not need to change any parts of the text. Copy the text and paste it into Notepad. Save the file as [name].ahk (make sure "Save as type:" is All Files so that the .ahk will not be followed by a .txt).
<font class="small">Code:</font><hr /><pre>
; _____________________
; /
; The Absolute Solution
; By TheIrishThug
; Date: 8/16/2006
; v0.5
; \_____________________

; ------ Check AHK version
ahk_version = 1.0.44.09
if A_AhkVersion &lt; %ahk_version%
{
msgbox, 4, , % "This script needs AutoHotkey version " . ahk_version . " or newer (you are using version" . A_AhkVersion . ")."
. "`nScript will exit.`n`nGo to web page and download new version now?"
IfMsgBox, Yes
Run, http://www.autohotkey.com
ExitApp
}

DetectHiddenWindows, On
OnMessage(0x24, "WM_GETMINMAXINFO")
; ------ Variables
/*
[Folder]
LastSaved=
[Gui]
MainX=
MainY=
MainH=400
MainW=275
*/
; ------
; ------ Collect Variables
IniRead, LastSavedFolder, %A_ScriptFullPath%, Folder, LastSaved, %A_ScriptDir%
IniRead, LastGuiX, %A_ScriptFullPath%, Gui, MainX, Center
IniRead, LastGuiY, %A_ScriptFullPath%, Gui, MainY, Center
IniRead, LastGuiH, %A_ScriptFullPath%, Gui, MainH, 400
IniRead, LastGuiW, %A_ScriptFullPath%, Gui, MainW, 275
IfEqual, LastSavedFolder,
LastSavedFolder := A_ScriptDir
FormatTime, TimeStamp, , MM-dd-yy
BaseFileName := SwitchDirSting(LastSavedFolder . "\" . TimeStamp . "_", "Convert")
HandsSaved = 0
MyHandsSkipped = 0
SetTimer, Mine, 180000
SetTimer, Mine, Off
; ------ Gui
Gui, +Resize -Maximize
ListViewH := LastGuiH - 120
ListViewW := LastGuiW - 30
Gui, Add, ListView, xp+8 yp+10 w%ListViewW% h%ListViewH% -Hdr Sort vTheListView, Hand Number|Winner|Pot|Table
LV_ModifyCol(4, 0)
GapAfterListView := ListViewH +10
Gui, Add, CheckBox, xp+37 yp+%GapAfterListView% vOnlyObservedHands, Only Observed Hands
Gui, Add, Button, xp-35 yp+30 w70 gStartStopMine Hidden, Stop
Gui, Add, Button, xp yp w70 gStartStopMine, Start
Gui, Add, Button, xp+80 yp-5 gSelectFolder, Select`nSave Folder
Gui, Add, Button, xp+85 yp+5 w70 gClose_Gui, Close
Gui, Show, x%LastGuiX% y%LastGuiY% w%LastGuiW% h%LastGuiH%, The Absolute Solution
Return

Close_Gui:
GuiClose:
MouseGetPos, , , WinID
WinGetPos, LastGuiX, LastGuiY, LastGuiW, LastGuiH, ahk_id %WinID%
IniWrite, %LastGuiX%, %A_ScriptFullPath%, Gui, MainX
IniWrite, %LastGuiY%, %A_ScriptFullPath%, Gui, MainY
IniWrite, %LastGuiH%, %A_ScriptFullPath%, Gui, MainH
IniWrite, %LastGuiW%, %A_ScriptFullPath%, Gui, MainW
IniWrite, %LastSavedFolder%, %A_ScriptFullPath%, Folder, LastSaved
ExitApp
Return

SelectFolder:
FileSelectFolder, LastSavedFolder, , 1, The Absolute Solution
IniWrite, %LastSavedFolder%, %A_ScriptFullPath%, Folder, LastSaved
BaseFileName := SwitchDirSting(LastSavedFolder . "\" . TimeStamp . "_", "Convert")
Return

ListClick:
If A_GuiEvent = DoubleClick
{
ControlGet, GuiSelected, List, Count Focused, SysListView321, The Absolute Solution ahk_class AutoHotkeyGUI
If GuiSelected != 0
{
ControlGet, GuiRowText, List, Focused, SysListView321, The Absolute Solution ahk_class AutoHotkeyGUI
StringSplit, GuiRowArray, GuiRowText, %A_Tab%
GuiHand := GuiRowArray1
GuiTable := GuiRowArray4
RecordHand = 0
TextOfHand := ""
fname := SwitchDirSting(BaseFileName . GuiTable . ".txt", "UnConvert")
Loop, Read, %fname%
{
IfInString, A_LoopReadLine, %GuiHand%
RecordHand = 1
If RecordHand = 1
{
If (InStr(A_LoopReadLine, "Stage #") = 1 AND InStr(A_LoopReadLine, GuiHand) = 0)
Break
TextOfHand := TextOfHand . A_LoopReadLine . "`n"
}
}
Gui, 2:Font, S9 Bold
Gui, 2:+Owner
Gui, 2:Add, Text, x6 y6, Hand Viewer
Gui, 2:Font, S8 Norm
Gui, 2:Add, Edit, xp yp+30 w300 h200 vHandEdit +ReadOnly, %TextOfHand%
Gui, 2:Add, Button, xp+15 yp+215 gHandViewerClose, Close
Gui, 2:Add, Button, xp+50 yp gHandViewerCopy, Copy Hand
GuiControl, 2: Focus, HandViewerCopy
Gui, 2:Show, , Absolute Hand Viewer
}
}
Return

GuiSize:
Anchor("TheListView", "wh")
Anchor("OnlyObservedHands", "y")
Anchor("Stop", "y")
Anchor("Start", "y")
Anchor("Select`nSave Folder", "y")
Anchor("Close", "y")
Return

StartStopMine:
GuiControlGet, ControlClicked, , %A_GuiControl%
If ControlClicked = Stop
{
SetTimer, Mine, Off
GuiControl, Show, Start
GuiControl, Hide, Stop
}
Else
{
SetTimer, Mine, On
GuiControl, Show, Stop
GuiControl, Hide, Start
If HandsSaved = 0
GoTo Mine
}
Return

Mine:
Gui, Submit, NoHide
IfWinExist, Instant Hand History ahk_class Instant Hand History
{
Loop
{
IfWinNotExist, Instant Hand History ahk_class Instant Hand History
break
ControlGet, Table, Choice, , ComboBox1
IfNotInString, Table, All Poker Tables
{
Control, Choose, 1, ComboBox1
Sleep 200
}
ControlFocus, SysListView321
ControlGet, RowNumberOfFocusedOfHand, List, Count Focused, SysListView321, Instant Hand History ahk_class Instant Hand History
ControlGet, NumberOfHandsOfIHH, List, Count, SysListView321, Instant Hand History ahk_class Instant Hand History
If ( HandsSaved + MyHandsSkipped = 0 )
ControlSend, SysListView321, {Home}, Instant Hand History ahk_class Instant Hand History
Else If ( RowNumberOfFocusedOfHand != NumberOfHandsOfIHH )
ControlSend, SysListView321, {Down}, Instant Hand History ahk_class Instant Hand History
If (NumberOfHandsOfIHH = HandsSaved + MyHandsSkipped)
Break
HandMyHand := ""
ControlGet, RowText, List, Focused, SysListView321, Instant Hand History ahk_class Instant Hand History
StringSplit, RowArray, RowText, %A_Tab%
HandNumber := RowArray1
HandTable := RowArray2
HandMyHand := RowArray3
HandWinner := RowArray4
HandPot := RowArray5
ControlGet, ColText, List, Col1, SysListView321, The Absolute Solution ahk_class AutoHotkeyGUI
IfInString, ColText, %HandNumber%
Continue
If HandTable Contains /,\,,:,*,?,&lt;,&gt;,|
HandTable := SpecialChr(HandTable)
Sleep 200
If ((OnlyObservedHands = 1 AND HandMyHand = "") Or OnlyObservedHands = 0)
{
ControlGetText, HandText, Edit1
FileName := SwitchDirSting(BaseFileName . HandTable . ".txt", "UnConvert")
FileAppend, %HandText%`n`n, %Filename%
StringReplace, HandPot, HandPot, $,
LV_Add(Col1, HandNumber, HandWinner, "$" . HandPot, HandTable)
LV_ModifyCol()
LV_ModifyCol(4, 0)
HandsSaved++
}
Else
MyHandsSkipped++
}
FormatTime, tempTimeStamp, , MM-dd-yy
IfNotEqual, TimeStamp, %tempTimeStamp%
{
TimeStamp := tempTimeStamp
BaseFileName := SwitchDirSting(LastSavedFolder . "\" . TimeStamp . "_", "Convert")
}
}
Return

; ------ Gui 2 Controls
HandViewerClose:
Gui, 2estroy
Return

HandViewerCopy:
ClipBoard := TextOfHand
Return

; ------ Functions
SpecialChr(Word)
{
IfInString, Word, "/"
StringReplace, Word, Word, "/", , All
IfInString, Word, "\"
StringReplace, Word, Word, "\", , All
IfInString, Word, ":"
StringReplace, Word, Word, ":", , All
IfInString, Word, "*"
StringReplace, Word, Word, "*", , All
IfInString, Word, "?"
StringReplace, Word, Word, "?", , All
IfInString, Word, "&lt;"
StringReplace, Word, Word, "&lt;", , All
IfInString, Word, "&gt;"
StringReplace, Word, Word, "&gt;", , All
IfInString, Word, "|"
StringReplace, Word, Word, "|", , All
Return Word
}

SwitchDirSting(PathIn, ConvertOrUnConvert)
{
If ConvertOrUnConvert = Convert
StringReplace, PathIn, PathIn, :\, ??
If ConvertOrUnConvert = UnConvert
StringReplace, PathIn, PathIn, ??, :\
Return PathIn
}

Anchor(ctrl, a, draw = false) { ; v3.2 by Titan
static pos
sig = `n%A_Gui%:%ctrl%=
If !InStr(pos, sig) {
GuiControlGet, p, Pos, %ctrl%
pos := pos . sig . px - A_GuiWidth . "/" . pw - A_GuiWidth . "/"
. py - A_GuiHeight . "/" . ph - A_GuiHeight . "/"
}
StringTrimLeft, p, pos, InStr(pos, sig) - 1 + StrLen(sig)
StringSplit, p, p, /
c = xwyh
Loop, Parse, c
If InStr(a, A_LoopField) {
If A_Index &lt; 3
e := p%A_Index% + A_GuiWidth
Else e := p%A_Index% + A_GuiHeight
m = %m%%A_LoopField%%e%
}
If draw
d = Draw
GuiControl, Move%d%, %ctrl%, %m%
}

WM_GETMINMAXINFO(wParam, lParam)
{
if not A_Gui ; No GUI window number, so it's not for a GUI window: do nothing.
return
; Alter the MINMAXINFO structure's ptMinTrackSize X and Y:
InsertIntegerAtAddress(275, lParam, 24, 4) ; X
InsertIntegerAtAddress(390, lParam, 28, 4) ; Y
return 0 ; MSDN: "If an application processes this message, it should return zero."
}

InsertIntegerAtAddress(pInteger, pAddress, pOffset = 0, pSize = 4)
{
mask := 0xFF ; This serves to isolate each byte, one by one.
Loop %pSize% ; Copy each byte in the integer into the structure as raw binary data.
{
DllCall("RtlFillMemory", UInt, pAddress + pOffset + A_Index - 1, UInt, 1
, UChar, (pInteger &amp; mask) &gt;&gt; 8 * (A_Index - 1))
mask := mask &lt;&lt; 8 ; Set it up for isolation of the next byte.
}
}
</pre><hr />
Reply With Quote