capo Posted January 21, 2009 Share Posted January 21, 2009 Hey i need some help reading files. say if i have this in a text file:te/xttextt/e/xt{/text/}texttexttexthow would i get read all of it and display in a message box without the{/text/} part?, so basically ignoring whatever is in the bracket and continue on. Link to comment Share on other sites More sharing options...
monoceres Posted January 21, 2009 Share Posted January 21, 2009 Hi and welcome to the forums Look at StringReplace() in the help file, it will do the trick Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
capo Posted January 21, 2009 Author Share Posted January 21, 2009 hey, I don't want to replace it o.o, i just want to ignore it and continue. Link to comment Share on other sites More sharing options...
BrettF Posted January 21, 2009 Share Posted January 21, 2009 Could you please post a sample of the input, and then the output you want from the text. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
capo Posted January 21, 2009 Author Share Posted January 21, 2009 Hi, The input will be like: blah blah blah blahblahblah blah { blah } blah [ blah ] ( blah ) 34 What i want is to ignore the { blah } bit, and continue on. The output would be like: blah blah blah blahblahblah blah blah [ blah ] ( blah ) 34 I can use stringreplace to get rid of it, but i want some other way to do it(without deleting the { blah }). so i just want it to IGNORE it, kind of like autoit's comment (. Link to comment Share on other sites More sharing options...
iHonda Posted January 21, 2009 Share Posted January 21, 2009 if ur gonna ignore it why not just get rid of it? A great place to start Autoit 1-2-3 Link to comment Share on other sites More sharing options...
capo Posted January 21, 2009 Author Share Posted January 21, 2009 I just said that i wanted some other way and be like autoit's comment ( ; ) ? Link to comment Share on other sites More sharing options...
BrettF Posted January 21, 2009 Share Posted January 21, 2009 Seems to work okay for plain line by line parsing... $text = "blah blah blah" & @LF $text &= "blahblahblah" & @LF $text &= "blah" & @LF $text &= "{" & @LF $text &= "blah" & @LF $text &= "}" & @LF & @LF $text &= "blah" & @LF $text &= "[" & @LF $text &= "blah" & @LF $text &= "]" & @LF & @LF $text &= "(" & @LF $text &= "blah" & @LF $text &= ")" & @LF $text &= "34" & @LF $new_text = "" $skip = False $split = StringSplit($text, @LF) For $i = 1 To $split[0] Select Case StringInStr($split[$i], "}") $skip = False ContinueLoop Case $skip ContinueLoop Case StringInStr ($split[$i], "{") $skip = True ContinueLoop Case Else $new_text &= $split[$i] & @LF EndSelect Next MsgBox (0, "", $text) MsgBox (0, "", $new_text) Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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