n9mfk9 Posted August 22, 2008 Share Posted August 22, 2008 I am trying to write a script to read 8 files my question is how do make this i went to start here <!-- Begin wordpress code --> copy every between an end it here <!-- end wordpress code --> $file = FileOpen("metar2.txt", 0) $fileout = FileOpen("test.txt", 1) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ;MsgBox(0, "Line read:", $line) ;$out= StringReplace($line, '","','"> ','1') ;MsgBox(0, "Line read:", $out) ;FileWriteLine($fileout,$out) Wend FileClose($file) FileClose($fileout) thanks for any help Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 22, 2008 Share Posted August 22, 2008 I am trying to write a script to read 8 files my question is how do make this i went to start here <!-- Begin wordpress code --> copy every between an end it here <!-- end wordpress code --> $file = FileOpen("metar2.txt", 0) $fileout = FileOpen("test.txt", 1) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ;MsgBox(0, "Line read:", $line) ;$out= StringReplace($line, '","','"> ','1') ;MsgBox(0, "Line read:", $out) ;FileWriteLine($fileout,$out) Wend FileClose($file) FileClose($fileout) thanks for any help Not enough information. What you said you want does not match the code. You seem to want to modify every line before writing it out. If all you really wanted was to copy everything between two tags you could code it in about three or four lines. What are you really wanting to do? What's with the commented-out code? Exactly what do you want to get from the input, what do want to change about it before you write it? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
n9mfk9 Posted August 22, 2008 Author Share Posted August 22, 2008 Hi PsaltyDS, i jut went to go throw 9 files archive.php archives.php page.php search.php index.php header.php single.php attachment.php grab every thing from <!-- Begin wordpress code --> copy every between an end it here <!-- end wordpress code --> an then no changes write it out to the same file name just put it on anoter folder thanks for any help beau Link to comment Share on other sites More sharing options...
Uten Posted August 22, 2008 Share Posted August 22, 2008 I would extract the code with StringRegExp and write out the result. Or you could read the files line by line and use StringInStr and make your own parser. Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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