|
|
| STT Strategy Discussion about the play of single table tournaments. |
12-22-2008, 10:07 AM
|
#1
|
|
Pooh-Bah
Join Date: Apr 2004
Location: 99 problems but a TT+ just ship pf
Posts: 5,238
|
OT: The SNGWizard Paster (AHK ITT!)
I guess this could be x-posted to software but this is only useful to use stt guys and i doubt many of you lurk the software forum on a daily basis
So I woke up with a hangover this morning and decided that such a state was not conducive to a good grind, so instead I hacked around for 2 hours to work on a little AHK I've been meaning to do for some time.
Basically it allows you to select any stack size text (like you see in a forum post), hit the hotkey, and it'll stick the stack information in to SNG wiz for you, so you don't have to worry about typing in the stack size info wrong or putting the wrong person first in the stack size list.
So basically you browse around 2+2 and see some thread and you're about to reply "shove it standard" and move on but you think it best to check the wiz first. With the AHK running you just select this bit of the text:
Quote:
BTN: t1375
Hero (SB): t6910
BB: t6715
|
And hit the hotkey CTRL-SHIFT-V. The script will copy the stack information, work out who's UTG, load up the wiz (or switch to it if it's already running), start a new game and put in the stack info. Then you just need to set the game type, blinds, and hero hand and you're ready to go.
The code is fairly competant at working out what the stacks and positions are and ignores other data, i've tested it on the 3 main converters and it seems to work fine.
Anyways here's the code, merry xmas etc
Code:
;
; SNGWizard Paster
; Paste stack size text in to the wiz
wizclass := "WindowsForms10.Window.8.app.0.bb8560"
wiz_exe := "C:\Program Files\In The Money\SitNGo Wizard\SitNGoWizard.exe"
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
; GREP functions thanks to Titan see http://www.autohotkey.net/~Titan/dl/grep.ahk
grep(h, n, ByRef v, s = 1, e = 0, d = "") {
v =
StringReplace, h, h, %d%, , All
Loop
If s := RegExMatch(h, n, c, s)
p .= d . s, s += StrLen(c), v .= d . (e ? c%e% : c)
Else Return, SubStr(p, 2), v := SubStr(v, 2)
}
grepcsv(h, n, ByRef v, s = 1) {
v =
x = 0
xp = 1
Loop {
If xp := InStr(n, "(", "", xp)
x += SubStr(n, xp + 1, 1) != "?", xp++
Else {
Loop
If s := RegExMatch(h, n, c, s) {
p = %p%`n"%s%"
s += StrLen(c)
StringReplace, c, c, ", "", All
v = %v%`n"%c%"
Loop, %x% {
StringReplace, cx, c%A_Index%, ", "", All
v = %v%,"%cx%"
}
} Else Return, SubStr(p, 2), v := SubStr(v, 2)
}
}
}
^+V::
; We first send a CTRL-C to copy whatever text selected to the clipboard
SendInput ^c
; is the analyse game window open?
WinGet sngwiz, ID, New Game ahk_class %wizclass%
if (!sngwiz) {
; is the SNGW main window open?
WinGet wizmain, ID, SitNGo Wizard ahk_class %wizclass%
if (!wizmain) {
MsgBox, 4,, Wizawoo isn't running. Shall I run it?
IfMsgBox No
return
IfMsgBox Yes
Run %wiz_exe%
WinWait SitNGo Wizard ahk_class %wizclass%, , 10
if (ErrorLevel) {
MsgBox, Waited 10 seconds for wiz to launch but I can't see it!
return
} else {
WinGet wizmain, ID, SitNGo Wizard ahk_class %wizclass%
}
}
if (wizmain) {
WinActivate, ahk_id %wizmain%
SendInput !f
SendInput n
WinWait New Game ahk_class %wizclass%, , 3
if (ErrorLevel) {
MsgBox, Tried to launch a new game in wiz but it failed!
return
} else {
WinGet sngwiz, ID, New Game ahk_class %wizclass%
}
}
}
if (sngwiz) {
WinActivate, ahk_id %sngwiz%
but_pos := 0
utg_pos := 0
co_pos := 0
stack_count := 0
stacks := ""
;dummy_clip := "Hero (BB) (t1515)`r`nUTG (t7300)`r`nButton (t1495)`r`nSB (t3190)"
Loop, parse, clipboard, `n, `r
{
line = %A_LoopField%
rep := ","
StringReplace, line, line, %rep%, , A
grepcsv(line, "^(Hero \(([A-Za-z0-9\+]{2,6})\)|([A-Za-z0-9\+]{2,6})):?[ ]\(?t?(\d+)\)?$", res)
del := ","
index := 0
pos := ""
stack := ""
Loop, Parse, res, %del%
{
var := A_loopField
if (index == 2 or index == 3) {
if (var != """""") {
StringMid pos, var, 2, StrLen(var) - 2
}
} else if (index == 4) {
StringMid stack, var, 2, StrLen(var) - 2
}
index += 1
}
if (pos && stack) {
stack_count += 1
if (pos == "Button" || pos == "BTN") {
btn_pos := stack_count
} else if (pos == "UTG") {
utg_pos := stack_count
} else if (pos == "CO") {
co_pos := stack_count
}
stacks%stack_count% := stack
}
}
if (stack_count > 0) {
; reorder the stacks at the splitting point (either UTG or on the button if 3 players or less
split_point := utg_pos
if (split_point < 1) {
split_point := co_pos
}
if (split_point < 1) {
split_point := btn_pos
}
orderedstacks_count = 0
Loop %stack_count% {
if (A_index < split_point) {
newindex := A_index + stack_count - split_point + 1
} else {
newindex := A_index - split_point + 1
}
orderedstacks_count += 1
orderedstacks%newindex% := stacks%A_index%
x := stacks%A_index%
}
Loop %orderedstacks_count% {
stack := orderedstacks%A_Index%
if (A_index != 1) {
SendInput {down}
}
SendInput %stack%
}
}
}
return
|
|
|
12-22-2008, 10:41 AM
|
#2
|
|
Pooh-Bah
Join Date: Dec 2006
Posts: 4,596
|
Re: OT: The SNGWizard Paster (AHK ITT!)
very nice, thanks.
|
|
|
12-22-2008, 11:45 AM
|
#3
|
|
Carpal \'Tunnel
Join Date: Dec 2007
Location: New Round New Chances Everyone
Posts: 6,710
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Some guys have a dangerous combination of being way too clever and having too much time on their hands!
Only joking, Hood, very nice work sir!
Merry xmas to you too!
|
|
|
12-22-2008, 11:53 AM
|
#4
|
|
banned
Join Date: Apr 2007
Location: SC2 ftw
Posts: 2,771
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Nice work! Thanks
|
|
|
12-22-2008, 12:54 PM
|
#5
|
|
veteran
Join Date: Oct 2008
Posts: 2,234
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Amazing, ty vmuch
|
|
|
12-22-2008, 01:14 PM
|
#6
|
|
Pooh-Bah
Join Date: Feb 2008
Location: 4k postaments
Posts: 4,491
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Great xmas gift, thanks a ton!
|
|
|
12-22-2008, 01:24 PM
|
#7
|
|
banned
Join Date: Sep 2008
Location: $52s
Posts: 329
|
Re: OT: The SNGWizard Paster (AHK ITT!)
haven't tried it, but sounds very useful.
|
|
|
12-22-2008, 02:53 PM
|
#8
|
|
adept
Join Date: Jun 2007
Posts: 1,093
|
Re: OT: The SNGWizard Paster (AHK ITT!)
does this work with the converter you made for Ongame?
if it does, this rocks!!
|
|
|
12-22-2008, 02:57 PM
|
#9
|
|
Pooh-Bah
Join Date: Apr 2004
Location: 99 problems but a TT+ just ship pf
Posts: 5,238
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Quote:
Originally Posted by ronmar
does this work with the converter you made for Ongame?
if it does, this rocks!!
|
Ha, ironically i don't think it will, cos my converter includes bbs in the stack lines. i'll modify it so it handles that
|
|
|
12-22-2008, 03:10 PM
|
#10
|
|
Carpal \'Tunnel
Join Date: Mar 2006
Location: I just want the reg his money.
Posts: 10,469
|
Re: OT: The SNGWizard Paster (AHK ITT!)
sick, ship it man
|
|
|
12-22-2008, 03:26 PM
|
#11
|
|
enthusiast
Join Date: Jul 2007
Posts: 85
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Works great!
Had to change the wizclass info from window spy and program location (vista).
|
|
|
12-22-2008, 04:26 PM
|
#12
|
|
Pooh-Bah
Join Date: Apr 2004
Location: 99 problems but a TT+ just ship pf
Posts: 5,238
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Okay new version supports stuff from the ongame firefox extension - both the hand history you view using the extension, and the 2+2 conversion format.
I've also removed references to the specific wiz class (so if you're getting problems like nulli above, you shouldn't do now). I think the problem is you're running an older version of the wizard, so the class name is different.
Edit: For anyone using the ongame extension, I'm going to add in a new feature where you click on a link it'll select the stack info quickly for you. That and a crapload of other sweet new features (like linking directly to the nash ICM calculator) will be released this side of xmas. ship it hola etc
Code:
;
; SNGWizard Paster
; Paste stack size text in to the wiz
wiz_exe := "C:\Program Files\In The Money\SitNGo Wizard\SitNGoWizard.exe"
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
; GREP functions thanks to Titan see http://www.autohotkey.net/~Titan/dl/grep.ahk
grep(h, n, ByRef v, s = 1, e = 0, d = "") {
v =
StringReplace, h, h, %d%, , All
Loop
If s := RegExMatch(h, n, c, s)
p .= d . s, s += StrLen(c), v .= d . (e ? c%e% : c)
Else Return, SubStr(p, 2), v := SubStr(v, 2)
}
grepcsv(h, n, ByRef v, s = 1) {
v =
x = 0
xp = 1
Loop {
If xp := InStr(n, "(", "", xp)
x += SubStr(n, xp + 1, 1) != "?", xp++
Else {
Loop
If s := RegExMatch(h, n, c, s) {
p = %p%`n"%s%"
s += StrLen(c)
StringReplace, c, c, ", "", All
v = %v%`n"%c%"
Loop, %x% {
StringReplace, cx, c%A_Index%, ", "", All
v = %v%,"%cx%"
}
} Else Return, SubStr(p, 2), v := SubStr(v, 2)
}
}
}
^+V::
; We first send a CTRL-C to copy whatever text selected to the clipboard
SendInput ^c
Sleep 10
stored_clipboard := clipboard
; is the analyse game window open?
WinGet sngwiz, ID, New Game
if (!sngwiz) {
; is the SNGW main window open?
WinGet wizmain, ID, SitNGo Wizard
if (!wizmain) {
MsgBox, 4,, Wizawoo isn't running. Shall I run it?
IfMsgBox No
return
IfMsgBox Yes
Run %wiz_exe%
WinWait SitNGo Wizard, , 10
if (ErrorLevel) {
MsgBox, Waited 10 seconds for wiz to launch but I can't see it!
return
} else {
WinGet wizmain, ID, SitNGo Wizard
}
}
if (wizmain) {
WinActivate, ahk_id %wizmain%
SendInput !f
SendInput n
WinWait New Game, , 3
if (ErrorLevel) {
MsgBox, Tried to launch a new game in wiz but it failed!
return
} else {
WinGet sngwiz, ID, New Game
}
}
}
if (sngwiz) {
WinActivate, ahk_id %sngwiz%
; First we check the first line - if it has a line that just says "Hero", assume
; it's from the ongame firefox extension
use_ongame := false
Loop, parse, stored_clipboard, `n, `r
{
line = %A_LoopField%
if (line == "Hero") {
new_board := ""
Loop, parse, stored_clipboard, `n, `r
{
if (A_index > 1 && mod(A_index, 4) == 1) {
new_board := new_board . "`n`r"
} else if (A_index > 1) {
new_board := new_board . "-"
}
line = %A_LoopField%
new_board := new_board . line
}
stored_clipboard := new_board
use_ongame == true
break
}
}
but_pos := 0
utg_pos := 0
co_pos := 0
stack_count := 0
stacks := ""
Loop, parse, stored_clipboard, `n, `r
{
line = %A_LoopField%
if (!use_ongame) {
rep := ","
StringReplace, line, line, %rep%, , A
}
if (!use_ongame) {
grepcsv(line, "^(Hero \(([A-Za-z0-9\+]{2,6})\)|([A-Za-z0-9\+]{2,6})):?[ ]\(?t?(\d+)\)?", res)
} else {
grepcsv(line, "^([A-Za-z0-9\+]{2,6})-.*-\$(\d+)-.*bbs$", res)
}
del := ","
index := 0
pos := ""
stack := ""
Loop, Parse, res, %del%
{
var := A_loopField
if ((use_ongame && index == 1) || (!use_ongame && (index == 2 or index == 3))) {
if (var != """""") {
StringMid pos, var, 2, StrLen(var) - 2
}
} else if ((use_ongame && index == 2) || (!use_ongame && index == 4)) {
StringMid stack, var, 2, StrLen(var) - 2
}
index += 1
}
if (pos && stack) {
stack_count += 1
if (pos == "Button" || pos == "BTN") {
btn_pos := stack_count
} else if (pos == "UTG") {
utg_pos := stack_count
} else if (pos == "CO") {
co_pos := stack_count
}
stacks%stack_count% := stack
}
}
if (stack_count > 0) {
; reorder the stacks at the splitting point (either UTG or on the button if 3 players or less
split_point := utg_pos
if (split_point < 1) {
split_point := co_pos
}
if (split_point < 1) {
split_point := btn_pos
}
orderedstacks_count = 0
Loop %stack_count% {
if (A_index < split_point) {
newindex := A_index + stack_count - split_point + 1
} else {
newindex := A_index - split_point + 1
}
orderedstacks_count += 1
orderedstacks%newindex% := stacks%A_index%
x := stacks%A_index%
}
Loop %orderedstacks_count% {
stack := orderedstacks%A_Index%
if (A_index != 1) {
SendInput {down}
}
SendInput %stack%
}
}
}
return
|
|
|
12-23-2008, 05:26 AM
|
#13
|
|
banned
Join Date: Sep 2008
Location: $52s
Posts: 329
|
Re: OT: The SNGWizard Paster (AHK ITT!)
How do I make this into one of them little sexy exe script files?
|
|
|
12-23-2008, 06:21 AM
|
#14
|
|
Carpal \'Tunnel
Join Date: Mar 2006
Location: in the loving arms of socialism
Posts: 21,052
|
Re: OT: The SNGWizard Paster (AHK ITT!)
  OP
|
|
|
12-23-2008, 07:31 AM
|
#15
|
|
Pooh-Bah
Join Date: Apr 2004
Location: 99 problems but a TT+ just ship pf
Posts: 5,238
|
Re: OT: The SNGWizard Paster (AHK ITT!)
Quote:
Originally Posted by SoManyAdsInIE
How do I make this into one of them little sexy exe script files?
|
Right click on AHK > Compile Script
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 11:34 AM.
|