 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
livinthelife
Joined: 09 Feb 2008 Posts: 18
|
Posted: Tue Feb 26, 2008 10:47 am Post subject: copy parts of notepad .txt file to new .txt file |
|
|
i want to have a ahk program that copies specific sections of a .txt file into a new .txt file. I have hundreds of .txt files in a folder that i need to do this to.
Specifially, I play online poker and have hundreds of Hand History .txt files for every hand i have played. I want to know how much money I lost or won with each hand AsKs, or QhJh, etc.
The .txt files are located at :
C:\Documents and Settings\JAMES JOHNSON\My Documents\My Poker\HH\AP_SS
a typical file name is:
IHH20080208 Holdem Tourney ID 1858141(19685420) No Limit Hold'em $1 + $0.20(Real Money)
the text in the file is in this format:
| Code: |
Stage #1083401691 Tourney ID 1858141 Holdem Single Tournament No Limit $100 - 2008-02-08 15:07:05 (ET)
Table: 19685420 (Real Money) Seat #7 is the dealer
Seat 2 - VCM69ER ($3475 in chips)
Seat 3 - FRAENSERINO ($1395 in chips)
Seat 4 - SPORTSMNSHIP ($1715 in chips)
Seat 6 - DOCTEETH ($415 in chips)
Seat 7 - POTMAKER ($4160 in chips)
Seat 8 - GRAMPS_05 ($1195 in chips)
Seat 9 - SPORTZNUT001 ($1145 in chips)
GRAMPS_05 - Posts small blind $50
SPORTZNUT001 - Posts big blind $100
*** POCKET CARDS ***
Dealt to SPORTSMNSHIP [Qc 10d]
VCM69ER - Folds
FRAENSERINO - Folds
SPORTSMNSHIP - Raises $200 to $200
DOCTEETH - All-In(Raise) $415 to $415
POTMAKER - Folds
GRAMPS_05 - Folds
SPORTZNUT001 - Folds
SPORTSMNSHIP - Calls $215
*** FLOP *** [2d 2c 5d]
*** TURN *** [2d 2c 5d] [2h]
*** RIVER *** [2d 2c 5d 2h] [Kh]
*** SHOW DOWN ***
SPORTSMNSHIP - Shows [Qc 10d] (Three of a kind, twos)
DOCTEETH - Shows [9s Ks] (Full house, twos full of kings)
DOCTEETH Collects $980 from main pot
*** SUMMARY ***
Total Pot($980)
Board [2d 2c 5d 2h Kh]
Seat 2: VCM69ER Folded on the POCKET CARDS
Seat 3: FRAENSERINO Folded on the POCKET CARDS
Seat 4: SPORTSMNSHIP HI:lost with Three of a kind, twos [Qc 10d - B:2h,B:2d,B:2c,B:Kh,P:Qc]
Seat 6: DOCTEETH won Total ($980) All-In HI:($980) with Full house, twos full of kings [9s Ks - B:2h,B:2d,B:2c,P:Ks,B:Kh]
Seat 7: POTMAKER (dealer) Folded on the POCKET CARDS
Seat 8: GRAMPS_05 (small blind) Folded on the POCKET CARDS
Seat 9: SPORTZNUT001 (big blind) Folded on the POCKET CARDS
Stage #1083402302 Tourney ID 1858141 Holdem Single Tournament No Limit $100 - 2008-02-08 15:07:51 (ET)
Table: 19685420 (Real Money) Seat #8 is the dealer
Seat 2 - VCM69ER ($3475 in chips)
Seat 3 - FRAENSERINO ($1395 in chips)
Seat 4 - SPORTSMNSHIP ($1300 in chips)
Seat 6 - DOCTEETH ($980 in chips)
Seat 7 - POTMAKER ($4160 in chips)
Seat 8 - GRAMPS_05 ($1145 in chips)
Seat 9 - SPORTZNUT001 ($1045 in chips)
SPORTZNUT001 - Posts small blind $50
VCM69ER - Posts big blind $100
*** POCKET CARDS ***
Dealt to SPORTSMNSHIP [4h Ks]
FRAENSERINO - Folds
SPORTSMNSHIP - Folds
DOCTEETH - Folds
POTMAKER - Calls $100
GRAMPS_05 - Calls $100
SPORTZNUT001 - Calls $50
VCM69ER - Folds
*** FLOP *** [5s 9c 10h]
SPORTZNUT001 - Bets $100
POTMAKER - Folds
GRAMPS_05 - Calls $100
*** TURN *** [5s 9c 10h] [2h]
SPORTZNUT001 - Bets $100
GRAMPS_05 - Calls $100
*** RIVER *** [5s 9c 10h 2h] [Kh]
SPORTZNUT001 - Checks
GRAMPS_05 - Checks
*** SHOW DOWN ***
SPORTZNUT001 - Shows [7h 8c] (king high)
GRAMPS_05 - Shows [Jh Js] (One pair, jacks)
GRAMPS_05 Collects $800 from main pot
*** SUMMARY ***
Total Pot($800)
Board [5s 9c 10h 2h Kh]
Seat 2: VCM69ER (big blind) Folded on the POCKET CARDS
Seat 3: FRAENSERINO Folded on the POCKET CARDS
Seat 4: SPORTSMNSHIP Folded on the POCKET CARDS
Seat 6: DOCTEETH Folded on the POCKET CARDS
Seat 7: POTMAKER Folded on the FLOP
Seat 8: GRAMPS_05 (dealer) won Total ($800) HI:($800) with One pair, jacks [Jh Js - P:Js,P:Jh,B:Kh,B:10h,B:9c]
Seat 9: SPORTZNUT001 (small blind) HI:lost with king high [7h 8c - B:Kh,B:10h,B:9c,P:8c,P:7h]
|
i want to copy the Hands and how many chips I either gained or lost with that hand into a new .txt file that lists all the data in order, for example from the 2 hands above I want to collect teh data :
SPORTSMNSHIP
[Qc 10d]
200
215
lost
SPORTSMNSHIP
[4h Ks]
Folds
and then paste it into the new file called "SPORTSMNSHIP_HandsCost.txt" so it looks like this:
Q10o
-415
K4o
0
eventually i will need to have the all the chips lost or gained added together for all specific hands.
Thanks for any help you can give me.
fyi
sorry if this is information is already discussed in another post... i couldn't find it |
|
| Back to top |
|
 |
