Open Side Menu Go to the Top
Register
Script: Mark Current Hand Script: Mark Current Hand

01-15-2011 , 09:17 AM
I solved it, default .ini is required:

Code:
[LogFolder]
postgresdb=
postgresuser=postgres
postgrespath=C:\Program Files (x86)\PostgreSQL\8.4\bin
FullTiltHHPath=C:\Program Files (x86)\Full Tilt Poker
StarsHHPath=C:\Program Files (x86)\Pokerstars02:39 31.07.2010
HK_sql=^F1
HK_mark=F1
Just save it as markhand.ini in your bin folder and when you run script for 1st time it will automatically popup settings window.

Thanks for quick update Max1mums!
Script: Mark Current Hand Quote
01-15-2011 , 10:37 AM
Sokol, old ini file should be deleted first i guess.
Script: Mark Current Hand Quote
01-15-2011 , 10:44 AM
Sure, but if we are gonna save it in PostgreSQL\8.4\bin folder it will replace old one, right?
Script: Mark Current Hand Quote
01-15-2011 , 11:06 AM
Seems that "Change Settings" option works well only 1st time- when we replace old markhand.ini with default one.
After that I am still unable to open "Change Settings" option..

I am going to test it in game..
Script: Mark Current Hand Quote
01-15-2011 , 12:22 PM
Script is working but unfortunately it imports wrong hands.

If it would be helpful to fix it here are my notes:
I marked 3 hands from 3 separate tables, 1 hand was correct hand (which I marked) and other 2 were hands dealt before the hand I marked.
I tried several times after that but with same result (most of imported hands were hands that was dealt earlier/before than marked one.)

SS from one of the testing imports:
Script: Mark Current Hand Quote
01-15-2011 , 02:52 PM
Sokol, doesn't happen to me, do you play rush tables? You can try searching and replacing "sleep,50" with "sleep,300"
Script: Mark Current Hand Quote
01-15-2011 , 04:38 PM
Hi, no I play regular SNGs. I"ll try to replace it.
Script: Mark Current Hand Quote
01-15-2011 , 06:19 PM
Same problem appears, most of imported hands were not the ones I marked..
any suggestion?
Script: Mark Current Hand Quote
01-17-2011 , 08:36 AM
any plans on making this availible for other sites then PS and FTP ?
Script: Mark Current Hand Quote
02-18-2011 , 03:32 AM
It took me a while to figure out how to set it up but it's really simple to set up, here's how I did it:

1. install autohotkey found here http://www.autohotkey.com/download/ (I used "Installer for AutoHotkey Basic")
2. copy and paste code from page 5 post #71 into a text file. (the code from other posts might work also but I used the code from post #71)
3. save and rename that text file as markhand.ahk (not markhand.ahk.txt)
4. put the markhand.ahk file into the root folder so its path is C:\markhand.ahk
5. double click on the file, or right click on it and click "run script"
6. fill in the settings on the markhand gui that pops up
7. click ok

my settings:

postgres binary folder: C:\Program Files\PostgreSQL\8.4\bin
full tilt hh folder: C:\Program Files\Full Tilt Poker\HandHistory\screenname
postgres user name: postgres
postgres database: holdemmanager

also fill in both of the hotkey settings and pokerstars hh folder if you will be using it on there

Last edited by matt57225; 02-18-2011 at 04:02 AM.
Script: Mark Current Hand Quote
02-18-2011 , 04:01 AM
Quote:
Originally Posted by Max1mums
Sokol, doesn't happen to me, do you play rush tables? You can try searching and replacing "sleep,50" with "sleep,300"
I play rush and its marking the wrong hands, sometimes its marking the hand right before or sometimes its marking the hand a few hands before the one I want. I tried changing the sleep,50 lines to sleep,300 and am still having the same problem.

Last edited by matt57225; 02-18-2011 at 04:08 AM.
Script: Mark Current Hand Quote
02-18-2011 , 04:26 AM
here is a version for rush cashgames

Code:
#noenv
#SingleInstance, Force
SetWinDelay,-1
settitlematchmode,2

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%


