Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Why don?t anyone answer me ??? How can I...read..f

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,884
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Why don?t anyone answer me ??? How can I...read..f
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Why don?t anyone answer me ??? How can I...read..f - 7/30/2003 5:35:30 AM   
  fahbio

 

Posts: 3
Score: 0
Joined: 7/10/2003
From:
Status: offline
how can I read a text file and then write into a new text file using vbscript?????

any help would be great......
please contact me,
fabioh182@yahoo.com.br


ps. I gotta use this on my work otherwise there?re gonna fire me.... ;-!

thanks a lot!

[]?s [8]

fahbio
 
 
Post #: 1
 
 Re: Why don?t anyone answer me ??? How can I...read..f - 7/7/2004 1:49:00 AM   
  Thinker302002

 

Posts: 1
Score: 0
Joined: 7/7/2004
From:
Status: offline
Read:

Dim objFSO , objFile
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Server.MapPath("testfile.txt") , 1)
Response.Write (objFile.ReadAll)
objFile.Close
Set objFSO = Nothing
Set objFile = Nothing

Write:
Option Explicit

' Set up Constants
Const ForWriting = 2 ' Input OutPut mode
Const Create = True

Dim MyFile
Dim FSO ' FileSystemObject
Dim TSO ' TextStreamObject

' Use MapPath function to get the Physical Path of file

MyFile = Server.MapPath("textfile.txt")

Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)

TSO.write "This is first line in this text File" & vbcrlf
' Vbcrlf is next line character
TSO.write "This is Second line in this text file" & vbcrlf
TSO.write "Writen by devasp visitor at " & Now()
TSO.WriteLine ""

Response.Write " Three lines are writen to textfile.txt <br>"
Response.Write " Local time at server is " & Now()

' close TextStreamObject and
' destroy local variables to relase memory
TSO.close
Set TSO = Nothing
Set FSO = Nothing

the rest you should be able to handle...

(in reply to fahbio)
 
 
Post #: 2
 
 Re: Why don?t anyone answer me ??? How can I...read..f - 7/7/2004 10:32:47 AM   
  vbBeginner

 

Posts: 2
Score: 0
Joined: 7/7/2004
From:
Status: offline
Can some body please help. I wrote the following piece of code and get an error Path Not Found.

path = "\\access\Tools\Logs\"
dir = "Default"
Set filesystem = Server.CreateObject("Scripting.FileSystemObject")
Set folder = filesystem.GetFolder(Server.Mappath(path & dir))
Set filecollection = folder.Files
For Each file in filecollection
response.write file.name & "<br>"
Next


Event if when I tried to replace it by the line:
Set folder = filesystem.GetFolder(Server.Mappath("\\access\Tools\Logs\Default"))

However, if I have it as:
Set folder = filesystem.GetFolder("C:\")
then it give me some out put eventhough I don't know wherethere it is listing my C: drive on my PC or the C: drive on the server.

More explanation would help

(in reply to fahbio)
 
 
Post #: 3
 
 Re: Why don?t anyone answer me ??? How can I...read..f - 7/9/2004 5:20:00 AM   
  EDLiN

 

Posts: 4
Score: 0
Joined: 7/9/2004
From: USA
Status: offline
Well since I dont have access to your system, I would be difficult to troubleshoot the \\access\tools\logs path. I suggest you look at the location of \\access and determine if it might be better to logically map a drive to the access\tools\logs\default location and then point your getfolder to the x:\ instead.

(in reply to fahbio)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Why don?t anyone answer me ??? How can I...read..f Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts