I am automating the combining of 2 text files and need to now how to copy 2
lines from "title.txt" file to "daily.txt". Then copy all of "c2daily.txt"
to "daily.txt"
I have found how to append c2daily.txt to daily.txt, but can not find how to
copy the two lines from title.txt to daily.txt first. Can any one help me
with this script?

Re: Copying two lines of text. by Alex

Alex
Sat Jan 17 10:57:05 CST 2004

The first two lines? If not, how are you locating them?

Risrollout wrote:
> I am automating the combining of 2 text files and need to now how to
> copy 2 lines from "title.txt" file to "daily.txt". Then copy all of
> "c2daily.txt" to "daily.txt"
> I have found how to append c2daily.txt to daily.txt, but can not find
> how to copy the two lines from title.txt to daily.txt first. Can any
> one help me with this script?



Re: Copying two lines of text. by Michael

Michael
Sun Jan 18 15:23:26 CST 2004


"Risrollout" <risrollout@hotmail.com> wrote in message news:eViNnqL3DHA.1908@TK2MSFTNGP10.phx.gbl...
: I am automating the combining of 2 text files and need to now how to copy 2
: lines from "title.txt" file to "daily.txt". Then copy all of "c2daily.txt"
: to "daily.txt"
: I have found how to append c2daily.txt to daily.txt, but can not find how to
: copy the two lines from title.txt to daily.txt first. Can any one help me
: with this script?


Something to start you off - you'll have to work out what 2 lines you want

Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 8
dim fso, lines, file2, newFile
set fso = CreateObject("Scripting.FileSystemObject")
set newFile = fso.OpenTextFile("c:\testB.txt", ForWriting,true) '= daily.txt
file2 = fso.OpenTextFile("c:\testA.txt", ForReading).readall '= c2daily.txt
lines = split(fso.OpenTextFile("c:\test.txt", ForReading).readAll,vbnewline) '= title.txt
newFile.write lines(1) & vbnewline 'line 2 (0-based)
newFile.write lines(2) & vbnewline 'line 3
newFile.write file2
newFile.close
set newFile = nothing
set fso = nothing



Re: Copying two lines of text. by Risrollout

Risrollout
Sun Jan 18 21:07:43 CST 2004

The first two lines of title.txt is what I meant to put in my first post.
:-(

In your script you have these lines;
>>>lines = split(fso.OpenTextFile("c:\test.txt",
ForReading).readAll,vbnewline) '= title.txt
> newFile.write lines(1) & vbnewline 'line 2 (0-based)
Very sweet code!!! This is what I wanted a way to chose any line in the
file.
Thanks.




"Michael Dunn" <returnToSpammer@hisDomain.com> wrote in message
news:%23HcZ1jg3DHA.2700@tk2msftngp13.phx.gbl...
>
> "Risrollout" <risrollout@hotmail.com> wrote in message
news:eViNnqL3DHA.1908@TK2MSFTNGP10.phx.gbl...
> : I am automating the combining of 2 text files and need to now how to
copy 2
> : lines from "title.txt" file to "daily.txt". Then copy all of
"c2daily.txt"
> : to "daily.txt"
> : I have found how to append c2daily.txt to daily.txt, but can not find
how to
> : copy the two lines from title.txt to daily.txt first. Can any one help
me
> : with this script?
>
>
> Something to start you off - you'll have to work out what 2 lines you want
>
> Option Explicit
> Const ForReading = 1, ForWriting = 2, ForAppending = 8
> dim fso, lines, file2, newFile
> set fso = CreateObject("Scripting.FileSystemObject")
> set newFile = fso.OpenTextFile("c:\testB.txt", ForWriting,true)
'= daily.txt
> file2 = fso.OpenTextFile("c:\testA.txt", ForReading).readall
'= c2daily.txt
> lines = split(fso.OpenTextFile("c:\test.txt",
ForReading).readAll,vbnewline) '= title.txt
> newFile.write lines(0) & vbnewline 'line 2 (0-based)
> newFile.write lines(1) & vbnewline 'line 3
> newFile.write file2
> newFile.close
> set newFile = nothing
> set fso = nothing
>
>