IniRead, FullTiltHHLogFolderPath, %thisahk%.ini, LogFolder, FullTiltHHPath, %A_Space%
IniRead, PostgresLogPath, %thisahk%.ini, LogFolder, postgrespath, %A_Space%
IniRead, postgresuser, %thisahk%.ini, LogFolder, postgresuser, %A_Space%
IniRead, postgresdb, %thisahk%.ini, LogFolder, postgresdb, %A_Space%
StarsHHLogFolderPath=C:\

If ( !FullTiltHHLogFolderPath or !PostgresLogPath or !postgresuser or !postgresdb)
{
   Gui, Add, Text, x10  y5 w120 h20 Center, Select Folder Location
   Gui, Add, Text, x140 y5 w150 h20 Center, Folder Location
   Gui, Add, Button, x5 y20 w150 h20 gPostgresBinFolderSelect center, Postgres Binary Folder
   Gui, Add, Edit, x160 y20 w520 h20 vPostgresLogpath, %PostgresLogpath%
   Gui, Add, Button,  x5 y40 w150 h20 gFullTiltHHFolderSelect   center, Full Tilt HH Folder
   Gui, Add, Edit, x160 y40 w520 h20 vFullTiltHHLogFolderPath, %FullTiltHHLogFolderPath%
   
   Gui, Add, Text, x5  y120 w150 h20 right, Postgres User Name:
   Gui, Add, Edit, x160 y120 w100 h20 vpostgresuser, %postgresuser%
   Gui, Add, Text, x5  y140 w150 h20 right,  Postgres Database:
   Gui, Add, Edit, x160 y140 w100 h20 vpostgresdb, %postgresdb%
   Gui, Add, Button, w40 h30, OK  ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Markhand 
return
ButtonOK:
GuiClose:
GuiEscape:
Gui, Submit
IniWrite, %postgresdb%, %thisahk%.ini, LogFolder, postgresdb
IniWrite, %postgresuser%, %thisahk%.ini, LogFolder, postgresuser
IniWrite, %PostgresLogPath%, %thisahk%.ini, LogFolder, postgrespath
IniWrite, %FullTiltHHLogFolderPath%, %thisahk%.ini, LogFolder, FullTiltHHPath
return
}


IfExist, gamenumbers.txt
{
MsgBox, 4,, Delete existing file gamenumbers.txt? (press Yes or No)
IfMsgBox Yes
    FileDelete, gamenumbers.txt
}
settimer,checksize,100
return


^2::
Suspend
Return

F1::
winget,id,id,A
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
site=Stars
dir:=StarsHHLogFolderPath
}
else
if class=QWidget
{
site=FullTilt
dir:=FullTiltHHLogFolderPath
}
else
site=
if site
{
 filename:=HHFile(id, dir ,site) 
 fileread,tempstr,%filename%
 sleep,50
 FileGetSize, FileSize, % filename
 if !FileSize
 FileSize:=0
 listadd(filelist, id . "-" . FileSize)
}
return

^F1::
IfExist, temp.txt
FileDelete, temp.txt
IfExist, temp.bat
FileDelete, temp.bat
loop gamenumbers.*
FileRead, numbers, %A_LoopFileName%
if numbers
{
sql1=Update pokerhands
sql2=Set mark_id = 1
sql3=Where gamenumber = 
sql4=AND handtimestamp > localtimestamp - interval '1 days';
sql5=Update pokerhands_hero
Loop, Parse, numbers, `n,
{
if A_loopField
{
FileAppend, %sql1% %sql2% %sql3% %A_loopField% %sql4%`n, temp.txt
FileAppend, %sql5% %sql2% %sql3% %A_loopField% %sql4%`n, temp.txt
}
}
FileAppend, "%PostgresLogPath%\psql.exe"%A_space%"%postgresdb%"%A_space%"%postgresuser%"%A_space%0<"%A_ScriptDir%\temp.txt"`r`npause`n, temp.bat
run temp.bat
}
else
msgbox, gamenumbers.txt file doesn't exist or file is empty.
return
;-----------------------------------------------------------------------------------------------------
checksize:
Loop, Parse, filelist, `,
{
 stringsplit,tab,A_loopField,-
 wingetclass,class,ahk_id%tab1%
 if class=PokerStarsTableFrameClass
 {
 site=Stars
 dir:=StarsHHLogFolderPath
 }
 else
 if class=QWidget
 {
 site=FullTilt
 dir:=FullTiltHHLogFolderPath
 }
 filename:=HHFile(tab1, dir ,site) 
 fileread,tempstr,%filename%
 sleep,50
 FileGetSize, FileSize, % filename
 if FileSize
 if FileSize!=%tab2%
 {
  num:=gethhnumber(tab1,site)
  FileAppend, %num%`n, gamenumbers.txt
  listDelItem(filelist, A_loopField)  
 }
}
return
;-----------------------------------------------------------------------------------------------------
gethhnumber(winid,site)
{
global StarsHHLogFolderPath,FullTiltHHLogFolderPath
if site=Stars
path=%StarsHHLogFolderPath%
else
path=%FullTiltHHLogFolderPath%
hh:=LastHH(winid,path,site)
Loop, Parse, hh, `n
{
 if instr(A_loopfield,"Game #")
 {
  stringtrimleft,num,A_loopfield,instr(A_loopfield,"#")
  stringleft,num,num,instr(num,":")-1
  break
 }
}
return num
}
;-----------------------------------------------------------------------------------------------------
HHFile(win, dir, site) {
if site=Stars
ext=HH
else
ext=FT
title := WinGetTitle(win)
if !(instr(title,"Tournament")>0 OR instr(title,"Sit & Go")>0 OR instr(title,"Sit&Go")>0 OR instr(title,"table")>0 OR instr(title,"Satellite")>0) 
{
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(a_now, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
}
else
if site=Stars
{
 stringtrimleft,file,title,instr(title,"Tournament")+10
 stringleft,file,file,InStr(file, A_space)-1
}
else
{
 stringtrimleft,file,title,instr(title,"(")-1
 stringleft,file,file,InStr(file, "-")-2
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)>0 & !instr(A_LoopFileName,"Summary")>0
return dir "\" A_LoopFileName
}
EnvAdd, date, -1, d
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(date, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)
return dir "\" A_LoopFileName
}
EnvAdd, date, +1, d
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(date, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)
return dir "\" A_LoopFileName
}
}
return
;-----------------------------------------------------------------------------------------------------
LastHH(win, dir, site) {
wingettitle,title,ahk_id%win%
stringtrimleft,hero,title,instr(title,A_space,"",0)
heroaction1:=hero . A_space . "calls"
heroaction2:=hero . A_space . "bets"
heroaction3:=hero . A_space . "raises"
if site=Stars
game=PokerStars Game #
else
game=Full Tilt Poker Game #
file@name:=HHFile(win, dir ,site) 
fileread,tempstr,%file@name%
sleep,50
FileRead, hh, %file@name%
if !instr(hh,"seat")
{
FileGetSize file@size, %file@name%
FileRead file@buffer, %file@name%
VarSetCapacity(hh, file@size / 2 + 1, 0)
r := DllCall("WideCharToMultiByte"
      , "UInt", 0      ; CodePage: CP_ACP=0 (current Ansi), CP_UTF7=65000, CP_UTF8=65001
      , "UInt", 0      ; dwFlags
      , "Str", file@buffer      ; LPCWSTR lpWideCharStr
      , "Int", file@size / 2      ; cchWideChar: -1=null terminated
      , "Str", hh      ; LPSTR lpMultiByteStr
      , "Int", file@size / 2 + 1      ; cbMultiByte: 0 to get required size
      , "UInt",0      ; LPCSTR lpDefaultChar
      , "UInt", 0)      ; LPBOOL lpUsedDefaultChar
}
;StringTrimLeft, hh, hh, InStr(hh, game, "", 0)-1
;if instr(hh,"SUMMARY")
;Stringleft, hh, hh, InStr(hh, "*** SUMMARY", "", 0)-1
loop
{
if instr(hh,"game")
{
 StringTrimLeft, temphhnum, hh, InStr(hh, game, "", 0)-1
 if !instr(temphhnum,"*** HOLE")
 StringLeft, hh, hh, InStr(hh, game, "", 0)-1
 else
 {
  StringTrimLeft, temphh, hh, InStr(hh, "*** HOLE","",0)-1
  StringLeft, temphh, temphh, InStr(temphh, "***","",instr(temphh,"`n","",instr(temphh,"*** HOLE")))
  if (instr(temphh,heroaction1)>0) or (instr(temphh,heroaction2)>0) or (instr(temphh,heroaction3)>0)
  {
  hh:=temphhnum
  break
  }
  else
  StringLeft, hh, hh, InStr(hh, game, "", 0)-1
 }
}
else
{
hh=
break
}
}
return hh
}
;-----------------------------------------------------------------------------------------------------
WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}
;-----------------------------------------------------------------------------------------------------
StrRep(str,char,rep_char="",all=1) {
StringReplace,str,str,%char%,%rep_char%,% all ? "useErrorLevel" : 0
return str
}
;-----------------------------------------------------------------------------------------------------
StarsHHFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\PokerStars\,, Select the folder with the PokerStars handhistory files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, StarsHHLogFolderPath, %SelectedFolder%
StarsHHLogFolderPath := SelectedFolder
IniWrite, %StarsHHLogFolderPath%, %thisahk%.ini, LogFolder, StarsHHPath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
FullTiltHHFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\Full Tilt Poker\,, Select the folder with the FullTilt handhistory files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, FullTiltHHLogFolderPath, %SelectedFolder%
FullTiltHHLogFolderPath := SelectedFolder
IniWrite, %FullTiltHHLogFolderPath%, %thisahk%.ini, LogFolder, FullTiltHHPath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
PostgresBinFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\PostgreSQL\,, Select the folder with the Postgres binary files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, PostgresLogPath, %SelectedFolder%
PostgresLogPath := SelectedFolder
IniWrite, %PostgresLogPath%, %thisahk%.ini, LogFolder, postgrespath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
postgresuserselect:

