Jump to content

VBS file i/o help!


Recommended Posts

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 rtv
set ff=createobject("scripting.filesystemobject")
set rr=ff.opentextfile("C:\Documents and Settings\Sean\Desktop\New Folder\file.txt",1)
aa = rr.readall
rr.close
rtv = StrReverse(aa)
set bb=ff.opentextfile("C:\Documents and Settings\Sean\Desktop\New Folder\file.txt",2)
bb.write rtv

yet 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 you

bye :hello:

Link to comment
Share on other sites


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.AtEndOfStream
rr = ts.ReadLine
If InStr(rr,"Don't reverse") >0 Then
MsgBox rr
End If
Loop

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...