livinthelife
Joined: 09 Feb 2008 Posts: 18
|
Posted: Tue Feb 26, 2008 1:30 pm Post subject: |
|
|
Well so far I've got this to work:
| Code: |
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
F1::
Loop, read, C:\Autohotkeytest\SS\SStest.txt, C:\Autohotkeytest\SS\SStest_pull.txt
{
IfInString, A_LoopReadLine, SPORTSMNSHIP, IfNotInString, A_LoopReadLine, Seat, FileAppend, %A_LoopReadLine%`n
}
|
[Moderator's note - please use code tags]
this is the output to fill "SStest_pull.txt":
Dealt to SPORTSMNSHIP [Qc 10d]
SPORTSMNSHIP - Raises $200 to $200
SPORTSMNSHIP - Calls $215
SPORTSMNSHIP - Shows [Qc 10d] (Three of a kind, twos)
Dealt to SPORTSMNSHIP [4h Ks]
SPORTSMNSHIP - Folds
Does this look alraight? Any problems?
I'm not sure how to have program run through multiple files. And not sure how to add the numbers together?
But its a start, thanks for any help you can give. |
|
| Back to top |
|
 |
wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Tue Feb 26, 2008 2:55 pm Post subject: |
|
|
processing of multiple files is done with loop,filepattern:
| Code: | LOOP,C:\Documents and Settings\JAMES JOHNSON\My Documents\My Poker\HH\AP_SS\*.txt
{
loop,read,%A_LoopFileLongPath%
{
;process lines, collect current file's info in a sOutput variable
}
}
ifExist,SPORTSMNSHIP_HandsCost.txt
FileDelete,SPORTSMNSHIP_HandsCost.txt
FileAppend,%sOutput%,SPORTSMNSHIP_HandsCost.txt |
|
|
| Back to top |
|
 |
SKP
Joined: 08 Feb 2008 Posts: 17
|
Posted: Tue Feb 26, 2008 9:58 pm Post subject: Pokertracker |
|
|
Obviously yuo have not heard of pokertracker, this does this automatically for you, you get 1000 hands for free, and its well wroth the 55 dollars or whatever it costs.
Pokertracker 3 will be for sale soon as well
Also you can get pahud which shows the stats on the screen.
Check em both out. |
|
| Back to top |
|
 |
livinthelife
Joined: 09 Feb 2008 Posts: 18
|
Posted: Wed Feb 27, 2008 3:07 am Post subject: Re: |
|
|
thanks for the reply's w0xx0m and SKP.
* can be used to search all files is very helpful, you saved me hours of frustration, much thanks.
Moderator's note "use code tags"?
| Code: | | maybe that's what this is, thanks. was wondering how you all did that. will do from now on. |
| SKP wrote: | Obviously yuo have not heard of pokertracker, this does this automatically for you, you get 1000 hands for free, and its well wroth the 55 dollars or whatever it costs.
Pokertracker 3 will be for sale soon as well
Also you can get pahud which shows the stats on the screen.
Check em both out. |
thanks SKP. yes i have heard of pokertracker, i am thinking about purchasing it i hear good things. was unaware of the new PT 3 coming out, thanks for the heads up. currently i use a similar but much simpler free program called RealTime for my HUD and stat tracking.
However, i am a member of a poker forum and many of the members are new to poker and/or do not have the funds to puchase a tracking program. so, in order to help them improve their game i could give them this little program (if i ever get it working) for free. then they could run it and show me what they play and how so i can help them improve much faster.
thanks all, i hope to work on this a bit more today. i will post my progress periodically when i'm stuck on some section. |
|
| Back to top |
|
 |
livinthelife
Joined: 09 Feb 2008 Posts: 18
|
Posted: Wed Feb 27, 2008 5:10 pm Post subject: |
|
|
Ok I'm stuck on the dumbest thing, how do I subract variables?
From my text file I grab two numbers and store them as variable "stack1" ack2", then i try to subtract them and store the result into the variable "sc" then I append the output file with %sc%.
The two numbers I grab are not being stored as numbers they are being stored as text..... how do I change that?
ahk file
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
F5::
stack1=0
Loop, read, C:\Autohotkeytest\SS\HH_test1.txt, C:\Autohotkeytest\SS\HH_test1_outx.txt
{
IfInString, A_LoopReadLine, Sportsmnship, IfInString, A_LoopReadLine, chips, StringLen, csl, A_LoopReadLine
IfInString, A_LoopReadLine, Sportsmnship, IfInString, A_LoopReadLine, chips, StringMid, stack2, A_LoopReadLine, 23, csl-32
sc=%stack2%-%stack1%
IfInString, A_LoopReadLine, Sportsmnship, IfInString, A_LoopReadLine, chips, FileAppend, %sc%`n
IfInString, A_LoopReadLine, Sportsmnship, IfInString, A_LoopReadLine, chips, StringMid, stack1, A_LoopReadLine, 23, csl-32
IfInString, A_LoopReadLine, Dealt, StringTrimLeft, hc, A_LoopReadLine, 22
IfInString, A_LoopReadLine, Dealt, FileAppend, %hc%`n
}
Return
|
input file HH_test1
| Code: | *********** # 1 **************
PokerStars Game #15553962308: Tournament #78723223, $5.00+$0.50 Hold'em No Limit - Match Round I, Level I (10/20) - 2008/02/25 - 21:10:00 (ET)
Table '78723223 1' 2-max Seat #1 is the button
Seat 1: MCMplumber (1500 in chips)
Seat 2: Sportsmnship (1500 in chips)
MCMplumber: posts small blind 10
Sportsmnship: posts big blind 20
*** HOLE CARDS ***
Dealt to Sportsmnship [Jc 2d]
MCMplumber: calls 10
Sportsmnship: checks
*** FLOP *** [Ah 8c 4c]
Sportsmnship: bets 20
MCMplumber: calls 20
*** TURN *** [Ah 8c 4c] [Ts]
Sportsmnship: checks
MCMplumber: bets 40
Sportsmnship: folds
MCMplumber collected 80 from pot
MCMplumber: doesn't show hand
*** SUMMARY ***
Total pot 80 | Rake 0
Board [Ah 8c 4c Ts]
Seat 1: MCMplumber (button) (small blind) collected (80)
Seat 2: Sportsmnship (big blind) folded on the Turn
*********** # 2 **************
PokerStars Game #15553977760: Tournament #78723223, $5.00+$0.50 Hold'em No Limit - Match Round I, Level I (10/20) - 2008/02/25 - 21:10:43 (ET)
Table '78723223 1' 2-max Seat #2 is the button
Seat 1: MCMplumber (1540 in chips)
Seat 2: Sportsmnship (1460 in chips)
Sportsmnship: posts small blind 10
MCMplumber: posts big blind 20
*** HOLE CARDS ***
Dealt to Sportsmnship [7d Ts]
Sportsmnship: folds
MCMplumber collected 20 from pot
MCMplumber: shows [2h Ad] (high card Ace)
*** SUMMARY ***
Total pot 20 | Rake 0
Seat 1: MCMplumber (big blind) collected (20)
Seat 2: Sportsmnship (button) (small blind) folded before Flop
*********** # 3 **************
PokerStars Game #15553981627: Tournament #78723223, $5.00+$0.50 Hold'em No Limit - Match Round I, Level I (10/20) - 2008/02/25 - 21:10:54 (ET)
Table '78723223 1' 2-max Seat #1 is the button
Seat 1: MCMplumber (1550 in chips)
Seat 2: Sportsmnship (1450 in chips)
MCMplumber: posts small blind 10
Sportsmnship: posts big blind 20
*** HOLE CARDS ***
Dealt to Sportsmnship [Qs Ts]
MCMplumber: calls 10
Sportsmnship: checks
*** FLOP *** [7h 4d Th]
Sportsmnship: checks
MCMplumber: checks
*** TURN *** [7h 4d Th] [Kd]
Sportsmnship: checks
MCMplumber: bets 20
Sportsmnship: calls 20
*** RIVER *** [7h 4d Th Kd] [Td]
Sportsmnship: checks
MCMplumber: checks
*** SHOW DOWN ***
Sportsmnship: shows [Qs Ts] (three of a kind, Tens)
MCMplumber: shows [Kc 8h] (two pair, Kings and Tens)
Sportsmnship collected 80 from pot
*** SUMMARY ***
Total pot 80 | Rake 0
Board [7h 4d Th Kd Td]
Seat 1: MCMplumber (button) (small blind) showed [Kc 8h] and lost with two pair, Kings and Tens
Seat 2: Sportsmnship (big blind) showed [Qs Ts] and won (80) with three of a kind, Tens
*********** # 4 **************
PokerStars Game #15553995633: Tournament #78723223, $5.00+$0.50 Hold'em No Limit - Match Round I, Level I (10/20) - 2008/02/25 - 21:11:34 (ET)
Table '78723223 1' 2-max Seat #2 is the button
Seat 1: MCMplumber (1510 in chips)
Seat 2: Sportsmnship (1490 in chips)
Sportsmnship: posts small blind 10
MCMplumber: posts big blind 20
*** HOLE CARDS ***
Dealt to Sportsmnship [4c 3d]
Sportsmnship: folds
MCMplumber collected 20 from pot
*** SUMMARY ***
Total pot 20 | Rake 0
Seat 1: MCMplumber (big blind) collected (20)
Seat 2: Sportsmnship (button) (small blind) folded before Flop |
output I am getting
HH_test1_outx
| Code: | 1500 -0
[Jc 2d]
1460 -1500
[7d Ts]
1450 -1460
[Qs Ts]
1490 -1450
[4c 3d] |
output I WANT to get
| Code: |
1500
[Jc 2d]
-40
[7d Ts]
-10
[Qs Ts]
40
[4c 3d] |
|
|
| Back to top |
|
 |
wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Wed Feb 27, 2008 5:13 pm Post subject: |
|
|
expressions, use :=
sc:=stack2-stack1
inplace expressions, note the space after % and quoting of literal strings
FileAppend, % round(Value1-Value2,1) "`n" |
|
| Back to top |
|
 |
livinthelife
Joined: 09 Feb 2008 Posts: 18
|
Posted: Wed Feb 27, 2008 7:32 pm Post subject: |
|
|
thanks that works perfectly
(thought I'd already tried that, I tried every possible variation i could find....but obviously I must not have...lol)
thanks for all your help every one i think i am really close to have this finished. i will post the finished product when i do. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|