Joel Posted March 7, 2006 Share Posted March 7, 2006 Let me show you a chunk of the text file: 3/6 19:16:09.015 [Raid] Sassuke: yay our first blue of the day 3/6 19:16:10.859 [Raid] Smoochys: isCTraid on? 3/6 19:16:12.062 [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min 3/6 19:16:17.703 [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day 3/6 19:17:57.875 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,65/UPD:46 3/6 19:17:58.171 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,47/EVT:5/ATT:Pipa,2255,58696,Y,GK60,,Praetorian Knight`l,4 3/6 19:17:58.515 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,47/EVT:11/ATT:Pipa,2255,58776,Y,GK60,,Praetorian Knight`l,4 3/6 19:17:58.765 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,48/EVT:2/ATT:Reclo`ler,2256,51977,Y,?L60,,Praetorian Knight`l,3 3/6 19:17:58.781 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,48/EVT:2/ATT:Zeriel,2256,51991,Y,?H60,,Praetorian Knight`l,3 3/6 19:17:59.078 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,49/EVT:5/ATT:Reclo`ler,2255,62505,Y,HL60,,Praetorian Knight`l,3 3/6 19:17:59.390 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,49/EVT:3/ATT:Reclo`ler,2256,11319,Y,HL60,,Praetorian Knight`l,3 What I want to do is parse out everything but the following: 3/6 19:16:09.015 [Raid] Sassuke: yay our first blue of the day 3/6 19:16:10.859 [Raid] Smoochys: isCTraid on? 3/6 19:16:12.062 [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min 3/6 19:16:17.703 [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day .. and then store this in a new text file using the following format: [Raid] Sassuke: yay our first blue of the day [Raid] Smoochys: isCTraid on? [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day The parse has to search the entire text file and exclude anything but the lines that have [Raid] by them. Can anyone give me some pointers on how to go about this? I would just need some generic examples - no gui examples necessary. I'm just not very good at string separations. Thanks! [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 Let me show you a chunk of the text file: 3/6 19:16:09.015 [Raid] Sassuke: yay our first blue of the day 3/6 19:16:10.859 [Raid] Smoochys: isCTraid on? 3/6 19:16:12.062 [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min 3/6 19:16:17.703 [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day 3/6 19:17:57.875 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,65/UPD:46 3/6 19:17:58.171 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,47/EVT:5/ATT:Pipa,2255,58696,Y,GK60,,Praetorian Knight`l,4 3/6 19:17:58.515 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,47/EVT:11/ATT:Pipa,2255,58776,Y,GK60,,Praetorian Knight`l,4 3/6 19:17:58.765 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,48/EVT:2/ATT:Reclo`ler,2256,51977,Y,?L60,,Praetorian Knight`l,3 3/6 19:17:58.781 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,48/EVT:2/ATT:Zeriel,2256,51991,Y,?H60,,Praetorian Knight`l,3 3/6 19:17:59.078 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,49/EVT:5/ATT:Reclo`ler,2255,62505,Y,HL60,,Praetorian Knight`l,3 3/6 19:17:59.390 [7. pknightsZZ] Drabin: GC2/DB:Drabin,194893592,49/EVT:3/ATT:Reclo`ler,2256,11319,Y,HL60,,Praetorian Knight`l,3 What I want to do is parse out everything but the following: 3/6 19:16:09.015 [Raid] Sassuke: yay our first blue of the day 3/6 19:16:10.859 [Raid] Smoochys: isCTraid on? 3/6 19:16:12.062 [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min 3/6 19:16:17.703 [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day .. and then store this in a new text file using the following format: [Raid] Sassuke: yay our first blue of the day [Raid] Smoochys: isCTraid on? [Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min [Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day The parse has to search the entire text file and exclude anything but the lines that have [Raid] by them. Can anyone give me some pointers on how to go about this? I would just need some generic examples - no gui examples necessary. I'm just not very good at string separations. Thanks!_FileReadToArray() / For - Next Loop / StringInString(Array, '[Raid]') Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 (edited) Here, it was easy enough , and you only asked to get pointed in the direction, you didn't ask someone to do it for you!#include <file.au3> $FPath = @DesktopDir & '\testing.txt' $StringToLocate = '[Raid]' _GetRaidInfoTxt($FPath, $StringToLocate) Func _GetRaidInfoTxt($fz_Path, $s_String) Local $NewPath = StringTrimRight($fz_Path, 4) & '_RaidInfo.txt'; Create a new text file Local $nArray = '' If _FileReadToArray($fz_Path, $nArray) Then For $x = 1 To UBound($nArray) - 1 $SnS = StringInStr($nArray[$x], $s_String) If $SnS Then FileWriteLine($NewPath, StringTrimLeft($nArray[$x], ($SnS - 1))) EndIf Next Else SetError(0);'Error reading file' Return 0 EndIf EndFunc Edited March 7, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted March 7, 2006 Share Posted March 7, 2006 Here, it was easy enough , and you only asked to get pointed in the direction, you didn't ask someone to do it for you!#include <file.au3> $FPath = @DesktopDir & '\testing.txt' $StringToLocate = '[Raid]' _GetRaidInfoTxt($FPath, $StringToLocate) Func _GetRaidInfoTxt($fz_Path, $s_String) Local $NewPath = StringTrimRight($fz_Path, 4) & '_RaidInfo.txt'; Create a new text file Local $nArray = '' If _FileReadToArray($fz_Path, $nArray) Then For $x = 1 To UBound($nArray) - 1 $SnS = StringInStr($nArray[$x], $s_String) If $SnS Then FileWriteLine($NewPath, StringTrimLeft($nArray[$x], ($SnS - 1))) EndIf Next Else SetError(0);'Error reading file' Return 0 EndIf EndFuncgood job. nice looking code. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 good job. nice looking code.Heya Stranger!! Thanks! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Joel Posted March 7, 2006 Author Share Posted March 7, 2006 Heya Stranger!! Thanks! Thanks!That is exactly what I was looking for. I'll compile it and test it out shortly. [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
Joel Posted March 7, 2006 Author Share Posted March 7, 2006 Works great! Except, It's a mass parse with no enter at the end of the line. I'll have to figure out where to place an enter in the code. There's nothing special that I need to look for when doing this correct? thanks again! [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 Works great!Except, It's a mass parse with no enter at the end of the line. I'll have to figure out where to place an enter in the code. There's nothing special that I need to look for when doing this correct? thanks again!Have no idea what your talking about... 'Enter' when writing to another file like my example? Or are you sending this to some type of control? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Joel Posted March 7, 2006 Author Share Posted March 7, 2006 FileWriteLine($NewPath, StringTrimLeft($nArray[$x], ($SnS - 1))& @CRLF)) Taking a guess here. [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 (edited) FileWriteLine($NewPath, StringTrimLeft($nArray[$x], ($SnS - 1))& @CRLF)) Taking a guess here. If your trying to seperate them more than just a line, yes, that would work !! Edit: To see an actual space try this:#include <file.au3> $FPath = @DesktopDir & '\testing.txt' $StringToLocate = '[Raid]' _GetRaidInfoTxt($FPath, $StringToLocate) Func _GetRaidInfoTxt($fz_Path, $s_String) Local $NewPath = StringTrimRight($fz_Path, 4) & '_RaidInfo.txt'; Create a new text file Local $nArray = '' If _FileReadToArray($fz_Path, $nArray) Then For $x = 1 To UBound($nArray) - 1 $SnS = StringInStr($nArray[$x], $s_String) If $SnS Then $AddCRLF = StringTrimLeft($nArray[$x], ($SnS - 1)) & @CRLF & @CRLF FileWriteLine($NewPath, $AddCRLF) EndIf Next Else SetError(0);'Error reading file' Return 0 EndIf EndFunc Edited March 7, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Joel Posted March 7, 2006 Author Share Posted March 7, 2006 Hrm, two things then. first, using your script works and here is what it looks like though: [Raid] Sassuke: yay our first blue of the day[Raid] Smoochys: isCTraid on?[Raid] Mejohlnr: im still setting up my buffahoy u will have my buffs in a min[Raid] Loftus: Darnit - forgot to reactivate CTRaid - it was messing up the other day So, that's why I thought about entering a line break. But my syntax must be incorrect within the script or else something else is going on. I just want to enter a line break before the [Raid]. It looks great though - just needs a minor tweak. [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 7, 2006 Moderators Share Posted March 7, 2006 Read my edit Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Joel Posted March 7, 2006 Author Share Posted March 7, 2006 100% perfect mate - and thanks! The spacing in your new edit is "much" better. [font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font] Link to comment Share on other sites More sharing options...
seandisanti Posted March 7, 2006 Share Posted March 7, 2006 100% perfect mate - and thanks!The spacing in your new edit is "much" better."much" eh? 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