Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


write to the next line in a text file

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> write to the next line in 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 >>
 write to the next line in a text file - 6/10/2005 8:05:44 PM   
  gibbo1715

 

Posts: 52
Score: 0
Joined: 6/8/2005
From:
Status: offline
I have managed to get the code below to write to a text file on my c drive

how do i get it to add the text at the end of the text file instead of replacing it?

<script type="text/vbscript">

Option Explicit

Dim strSearchString, strOutputName, objFSO, objOutputFile


Set objFSO = CreateObject("Scripting.FileSystemObject")


strSearchString = "hello"
strOutputName = "C:\Documents and Settings\Paul\My Documents\Workinprogress\output.txt"

Set objOutputFile = objFSO.createTextFile(strOutputName,True)

objOutputFile.WriteLine strSearchString

</script>

Thanks

Gibbo
 
 
Post #: 1
 
 Re: write to the next line in a text file - 6/10/2005 8:14:45 PM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
objOutputFile.EndOfLine

(in reply to gibbo1715)
 
 
Post #: 2
 
 Re: write to the next line in a text file - 6/10/2005 8:18:07 PM   
  gibbo1715

 

Posts: 52
Score: 0
Joined: 6/8/2005
From:
Status: offline
sorry that gave an error but got this to work

<script type="text/vbscript">

Option Explicit

Dim strSearchString, strOutputName, objFSO, objOutputFile

Const FOR_Appending = 8

Set objFSO = CreateObject("Scripting.FileSystemObject")


strSearchString = "hello"
strOutputName = "C:\Documents and Settings\Paul\My Documents\Workinprogress\output.txt"

Set objOutputFile = objFSO.OpenTextFile(strOutputName, FOR_Appending, True)

objOutputFile.WriteLine strSearchString

How do I add a blank line between my inputs? add a break between my inputs

(in reply to gibbo1715)
 
 
Post #: 3
 
 Re: write to the next line in a text file - 6/10/2005 8:44:58 PM   
  gibbo1715

 

Posts: 52
Score: 0
Joined: 6/8/2005
From:
Status: offline
objOutputFile.WriteLine strSearchString & vbCrLf seems to work to put on a blank line as well for anyone else who has a similar problem to mine, i am reading the result from a button using the following code

<form name="frm2">
<div align="left"><p>   <input TYPE="button" NAME="cmdOpenNewWin" value="Open" size="62"> </p>
</div>
</form>

<script Language="VBScript">
sub cmdOpenNewWin_OnClick
window.Navigate "C:\Documents and Settings\Paul\My Documents\Workinprogress\output.txt", "MyNewWin"
End sub
</script>

Thanks everyone for getting me this far

(in reply to gibbo1715)
 
 
Post #: 4
 
 
 
  

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 >> write to the next line in 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