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

09-01-2010 , 05:44 AM
Ill try this.

Is it alright to post my HEM request link for the same function here?

Thanks,
Script: Mark Current Hand Quote
09-02-2010 , 01:59 AM
guys if you like this function, you can actually vote here so that HEM will implement it sooner.

Mark Current Hand HEM suggestion
Script: Mark Current Hand Quote
09-05-2010 , 10:39 AM
This looks great, but i'm having trouble downloading from rapidshare. Could someone just post the contents of the ahk in code tags here?
Script: Mark Current Hand Quote
09-05-2010 , 10:45 AM
There are a couple of posts above this with code but maybe you want the original which is this:

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

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

Menu, Tray, NoStandard
Menu, Tray, Add, Reload, Reload
Menu, Tray, Add, Change Settings,  GetMHSettings()
Menu, Tray, Add, Suspend Hotkeys, SuspendHotkey
Menu, Tray, Add, Exit, Exit
Gui, Submit

IniRead, StarsHHLogFolderPath, %thisahk%.ini, LogFolder, StarsHHPath, %A_Space%
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%
IniRead, HK_mark, %thisahk%.ini, LogFolder, HK_mark, %A_Space%
IniRead, HK_sql , %thisahk%.ini, LogFolder, HK_sql , %A_Space%



If (!StarsHHLogFolderPath or !FullTiltHHLogFolderPath or !PostgresLogPath or !postgresuser or !postgresdb or !HK_mark or !HK_sql)
   gosub GetMHSettings()
   
   
HotKey, %HK_mark%, l_markhand
HotKey, %HK_sql%, l_processsql

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

l_markhand:
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) 
 FileGetSize, FileSize, % filename
 if !FileSize
 FileSize:=0
 listadd(filelist, id . "-" . FileSize)
}
return