InputBox, postgresuser,, enter Postgres Username
IniWrite, %postgresuser%, %thisahk%.ini, LogFolder, postgresuser
return
;-----------------------------------------------------------------------------------------------------
postgresdbselect:

InputBox, postgresdb,, enter Postgres Datbase Name
IniWrite, %postgresdb%, %thisahk%.ini, LogFolder, postgresdb
return
;-----------------------------------------------------------------------------------------------------
listAdd( byRef list, item, del="," ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}
;-----------------------------------------------------------------------------------------------------
listDelItem( byRef list, item, del=",") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %item%%del%
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}
;-----------------------------------------------------------------------------------------------------
reload:
reload
return
;-----------------------------------------------------------------------------------------------------
Exit:
exitapp
return
;-----------------------------------------------------------------------------------------------------
Script: Mark Current Hand Quote
02-18-2011 , 05:48 AM
ty I tested it out and it did not mark any hands that I didn't want, but it did not mark about 1/4 of the hands I wanted to mark.

Quote:
Originally Posted by TTR
here is a version for rush cashgames

Code:
#noenv
#SingleInstance, Force
SetWinDelay,-1
settitlematchmode,2

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%


IniRead, FullTiltHHLogFolderPath, %thisahk%.ini, LogFolder, FullTiltHHPath, %A_Space%
IniRead, PostgresLogPath, %thisahk%.ini, LogFolder, postgrespath, %A_Space%
IniRead, postgresuser, %thisahk%.ini, LogFolder, postgresuser, %A_Space%
IniRead, postgresdb, %thisahk%.ini, LogFolder, postgresdb, %A_Space%
StarsHHLogFolderPath=C:\

