newbiescripter Posted January 22, 2008 Share Posted January 22, 2008 (edited) Closed.. but thanks spookmeister. I never forget! Edited January 24, 2008 by newbiescripter Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 Not that I am trying to dissuade you from doing this with autoit, but there are much better (more versatile and more widely compatible) programs than you are likely to be able to make already out there for dealing with this sort of thing. Google "Poker Tracker" for a great example. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
Fossil Rock Posted January 22, 2008 Share Posted January 22, 2008 What poker site? Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
Shevilie Posted January 22, 2008 Share Posted January 22, 2008 Have a look for RegExp that should be what you want Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 (edited) Here is one way to do it: expandcollapse popup#include <array.au3> Dim $aHands[1][8], $HandCount = 0, $GrabNextLine = 0 $sFile = FileOpenDialog("Select Hand History File", @ScriptDir, "Text files (*.txt)", 1 + 2) $file = FileOpen($sFile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Select Case StringInStr($line, "***** Hand History for Game") $HandCount += 1 ReDim $aHands[$HandCount + 1][8] $aHands[0][0]=$HandCount Case StringInStr($line, "** Dealing down cards **") $GrabNextLine = 1 ; set flag to grab next line Case $GrabNextLine = 1 $tmp=_GetCards($line) $aHands[$HandCount][1]=StringMid($tmp,1,2) $aHands[$HandCount][2]=StringMid($tmp,4,2) $GrabNextLine = 0 ; reset flag Case StringInStr($line, "** Dealing Flop **") $tmp=_GetCards($line) $aHands[$HandCount][3]=StringMid($tmp,1,2) $aHands[$HandCount][4]=StringMid($tmp,5,2) $aHands[$HandCount][5]=StringMid($tmp,9,2) Case StringInStr($line, "** Dealing Turn **") $tmp=_GetCards($line) $aHands[$HandCount][6]=StringMid($tmp,1,2) Case StringInStr($line, "** Dealing River **") $tmp=_GetCards($line) $aHands[$HandCount][7]=StringMid($tmp,1,2) EndSelect WEnd FileClose($file) _ArrayDisplay($aHands) Func _GetCards($string) ; returns what is in between "[ " and " ]" $sSub=StringTrimLeft($string,StringInStr($string,"[")+1) Return StringTrimRight($sSub,2) EndFunc Edited January 22, 2008 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
Shevilie Posted January 22, 2008 Share Posted January 22, 2008 Well since you know that the text would be Dealt to JeppeLSV [ Qh 8s ] "Dealt to JeppeLSV \[(.*)\]" This will likely not work since I cant remember all the rules in my head But you would be looking for something like that Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 It works for me with the text I copied from your post. But perhaps there is some sort of formatting issue there. Tweak the numbers used by StringMid() in this section: Case $GrabNextLine = 1 $tmp=_GetCards($line) $aHands[$HandCount][1]=StringMid($tmp,1,2) $aHands[$HandCount][2]=StringMid($tmp,4,2) $GrabNextLine = 0 ; reset flag Maybe throw in a test line like: MsgBox(0,"","|" & $tmp & "|") to see what you are working with. You can reference the results like so: If you want Hand 2, Card 3 you would use $aHands[2][3] in your code [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 Sorry, I'm at work. No PM/IM/etc. allowed here. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 Instead of using $Card1 as your variable, just use $aHands[1][1] That is, assuming you are refering to the first hand. Basically what I have done is to grab the important info from the file and put it into an Array. (look "array" up in the help file for more info) [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 Like I said, it is working for me with what I copied from your post. Do this for me, open up your .txt file in notepad again. Highlight a few hands Copy them (CTRL-C) In your reply, before you paste in the hands, put [ code ] in front of it and [ /code ] after it. (without the spaces between [ and ], I had to put them there so you could see the tags) [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 I need the original hands to look at so I can see what is going wrong, I doubt it is a version difference that is causing the issue. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 (edited) Ah, there is another space in this version when showing your hole cards: Original Example (Coppied from the text in your first post): Dealt to JeppeLSV [ 2s Qc ]New Example (From your attached file): Dealt to Jeppela [ Qs 6s ] I've modified the code accordingly: expandcollapse popup#include <array.au3> Dim $aHands[1][8], $HandCount = 0, $GrabNextLine = 0 $sFile = FileOpenDialog("Select Hand History File", @ScriptDir, "Text files (*.txt)", 1 + 2) $file = FileOpen($sFile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Select Case StringInStr($line, "***** Hand History for Game") $HandCount += 1 ReDim $aHands[$HandCount + 1][8] $aHands[0][0]=$HandCount Case StringInStr($line, "** Dealing down cards **") $GrabNextLine = 1 ; set flag to grab next line Case $GrabNextLine = 1 $tmp=_GetCards($line) $aHands[$HandCount][1]=StringMid($tmp,2,2) $aHands[$HandCount][2]=StringMid($tmp,5,2) $GrabNextLine = 0 ; reset flag Case StringInStr($line, "** Dealing Flop **") $tmp=_GetCards($line) $aHands[$HandCount][3]=StringMid($tmp,1,2) $aHands[$HandCount][4]=StringMid($tmp,5,2) $aHands[$HandCount][5]=StringMid($tmp,9,2) Case StringInStr($line, "** Dealing Turn **") $tmp=_GetCards($line) $aHands[$HandCount][6]=StringMid($tmp,1,2) Case StringInStr($line, "** Dealing River **") $tmp=_GetCards($line) $aHands[$HandCount][7]=StringMid($tmp,1,2) EndSelect WEnd FileClose($file) _ArrayDisplay($aHands) Func _GetCards($string) ; returns what is in between "[ " and " ]" $sSub=StringTrimLeft($string,StringInStr($string,"[")+1) Return StringTrimRight($sSub,2) EndFuncoÝ÷ ØÚ0¶.zË2¢êç{j¹ë-ò¢çÊ&éí¢ëmà+¬Êek-7é¡ÚÛ%wʶ)àj)ß®í¡ø¶§i×mêÞ²ÚÊ«r^¶h¶§{m)à~ò¢â!© ¹ë,x¢ºÞrÙrÜ"VÞ²¶§X¤y«¢+Øí}ÉÉå¥ÍÁ±ä ÀÌØí!¹Ì¤)]¥¹]¥ÑÑ¥Ù ÅÕ½ÐíͽµÁɽɴÅÕ½Ðì¤)]¡¥±Ä(%½ÈÀÌØíàôÄѼU ½Õ¹ ÀÌØí!¹Ì¤´Ä($% ½¹Ñɽ±M¹ ÅÕ½ÐíͽµÁɽɴÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíM½µ ½¹Ñɽ±%ÅÕ½Ðì°ÀÌØí!¹ÍlÀÌØíáulÅt¤(%9áÐ)]¹ Edited January 22, 2008 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 oh thanks you so much now it works I'll try playing a little with the $aHands[1][1] : ;TEST message $count = 0 MsgBox(0,"","|" & $aHands[$count+1][1] & "|") MsgBox(0,"","|" & $aHands[$count+1][2] & "|") MsgBox(0,"","|" & $aHands[$count+1][3] & "|") MsgBox(0,"","|" & $aHands[$count+1][4] & "|") MsgBox(0,"","|" & $aHands[$count+1][5] & "|") MsgBox(0,"","|" & $aHands[$count+1][6] & "|") MsgBox(0,"","|" & $aHands[$count+1][7] & "|") MsgBox(0,"","|" & $aHands[$count+2][1] & "|") MsgBox(0,"","|" & $aHands[$count+2][2] & "|") MsgBox(0,"","|" & $aHands[$count+2][3] & "|") MsgBox(0,"","|" & $aHands[$count+2][4] & "|") MsgBox(0,"","|" & $aHands[$count+2][5] & "|") MsgBox(0,"","|" & $aHands[$count+2][6] & "|") MsgBox(0,"","|" & $aHands[$count+2][7] & "|") How do I continue this $count until it has readed all hands ? Like this: expandcollapse popup#include <array.au3> Dim $aHands[1][8], $HandCount = 0, $GrabNextLine = 0 $sFile = FileOpenDialog("Select Hand History File", @ScriptDir, "Text files (*.txt)", 1 + 2) $file = FileOpen($sFile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Select Case StringInStr($line, "***** Hand History for Game") $HandCount += 1 ReDim $aHands[$HandCount + 1][8] $aHands[0][0] = $HandCount Case StringInStr($line, "** Dealing down cards **") $GrabNextLine = 1 ; set flag to grab next line Case $GrabNextLine = 1 $tmp = _GetCards($line) $aHands[$HandCount][1] = StringMid($tmp, 2, 2) $aHands[$HandCount][2] = StringMid($tmp, 5, 2) $GrabNextLine = 0 ; reset flag Case StringInStr($line, "** Dealing Flop **") $tmp = _GetCards($line) $aHands[$HandCount][3] = StringMid($tmp, 1, 2) $aHands[$HandCount][4] = StringMid($tmp, 5, 2) $aHands[$HandCount][5] = StringMid($tmp, 9, 2) Case StringInStr($line, "** Dealing Turn **") $tmp = _GetCards($line) $aHands[$HandCount][6] = StringMid($tmp, 1, 2) Case StringInStr($line, "** Dealing River **") $tmp = _GetCards($line) $aHands[$HandCount][7] = StringMid($tmp, 1, 2) EndSelect WEnd FileClose($file) ;_ArrayDisplay($aHands) For $x = 1 To UBound($aHands) - 1 $cards = "" For $y = 1 To 7 $cards &= "|" & $aHands[$x][$y] Next MsgBox(4096, "Hand " & $x, $cards & "|") Next Func _GetCards($string) ; returns what is in between "[ " and " ]" $sSub = StringTrimLeft($string, StringInStr($string, "[") + 1) Return StringTrimRight($sSub, 2) EndFunc ;==>_GetCards [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 22, 2008 Share Posted January 22, 2008 For the sending to another program part, you are going to have to figure out how to fill in the information. To figure this out, take it a step at a time. For me, I would start with a new script, a lot like you began this one with $card1 = "Qs" $card2 = "Ks" $card3 = "2d" $card4 = "9s" $card5 = "Ts" $card6 = "As" $card7 = "Js" ControlSend("OtherProgram", "", "Field2", $card1) ControlSend("OtherProgram", "", "Field3", $card2)oÝ÷ ØÚ0~(.ê.¶0¶ZKh¶¨¶«¦º ©®±ëax¢+Hú-¢b'"LKh~)ݶ¢ú2¢éÞyÚÞ¦Vz«¨´ëaz³ë¢ Ú«¨µ©Ýªê-'¥wj®¢Ö¬ç²Æ«Èº(«B¢{k¢P¥É-£ +»¶ì×f¢·ªºaj·¡×ªê-½ªâi¹^²è¶«qªÝ±©Ý¥êáj}ì,ç©ßÛ-¢IèÂØZ·*.q©ð¢¹-º.¢êez§vÄázz'q쨺¶Âäx ¡¶Ú-áh¬×±¶Z(¦ËajÒ,w*.{azV¬¶÷«²*'¡ûazÇ+ZÚÞ¦VzØ^2È£"¶ayªi®k«^r¦jwl¶Ûaz)ß m²0Êŧ-,!jÛajÛ!¢é]$)mçºÇv÷öÙ'£§¢è!iº.¶Ø^Á¬²¢ê趫¦º ©§yçl¶Þqè¯z+lwènëHmëb·¥·¬¢g)à)jëh×6For $x = 1 To UBound($aHands) - 1 ControlSend("OtherProgram", "", "Field1", $aHands[$x][1]) ControlSend("OtherProgram", "", "Field2", $aHands[$x][2]) ControlSend("OtherProgram", "", "Field3", $aHands[$x][3]) ControlSend("OtherProgram", "", "Field4", $aHands[$x][4]) ControlSend("OtherProgram", "", "Field5", $aHands[$x][5]) ControlSend("OtherProgram", "", "Field6", $aHands[$x][6]) ControlSend("OtherProgram", "", "Field7", $aHands[$x][7]) ControlClick("OtherProgram","","Button1") Sleep(1000) Next [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 23, 2008 Share Posted January 23, 2008 Wow, OK... I don't know where to start, your logic needs a lot of work. Nothing you added to the script is doing anything.. and the syntax... well lets not go there. What is this program you are trying to input data to? Maybe if I see it I will be able to help you more. Maybe even a screen shot of it would help. But really, the more I think about it... you are not really learning anything by me doing it for you. (not that I won't try) In general you have to think/write sequentially, meaning step-by-step. Figure out how to do a small part, then build upon it. Read the help file. It gives excellent examples on how to do things. Read other people's posts here on the forum, the way someone else tackled a problem can give you ideas on how to solve many of your own. Use the forum search feature. It is another invaluable tool. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 23, 2008 Share Posted January 23, 2008 Sending you a PM [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 23, 2008 Share Posted January 23, 2008 (edited) Here is the basics of what I think you need. You are going to have to finish it up on your own by adding several Case statements just like I've shown you and including all the code for clicking on the co-ordinates you want. expandcollapse popup#include <array.au3> Dim $aHands[1][8], $HandCount = 0, $GrabNextLine = 0 $sFile = FileOpenDialog("Select Hand History File", @ScriptDir, "Text files (*.txt)", 1 + 2) $file = FileOpen($sFile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Select Case StringInStr($line, "***** Hand History for Game") $HandCount += 1 ReDim $aHands[$HandCount + 1][8] $aHands[0][0] = $HandCount Case StringInStr($line, "** Dealing down cards **") $GrabNextLine = 1 ; set flag to grab next line Case $GrabNextLine = 1 $tmp = _GetCards($line) $aHands[$HandCount][1] = StringMid($tmp, 2, 2) $aHands[$HandCount][2] = StringMid($tmp, 5, 2) $GrabNextLine = 0 ; reset flag Case StringInStr($line, "** Dealing Flop **") $tmp = _GetCards($line) $aHands[$HandCount][3] = StringMid($tmp, 1, 2) $aHands[$HandCount][4] = StringMid($tmp, 5, 2) $aHands[$HandCount][5] = StringMid($tmp, 9, 2) Case StringInStr($line, "** Dealing Turn **") $tmp = _GetCards($line) $aHands[$HandCount][6] = StringMid($tmp, 1, 2) Case StringInStr($line, "** Dealing River **") $tmp = _GetCards($line) $aHands[$HandCount][7] = StringMid($tmp, 1, 2) EndSelect WEnd FileClose($file) ;_ArrayDisplay($aHands) For $x = 1 To UBound($aHands) - 1 ; this loops through all of the hands and $x = the hand number For $y = 1 To 7 ; loops through all the cards in the hand and $y = the card number If $aHands[$x][$y] = "" Then ; if the card is blank then the hand ended early $card = "EE" _ClickButtons($card) ExitLoop EndIf _ClickButtons($aHands[$x][$y]); send the current card to be clicked Next Next Func _GetCards($string) ; returns what is in between "[ " and " ]" $sSub = StringTrimLeft($string, StringInStr($string, "[") + 1) Return StringTrimRight($sSub, 2) EndFunc ;==>_GetCards Func _ClickButtons($sCard) $value = StringMid($sCard, 1, 1) ; grab the first letter (i.e. if the card was "2h" then $value = "2" $suit = StringMid($sCard, 2, 1) ; grab the second letter (i.e. if the card was "2h" then $value = "h" Select Case $value = "2" ; put in code to click on the 2 button Case $value = "3" ; put in code to click on the 3 button ; ; ------------------------------------------------------------------------------------------ ; Now make a case statement for all of the rest of the values (4-A) using the examples above ; ------------------------------------------------------------------------------------------ ; Case $value = "E" ; put in the code for having it click on the hand end early button EndSelect Select Case $suit = "h" ; put in the code to click on hearts Case $suit = "c" ; put in the code to click on clubs Case $suit = "d" ; put in the code to click on diamonds Case $suit = "s" ; put in the code to click on spades EndSelect EndFunc ;==>_ClickButtons [edit] hold on.. got to change something [edit2] OK, that should get you going. Read the comments I made in the code to understand what you need to do. Edited January 23, 2008 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 24, 2008 Share Posted January 24, 2008 (edited) expandcollapse popup#include <array.au3> Dim $aHands[1][8], $HandCount = 0, $GrabNextLine = 0 $sFile = FileOpenDialog("Select Hand History File", @ScriptDir, "Text files (*.txt)", 1 + 2) $file = FileOpen($sFile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop Select Case StringInStr($line, "***** Hand History for Game") $HandCount += 1 ReDim $aHands[$HandCount + 1][8] $aHands[0][0] = $HandCount Case StringInStr($line, "** Dealing down cards **") $GrabNextLine = 1; set flag to grab next line Case $GrabNextLine = 1 $tmp = _GetCards($line) $aHands[$HandCount][1] = StringMid($tmp, 2, 2) $aHands[$HandCount][2] = StringMid($tmp, 5, 2) $GrabNextLine = 0; reset flag Case StringInStr($line, "** Dealing Flop **") $tmp = _GetCards($line) $aHands[$HandCount][3] = StringMid($tmp, 1, 2) $aHands[$HandCount][4] = StringMid($tmp, 5, 2) $aHands[$HandCount][5] = StringMid($tmp, 9, 2) Case StringInStr($line, "** Dealing Turn **") $tmp = _GetCards($line) $aHands[$HandCount][6] = StringMid($tmp, 1, 2) Case StringInStr($line, "** Dealing River **") $tmp = _GetCards($line) $aHands[$HandCount][7] = StringMid($tmp, 1, 2) EndSelect WEnd FileClose($file) ;_ArrayDisplay($aHands) For $x = 1 To UBound($aHands) - 1; this loops through all of the hands and $x = the hand number For $y = 1 To 7; loops through all the cards in the hand and $y = the card number If $aHands[$x][$y] = "" Then; if the card is blank then the hand ended early $card = "EE" _ClickButtons($card) ExitLoop EndIf _ClickButtons($aHands[$x][$y]); send the current card to be clicked Select Case $y = 2 _ClickOK() Case $y = 5 _ClickOK() Case $y = 6 _ClickOK() Case $y = 7 _ClickOK() EndSelect Next Next ; ; =================================================================================== ; Func _ClickOK() MouseClick("left", 123, 123, 1) ; replace 123, 123 with the loc for the OK button EndFunc ;==>_ClickOK ; ; =================================================================================== ; Func _GetCards($string); returns what is in between "[ " and " ]" $sSub = StringTrimLeft($string, StringInStr($string, "[") + 1) Return StringTrimRight($sSub, 2) EndFunc ;==>_GetCards Func _ClickButtons($sCard) AutoItSetOption("MouseCoordMode", 0);Set MouseCoordMode to relative to window WinActivate(" Card KeyPad", "") $value = StringMid($sCard, 1, 1); grab the first letter (i.e. if the card was "2h" then $value = "2" $suit = StringMid($sCard, 2, 1); grab the second letter (i.e. if the card was "2h" then $suit = "h" Select Case $value = "2" MouseClick("left", 67, 76, 1) ; put in code to click on the 2 button Case $value = "3" MouseClick("left", 100, 76, 1) ; put in code to click on the 3 button Case $value = "4" MouseClick("left", 130, 76, 1) ; put in code to click on the 4 button Case $value = "5" MouseClick("left", 163, 76, 1) ; put in code to click on the 5 button Case $value = "6" MouseClick("left", 67, 110, 1) ; put in code to click on the 6 button Case $value = "7" MouseClick("left", 100, 110, 1) ; put in code to click on the 7 button Case $value = "8" MouseClick("left", 130, 110, 1) ; put in code to click on the 8 button Case $value = "9" MouseClick("left", 163, 110, 1) ; put in code to click on the 9 button Case $value = "T" MouseClick("left", 67, 140, 1) ; put in code to click on the T button Case $value = "J" MouseClick("left", 100, 140, 1) ; put in code to click on the J button Case $value = "Q" MouseClick("left", 130, 140, 1) ; put in code to click on the Q button Case $value = "K" MouseClick("left", 163, 140, 1) ; put in code to click on the K button Case $value = "A" MouseClick("left", 67, 173, 1) ; put in code to click on the A button Case $value = "E" MouseClick("left", 46, 38, 1) ; put in the code for having it click on the hand end early button EndSelect Select Case $suit = "h" MouseClick("left", 35, 76, 1) ; put in the code to click on hearts Case $suit = "c" MouseClick("left", 35, 173, 1) ; put in the code to click on clubs Case $suit = "d" MouseClick("left", 35, 110, 1) ; put in the code to click on diamonds Case $suit = "s" MouseClick("left", 35, 140, 1) ; put in the code to click on spades EndSelect EndFunc ;==>_ClickButtons Find the part where you need to replace the locations for the OK button [edit] need to change that a bit [edit2] That should do it Edited January 24, 2008 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted January 24, 2008 Share Posted January 24, 2008 I'm done... you can figure it out all by yourself. You have been shown everything you need. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
newbiescripter Posted January 24, 2008 Author Share Posted January 24, 2008 Spookmeister thanks for all. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now