l_processsql:
IfExist, temp.txt
FileDelete, temp.txt
IfExist, temp.bat
FileDelete, temp.bat
IfExist, %PostgresLogPath%\temp.txt
FileDelete, %PostgresLogPath%\temp.txt
IfExist, %PostgresLogPath%\temp.bat
FileDelete, %PostgresLogPath%\temp.bat
FileRead, numbers, gamenumbers.txt
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, cd %PostgresLogPath%`npsql.exe %postgresdb% %postgresuser% <temp.txt`npause`n, temp.bat
Filemove, temp.txt, %PostgresLogPath%
Filemove, temp.bat, %PostgresLogPath%
run %PostgresLogPath%\temp.bat
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) 
 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) 
{
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) {
if site=Stars
game=PokerStars Game #
else
game=Full Tilt Poker Game #
file@name:=HHFile(win, dir ,site) 
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
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
;-----------------------------------------------------------------------------------------------------
GetMHSettings():
{  
   gosub SuspendHotkey
   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 gStarsHHFolderSelect  center, Poker Stars HH Folder
   Gui, Add, Edit, x160 y40 w520 h20 vStarsHHLogFolderPath, %StarsHHLogFolderPath%
   Gui, Add, Button, x5 y60 w150 h20 gFullTiltHHFolderSelect   center, Full Tilt HH Folder
   Gui, Add, Edit, x160 y60 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, Text, x5 y160 w150 h20 right, Hotkey "mark current Hand" :
   Gui, Add, HotKey, x160 y160 w100 h20 vHK_mark, %HK_mark%
   Gui, Add, Text, x5 y180 w150 h20 right, Hotkey "process sql":
   Gui, Add, HotKey, x160 y180 w100 h20 vHK_sql, %HK_sql%  
   Gui, Add, Button, x360 y180 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
IniWrite, %StarsHHLogFolderPath%, %thisahk%.ini, LogFolder, StarsHHPath
IniWrite, %HK_sql%, %thisahk%.ini, LogFolder, HK_sql
IniWrite, %HK_mark%, %thisahk%.ini, LogFolder, HK_mark
Gui, Destroy
gosub reload
return
}

;-----------------------------------------------------------------------------------------------------
SuspendHotkey:
SendInPut, {CTRLDOWN}2{CTRLUP}
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
;-----------------------------------------------------------------------------------------------------


INI:

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
Script: Mark Current Hand Quote
09-05-2010 , 09:49 PM
This looks sick
Script: Mark Current Hand Quote
09-05-2010 , 11:54 PM
: heart:

just what I need.

request:
1. can you add a balloon to pop-up whenever we mark a hand? and the balloon should state how many hands are marked.

2. Ongame support
Script: Mark Current Hand Quote
09-08-2010 , 04:14 AM
Quote:
Originally Posted by hypertyper
There is a prompt for the password that you have to enter manually.
I just started using the script and can't get it to work and I've never been prompted for a password. How do I fix it?
Script: Mark Current Hand Quote
09-08-2010 , 05:08 PM
I'm getting the error as timed44, any ideas Max? When I look in the actually bin folder, there doesn't seem to be a .txt file with that name
Script: Mark Current Hand Quote
09-09-2010 , 01:03 PM
I"ve inserted script and .ini file in my "C:\Program Files\PostgreSQL\8.4\bin" but when I try to send hands in HEM by pressing Crtl+F1 the following error displays:

Code:
Error: Faild attempt to launch program or document:
Action: <C:\Program Files(x86)\PostgreSQL\8.4\bin\temp.bat>
Params: <>

The current thread will exit

Specifically: The system cannot find the specified
.
Script: Mark Current Hand Quote
09-09-2010 , 01:11 PM
It is probably administrator privileges issue, can anyone having same problem try turning UAC off to check if it is the case?
Script: Mark Current Hand Quote
09-09-2010 , 01:34 PM
I've been running as admin whole time and UAC is off as well
Script: Mark Current Hand Quote
09-09-2010 , 02:15 PM
UAC is off for me.
Script: Mark Current Hand Quote
09-11-2010 , 04:58 AM
please run this one from your postgres/bin folder

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

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

Menu, Tray, NoStandard
Menu, Tray, Add, Reload, Reload
Menu, Tray, Add, Change Settings,  GetMHSettings()
Menu, Tray, Add, Suspend Hotkeys, SuspendHotkey
Menu, Tray, Add, Exit, Exit
Gui, Submit

IniRead, StarsHHLogFolderPath, %thisahk%.ini, LogFolder, StarsHHPath, %A_Space%
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%
IniRead, HK_mark, %thisahk%.ini, LogFolder, HK_mark, %A_Space%
IniRead, HK_sql , %thisahk%.ini, LogFolder, HK_sql , %A_Space%



If (!StarsHHLogFolderPath or !FullTiltHHLogFolderPath or !PostgresLogPath or !postgresuser or !postgresdb or !HK_mark or !HK_sql)
   gosub GetMHSettings()
   
   
HotKey, %HK_mark%, l_markhand
HotKey, %HK_sql%, l_processsql

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

l_markhand:
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) 
 FileGetSize, FileSize, % filename
 if !FileSize
 FileSize:=0
 listadd(filelist, id . "-" . FileSize)
}
return

l_processsql:
IfExist, temp.txt
FileDelete, temp.txt
IfExist, temp.bat
FileDelete, temp.bat
FileRead, numbers, gamenumbers.txt
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, psql.exe %postgresdb% %postgresuser% <temp.txt`npause`n, temp.bat
run temp.bat
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) 
 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) 
{
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) {
if site=Stars
game=PokerStars Game #
else
game=Full Tilt Poker Game #
file@name:=HHFile(win, dir ,site) 
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
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.    
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.    
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.    
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
;-----------------------------------------------------------------------------------------------------
GetMHSettings():
{  
   gosub SuspendHotkey
   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 gStarsHHFolderSelect  center, Poker Stars HH Folder
   Gui, Add, Edit, x160 y40 w520 h20 vStarsHHLogFolderPath, %StarsHHLogFolderPath%
   Gui, Add, Button, x5 y60 w150 h20 gFullTiltHHFolderSelect   center, Full Tilt HH Folder
   Gui, Add, Edit, x160 y60 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, Text, x5 y160 w150 h20 right, Hotkey "mark current Hand" :
   Gui, Add, HotKey, x160 y160 w100 h20 vHK_mark, %HK_mark%
   Gui, Add, Text, x5 y180 w150 h20 right, Hotkey "process sql":
   Gui, Add, HotKey, x160 y180 w100 h20 vHK_sql, %HK_sql%  
   Gui, Add, Button, x360 y180 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
IniWrite, %StarsHHLogFolderPath%, %thisahk%.ini, LogFolder, StarsHHPath
IniWrite, %HK_sql%, %thisahk%.ini, LogFolder, HK_sql
IniWrite, %HK_mark%, %thisahk%.ini, LogFolder, HK_mark
Gui, Destroy
gosub reload
return
}

;-----------------------------------------------------------------------------------------------------
SuspendHotkey:
SendInPut, {CTRLDOWN}2{CTRLUP}
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
09-12-2010 , 07:49 PM
TTR new version works like a charm, ty soo much!
Script: Mark Current Hand Quote
09-12-2010 , 10:55 PM
Quote:
Originally Posted by TomoDaK
TTR new version works like a charm, ty soo much!
cool

looks like some combos of windows/ahk are messing up with the file operations
Script: Mark Current Hand Quote
09-13-2010 , 11:32 AM
Great, it works!!
You"re the man TTR!
TY
Script: Mark Current Hand Quote
09-13-2010 , 08:08 PM
Awesome! This works great. I'd like to make a small donation. To whom and where should I transfer funds?
Script: Mark Current Hand Quote
09-16-2010 , 10:38 AM
still no dice with this
Script: Mark Current Hand Quote
09-16-2010 , 05:21 PM
Quote:
Originally Posted by Furio
still no dice with this
??
Script: Mark Current Hand Quote
09-16-2010 , 09:48 PM
is it possible to make this work for Ongame?
Script: Mark Current Hand Quote
09-17-2010 , 07:56 PM
Quote:
Originally Posted by TTR
??
I have tried the new code and i get the same issues. I even tried to create a .txt file that is said i will missing and then it just has the same error black screen but without the "file not found" line.

Think I have to give up on this until HEM/TN build this in directly.
Script: Mark Current Hand Quote
09-17-2010 , 08:33 PM
I offered teamviewer session with anyone having this problem, there were no volunteers so i can't do anything about it.
Script: Mark Current Hand Quote
09-17-2010 , 09:41 PM
Some OS have Program Files (and some else) folder write protected, this could be the problem, try running this version from the drive root, note that you must have gamenumbers.txt file created or same message will occur (temp.txt file won't be created if there isn't gamenumbers.txt file).
Code:
#noenv
#SingleInstance, Force
SetWinDelay,-1
settitlematchmode,2

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

IniRead, StarsHHLogFolderPath, %thisahk%.ini, LogFolder, StarsHHPath, %A_Space%
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%

If (!StarsHHLogFolderPath or !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 gStarsHHFolderSelect  center, Poker Stars HH Folder
   Gui, Add, Edit, x160 y40 w520 h20 vStarsHHLogFolderPath, %StarsHHLogFolderPath%
   Gui, Add, Button, x5 y60 w150 h20 gFullTiltHHFolderSelect   center, Full Tilt HH Folder
   Gui, Add, Edit, x160 y60 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
IniWrite, %StarsHHLogFolderPath%, %thisahk%.ini, LogFolder, StarsHHPath
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) 
 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
FileRead, numbers, gamenumbers.txt
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
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) 
 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) {
if site=Stars
game=PokerStars Game #
else
game=Full Tilt Poker Game #
file@name:=HHFile(win, dir ,site) 
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
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
Folder := RegExReplace(Folder, "\\$")  ; Removes the trailing backslash, if present.	
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
09-28-2010 , 01:30 PM
iam getting this error
Script: Mark Current Hand Quote
09-28-2010 , 01:54 PM
clickys, either you don't use the latest version posted (previous post) or run it from Program Files folder (should be run from drive root eg C:\), additionally you can try removing trailing backslashes in the ini file if present.
Script: Mark Current Hand Quote

      
m