If ( !FullTiltHHLogFolderPath or !PostgresLogPath or !postgresuser or !postgresdb)
{
   Gui, Add, Text, x10  y5 w120 h20 Center, Select Folder Location
   Gui, Add, Text, x140 y5 w150 h20 Center, Folder Location
   Gui, Add, Button, x5 y20 w150 h20 gPostgresBinFolderSelect center, Postgres Binary Folder
   Gui, Add, Edit, x160 y20 w520 h20 vPostgresLogpath, %PostgresLogpath%
   Gui, Add, Button,  x5 y40 w150 h20 gFullTiltHHFolderSelect   center, Full Tilt HH Folder
   Gui, Add, Edit, x160 y40 w520 h20 vFullTiltHHLogFolderPath, %FullTiltHHLogFolderPath%
   
   Gui, Add, Text, x5  y120 w150 h20 right, Postgres User Name:
   Gui, Add, Edit, x160 y120 w100 h20 vpostgresuser, %postgresuser%
   Gui, Add, Text, x5  y140 w150 h20 right,  Postgres Database:
   Gui, Add, Edit, x160 y140 w100 h20 vpostgresdb, %postgresdb%
   Gui, Add, Button, w40 h30, OK  ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Markhand 
return
ButtonOK:
GuiClose:
GuiEscape:
Gui, Submit
IniWrite, %postgresdb%, %thisahk%.ini, LogFolder, postgresdb
IniWrite, %postgresuser%, %thisahk%.ini, LogFolder, postgresuser
IniWrite, %PostgresLogPath%, %thisahk%.ini, LogFolder, postgrespath
IniWrite, %FullTiltHHLogFolderPath%, %thisahk%.ini, LogFolder, FullTiltHHPath
return
}


IfExist, gamenumbers.txt
{
MsgBox, 4,, Delete existing file gamenumbers.txt? (press Yes or No)
IfMsgBox Yes
    FileDelete, gamenumbers.txt
}
settimer,checksize,100
return


^2::
Suspend
Return

F1::
winget,id,id,A
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
site=Stars
dir:=StarsHHLogFolderPath
}
else
if class=QWidget
{
site=FullTilt
dir:=FullTiltHHLogFolderPath
}
else
site=
if site
{
 filename:=HHFile(id, dir ,site) 
 fileread,tempstr,%filename%
 sleep,50
 FileGetSize, FileSize, % filename
 if !FileSize
 FileSize:=0
 listadd(filelist, id . "-" . FileSize)
}
return

