Re: Dumping changed data into a text file

Tech-Archive recommends: Fix windows errors by optimizing your registry



<verukins@xxxxxxxxxxx> wrote in message
news:1125493292.929843.289190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> hi,
> Im trying to dump the contents of an array into a text file (each on
> a new line), which is no problem. Then on the next call of the script,
> i want to check if the values already exist, and if not, append new
> lines at the end of the text file as approriate.
>
> at the moment im using Do While CSV2.AtEndOfStream <> True, but using
> that i cannot write to the file.
>
> any help much appreciated.

Const ForAppending = 8
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile("c:\test.txt",ForAppending,True)
objOTF.WriteLine("Hello World")
Set objOTF = Nothing
Set objFSO = Nothing

Save with a ".vbs" extension, run it multiple times,
then look at the file "c:\test.txt".


.



Relevant Pages

  • Re: vbs to run thru list of files
    ... How do I get the list into an array similar structure to ... Dim objFSO, objFl ... Set objFSO = CreateObject ... For Each objFl In objFldr.Files ...
    (microsoft.public.scripting.vbscript)
  • Re: Scripting amateur needs help modifying script
    ... Const ForReading = 1 ... Set objFSO = CreateObject ... split it up into an array, ... if there is a match at any point through the checking the iFound ...
    (microsoft.public.windows.server.scripting)
  • Re: Scripting oddity
    ... Try using Option Explicit, and not using a global On Error Resume Next, ... Dim objFSO ... Dim ulist, urec ... Set objFSO = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: Problem with CopyFile
    ... > Here's the meat of the script: ... > Dim strSourceFolder, strTargetFolder ... > Dim objFso ... > Set objFso = Nothing ...
    (microsoft.public.scripting.vbscript)
  • Re: vbs to run thru list of files
    ... Dim objFSO, objFl ... Set objFSO = CreateObject ... For Each objFl In objFldr.Files ... In view of your much greater level of expertise in vb scripting ...
    (microsoft.public.scripting.vbscript)