Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Writing to a Text File

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Writing to a Text File
  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 >>
 Writing to a Text File - 7/6/2001 11:56:36 PM   
  Slayer73

 

Posts: 17
Score: 0
Joined: 6/27/2001
From: USA
Status: offline
~imav8n
You are the goods. Now I have a different question. What script do I use if I want to writer data that is being written to a small Access database to a TEXT file. Please Help!!
 
 
Post #: 1
 
 Re: Writing to a Text File - 7/7/2001 10:10:27 AM   
  nukeboy

 

Posts: 10
Score: 0
Joined: 5/22/2001
From: USA
Status: offline
Slayer,

This is a sample code from learnasp.com to write to a text file using file system object

<html><head>
<TITLE>txtwrite.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%
whichFN=server.mappath("/upload/tests/tempfile.txt")

' first, create the file out of thin air
Set fstemp = server.CreateObject("Scripting.FileSystemObject")
Set filetemp = fstemp.CreateTextFile(whichFN, true)
' true = file can be over-written if it exists
' false = file CANNOT be over-written if it exists

filetemp.WriteLine("This is a brand new file!!!!")
filetemp.writeblanklines(3)
filetemp.WriteLine("This is the last line of the file we created!")
filetemp.Close

' Now open it and add some lines
forappending =8
set filetemp=fstemp.OpentextFile(whichFN, forappending)
filetemp.writeline "a line we added later"
filetemp.writeline "another line we added later..."
filetemp.close

set filetemp=nothing
set fstemp=nothing

If err.number=0 then
response.write "File was appended sucessfully!"
else
response.write "VBScript Errors Occured!<br>"
response.write "Error Number=#<b>" & err.number & "</b><br>"
response.write "Error Desc. =<b>" & err.description & "</b><br>"
response.write "Help Path =<b>" & err.helppath & "</b><br>"
response.write "Native Error=<b>" & err.nativeerror & "</b><br>"
response.write "Error Source =<b>" & err.source & "</b><br>"
response.write "SQL State=#<b>" & err.sqlstate & "</b><br>"
end if


%>
</body></html>

Hope this helps

(in reply to Slayer73)
 
 
Post #: 2
 
 Re: Writing to a Text File - 7/9/2001 11:57:44 AM   
  Slayer73

 

Posts: 17
Score: 0
Joined: 6/27/2001
From: USA
Status: offline
Thank You very much nukeboy that was very helpful. I hope to be of help to you sometime, however, i am a beginner

(in reply to Slayer73)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Writing to a Text File 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