^F1::
IfExist, temp.txt
FileDelete, temp.txt
IfExist, temp.bat
FileDelete, temp.bat
loop gamenumbers.*
FileRead, numbers, %A_LoopFileName%
if numbers
{
sql1=Update pokerhands
sql2=Set mark_id = 1
sql3=Where gamenumber = 
sql4=AND handtimestamp > localtimestamp - interval '1 days';
sql5=Update pokerhands_hero
Loop, Parse, numbers, `n,
{
if A_loopField
{
FileAppend, %sql1% %sql2% %sql3% %A_loopField% %sql4%`n, temp.txt
FileAppend, %sql5% %sql2% %sql3% %A_loopField% %sql4%`n, temp.txt
}
}
FileAppend, "%PostgresLogPath%\psql.exe"%A_space%"%postgresdb%"%A_space%"%postgresuser%"%A_space%0<"%A_ScriptDir%\temp.txt"`r`npause`n, temp.bat
run temp.bat
}
else
msgbox, gamenumbers.txt file doesn't exist or file is empty.
return
;-----------------------------------------------------------------------------------------------------
checksize:
Loop, Parse, filelist, `,
{
 stringsplit,tab,A_loopField,-
 wingetclass,class,ahk_id%tab1%
 if class=PokerStarsTableFrameClass
 {
 site=Stars
 dir:=StarsHHLogFolderPath
 }
 else
 if class=QWidget
 {
 site=FullTilt
 dir:=FullTiltHHLogFolderPath
 }
 filename:=HHFile(tab1, dir ,site) 
 fileread,tempstr,%filename%
 sleep,50
 FileGetSize, FileSize, % filename
 if FileSize
 if FileSize!=%tab2%
 {
  num:=gethhnumber(tab1,site)
  FileAppend, %num%`n, gamenumbers.txt
  listDelItem(filelist, A_loopField)  
 }
}
return
;-----------------------------------------------------------------------------------------------------
gethhnumber(winid,site)
{
global StarsHHLogFolderPath,FullTiltHHLogFolderPath
if site=Stars
path=%StarsHHLogFolderPath%
else
path=%FullTiltHHLogFolderPath%
hh:=LastHH(winid,path,site)
Loop, Parse, hh, `n
{
 if instr(A_loopfield,"Game #")
 {
  stringtrimleft,num,A_loopfield,instr(A_loopfield,"#")
  stringleft,num,num,instr(num,":")-1
  break
 }
}
return num
}
;-----------------------------------------------------------------------------------------------------
HHFile(win, dir, site) {
if site=Stars
ext=HH
else
ext=FT
title := WinGetTitle(win)
if !(instr(title,"Tournament")>0 OR instr(title,"Sit & Go")>0 OR instr(title,"Sit&Go")>0 OR instr(title,"table")>0 OR instr(title,"Satellite")>0) 
{
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(a_now, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
}
else
if site=Stars
{
 stringtrimleft,file,title,instr(title,"Tournament")+10
 stringleft,file,file,InStr(file, A_space)-1
}
else
{
 stringtrimleft,file,title,instr(title,"(")-1
 stringleft,file,file,InStr(file, "-")-2
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)>0 & !instr(A_LoopFileName,"Summary")>0
return dir "\" A_LoopFileName
}
EnvAdd, date, -1, d
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(date, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)
return dir "\" A_LoopFileName
}
EnvAdd, date, +1, d
stringleft,file,title, InStr(title, "-","",0)-2
file := ext . SubStr(date, 1, 8) . A_space . file
StringReplace, file, file, /,-,
if site=Stars
{
 StringReplace, file, file, USD -,- USD,
 StringReplace, file, file, EUR -,- EUR,
}
loop %dir%\*.txt
{
if instr(A_LoopFileName,file)
return dir "\" A_LoopFileName
}
}
return
;-----------------------------------------------------------------------------------------------------
LastHH(win, dir, site) {
wingettitle,title,ahk_id%win%
stringtrimleft,hero,title,instr(title,A_space,"",0)
heroaction1:=hero . A_space . "calls"
heroaction2:=hero . A_space . "bets"
heroaction3:=hero . A_space . "raises"
if site=Stars
game=PokerStars Game #
else
game=Full Tilt Poker Game #
file@name:=HHFile(win, dir ,site) 
fileread,tempstr,%file@name%
sleep,50
FileRead, hh, %file@name%
if !instr(hh,"seat")
{
FileGetSize file@size, %file@name%
FileRead file@buffer, %file@name%
VarSetCapacity(hh, file@size / 2 + 1, 0)
r := DllCall("WideCharToMultiByte"
      , "UInt", 0      ; CodePage: CP_ACP=0 (current Ansi), CP_UTF7=65000, CP_UTF8=65001
      , "UInt", 0      ; dwFlags
      , "Str", file@buffer      ; LPCWSTR lpWideCharStr
      , "Int", file@size / 2      ; cchWideChar: -1=null terminated
      , "Str", hh      ; LPSTR lpMultiByteStr
      , "Int", file@size / 2 + 1      ; cbMultiByte: 0 to get required size
      , "UInt",0      ; LPCSTR lpDefaultChar
      , "UInt", 0)      ; LPBOOL lpUsedDefaultChar
}
;StringTrimLeft, hh, hh, InStr(hh, game, "", 0)-1
;if instr(hh,"SUMMARY")
;Stringleft, hh, hh, InStr(hh, "*** SUMMARY", "", 0)-1
loop
{
if instr(hh,"game")
{
 StringTrimLeft, temphhnum, hh, InStr(hh, game, "", 0)-1
 if !instr(temphhnum,"*** HOLE")
 StringLeft, hh, hh, InStr(hh, game, "", 0)-1
 else
 {
  StringTrimLeft, temphh, hh, InStr(hh, "*** HOLE","",0)-1
  StringLeft, temphh, temphh, InStr(temphh, "***","",instr(temphh,"`n","",instr(temphh,"*** HOLE")))
  if (instr(temphh,heroaction1)>0) or (instr(temphh,heroaction2)>0) or (instr(temphh,heroaction3)>0)
  {
  hh:=temphhnum
  break
  }
  else
  StringLeft, hh, hh, InStr(hh, game, "", 0)-1
 }
}
else
{
hh=
break
}
}
return hh
}
;-----------------------------------------------------------------------------------------------------
WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}
;-----------------------------------------------------------------------------------------------------
StrRep(str,char,rep_char="",all=1) {
StringReplace,str,str,%char%,%rep_char%,% all ? "useErrorLevel" : 0
return str
}
;-----------------------------------------------------------------------------------------------------
StarsHHFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\PokerStars\,, Select the folder with the PokerStars handhistory files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, StarsHHLogFolderPath, %SelectedFolder%
StarsHHLogFolderPath := SelectedFolder
IniWrite, %StarsHHLogFolderPath%, %thisahk%.ini, LogFolder, StarsHHPath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
FullTiltHHFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\Full Tilt Poker\,, Select the folder with the FullTilt handhistory files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, FullTiltHHLogFolderPath, %SelectedFolder%
FullTiltHHLogFolderPath := SelectedFolder
IniWrite, %FullTiltHHLogFolderPath%, %thisahk%.ini, LogFolder, FullTiltHHPath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
PostgresBinFolderSelect:	
FileSelectFolder, SelectedFolder, *%ProgramFiles%\PostgreSQL\,, Select the folder with the Postgres binary files
SelectedFolder := RegExReplace(SelectedFolder, "\\$")  ; Removes the trailing backslash, if present.	
SelectedFolder := RegExReplace(SelectedFolder, "\$")
If SelectedFolder <>	;the user selected a folder
{
GuiControl,, PostgresLogPath, %SelectedFolder%
PostgresLogPath := SelectedFolder
IniWrite, %PostgresLogPath%, %thisahk%.ini, LogFolder, postgrespath
Gui, Submit, NoHide
}	
return
;-----------------------------------------------------------------------------------------------------
postgresuserselect:

InputBox, postgresuser,, enter Postgres Username
IniWrite, %postgresuser%, %thisahk%.ini, LogFolder, postgresuser
return
;-----------------------------------------------------------------------------------------------------
postgresdbselect:

InputBox, postgresdb,, enter Postgres Datbase Name
IniWrite, %postgresdb%, %thisahk%.ini, LogFolder, postgresdb
return
;-----------------------------------------------------------------------------------------------------
listAdd( byRef list, item, del="," ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}
;-----------------------------------------------------------------------------------------------------
listDelItem( byRef list, item, del=",") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %item%%del%
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}
;-----------------------------------------------------------------------------------------------------
reload:
reload
return
;-----------------------------------------------------------------------------------------------------
Exit:
exitapp
return
;-----------------------------------------------------------------------------------------------------

Last edited by matt57225; 02-18-2011 at 06:09 AM.
Script: Mark Current Hand Quote
03-04-2011 , 10:46 AM
Hi

I just tried this and got the following errors (after i had marked my hands) when I tried the 2nd hotkey to process the marked hands:

Quote:
C:\>"C:\Program Files\PostgreSQL\9.0\bin\psql.exe" "Holdem New" "postgres" 0<"C
:\temp.txt"
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "???" and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "???" and accepting
TCP/IP connections on port 5432?
Any ideas?
Script: Mark Current Hand Quote
03-04-2011 , 10:58 AM
michty6, Postgres wasn't running or you have it blocked with firewall i guess.
Script: Mark Current Hand Quote
03-05-2011 , 10:47 PM
btw: what i forget to mention: you have to process the sql script within the next 2 days after collecting the #. Put this in for not causing any troubles in DBs, where FT and PS Hands have the same. Tough I wasn't sure if this is possible.[/QUOTE]

