Freaky Posted May 2, 2005 Share Posted May 2, 2005 edit. I deleted my first question for those who read it, i found out how to do what i wanted "reverse the contents of a file" here:dim rtvset ff=createobject("scripting.filesystemobject")set rr=ff.opentextfile("C:\Documents and Settings\Sean\Desktop\New Folder\file.txt",1)aa = rr.readallrr.closertv = StrReverse(aa)set bb=ff.opentextfile("C:\Documents and Settings\Sean\Desktop\New Folder\file.txt",2)bb.write rtvyet i still have a problem. What i now need to do is reverse everything under the word "Dont reverse" so for example i have a file with this contents:file:Dont reverse this line!reverse this line!and so on. so anything under the words "dont reverse this line" will be reversed! hope you understand?thank youbye Link to comment Share on other sites More sharing options...
dman Posted May 3, 2005 Share Posted May 3, 2005 Process line by line and loop before reversing string when test for "Dont Reverse" = Trueuse readline not readallhttp://msdn.microsoft.com/library/default....mthreadline.asp Link to comment Share on other sites More sharing options...
Fredledingue Posted May 3, 2005 Share Posted May 3, 2005 This shows how to read line by line (without hiting an error at the end) and show a msg box when the line include "Don't reverse".'--------read from file-----------Set f = fso.GetFile("temp.txt")Set ts = f.OpenAsTextStream(ForReading, Tristatefalse)Do Until ts.AtEndOfStreamrr = ts.ReadLineIf InStr(rr,"Don't reverse") >0 ThenMsgBox rrEnd IfLoop 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