AutoChris Posted April 1, 2004 Share Posted April 1, 2004 I need to extract some text from a file and I'm not sure how to do it. Here is an example of what I need to do.From: EarthLink High Speed Internet Team <dslsales@earthlink.net>Subject: EarthLink High Speed Internet -- 6 Months for $29.95 per Month!**Date: Fri, 19 Mar 2004 05:48:57 PDTX-Accept-Language: enMIME-Version: 1.0Content-Type: multipart/alternative; types="text/plain,text/html";I have to extract the entire Subject line (minus "Subject: ") and leave just what the subject is and put it in a text file. In fact, I have to go through about 100 text files (named MSG1.TXT through MSG100.txt) and do the same exact thing, putting all of the subjects in a single text file.Does anybody know how this can be accomplished? Link to comment Share on other sites More sharing options...
scriptkitty Posted April 2, 2004 Share Posted April 2, 2004 Something like this perhapse, if your file stays standard $file="something.htm" $everything=FileRead($file,FileGetSize($file)) while 1 if StringInstr($everything,"Subject: ")=0 then ExitLoop $len=StringInstr($everything,"Subject: ")+9 $line=StringMid($everything,$len,StringInStr($everything,"Date: ")-$len-1) FileWriteLine("tempfile.txt",$line&@CRLF) $everything=StringTrimLeft($everything,StringInstr($everything,"Date: ")) wend AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
AutoChris Posted April 2, 2004 Author Share Posted April 2, 2004 Genius! Thank you, scriptkitty! Yes, with only slight modifications to account for the file names, that will work perfectly! 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