can someone explain this to me?
Script: Mark Current Hand Quote
03-06-2011 , 12:01 AM
There is a simple if-clause. The script will only mark hands that are played within the last 2 days.
Script: Mark Current Hand Quote
03-07-2011 , 09:58 PM
I am getting this error (Update pokerhands_hero Set mark_id = 1 Where gamenumber = 5883946...) any advice would be appreciated
Script: Mark Current Hand Quote
03-07-2011 , 11:42 PM
Quote:
Originally Posted by grind
I am getting this error (Update pokerhands_hero Set mark_id = 1 Where gamenumber = 5883946...) any advice would be appreciated
what is the actual error, can you give me the full line?
Script: Mark Current Hand Quote
03-08-2011 , 12:24 AM
sorry about that this is it
(ERROR: relation "pokerhands_hero" does not exist
LINE 1 update pokerhands_hero set mark_id =1 where gamenumber=5883946...)
Script: Mark Current Hand Quote
03-10-2011 , 06:41 AM
Quote:
Originally Posted by grind
sorry about that this is it
(ERROR: relation "pokerhands_hero" does not exist
LINE 1 update pokerhands_hero set mark_id =1 where gamenumber=5883946...)
you are sure you are processing the script on a HEM DB?
Script: Mark Current Hand Quote
03-10-2011 , 11:39 AM
I'd really appreciate any help in getting this script working.
I copied and pasted the code from page 5 into the script and moved it to C:/markhand.ahk but it's not marking any hands. When I select a table and press the mark hand hotkey (T) it just types a T in the chat box but if I try and type a T into anything else, i.e. my internet browser, it doesn't type anyhing which suggests that the script is recognising the hotkey I've assigned it's just not working when I select a table.
I've manually created gamenumbers.txt in the same directory but still no luck.
I also tried manually inputting a hand number into gamenumbers.txt but when I press the second hotkey I either get the same error message as clickys:

Quote:
Originally Posted by clickys
..or I get this one:



My settings are:
Quote:
[LogFolder]
postgresdb=HoldemManager
postgresuser=postgres
postgrespath=C:\Program Files (x86)\PostgreSQL\8.4\bin
FullTiltHHPath=C:\Program Files (x86)\Full Tilt Poker
StarsHHPath=C:\Users\Andy\AppData\Local\PokerStars \HandHistory\(MyScreenName)
HK_sql=^`
HK_mark=t
Any idea what the problem could be?
Script: Mark Current Hand Quote
03-10-2011 , 05:58 PM
Quote:
Originally Posted by TTR
you are sure you are processing the script on a HEM DB?
yes.
Script: Mark Current Hand Quote
03-10-2011 , 06:29 PM
Quote:
Originally Posted by TTR
you are sure you are processing the script on a HEM DB?
that "..." makes it an invalid integer so even if it is on hem maybe the hand id is getting truncated or something like that?
Script: Mark Current Hand Quote
03-12-2011 , 03:20 AM
Quote:
Originally Posted by matt57225
It took me a while to figure out how to set it up but it's really simple to set up, here's how I did it:

1. install autohotkey found here http://www.autohotkey.com/download/ (I used "Installer for AutoHotkey Basic")
2. copy and paste code from page 5 post #71 into a text file. (the code from other posts might work also but I used the code from post #71)
3. save and rename that text file as markhand.ahk (not markhand.ahk.txt)
4. put the markhand.ahk file into the root folder so its path is C:\markhand.ahk
5. double click on the file, or right click on it and click "run script"
6. fill in the settings on the markhand gui that pops up
7. click ok

my settings:

postgres binary folder: C:\Program Files\PostgreSQL\8.4\bin
full tilt hh folder: C:\Program Files\Full Tilt Poker\HandHistory\screenname
postgres user name: postgres
postgres database: holdemmanager

also fill in both of the hotkey settings and pokerstars hh folder if you will be using it on there
I just want to add to this, I think you need to have HEM open and auto import running in order for it to work properly and for the gamenumbers.txt to be created automatically
Script: Mark Current Hand Quote

      
m