Hello to all,
can't solve problem with adding lines to the header of the file from the another file.
So I have list of files in "Files to process". For each of them required to add Header from the another file. Each line of this "another file" contains couple words. The number of file in "Files to process" and lines in file with the headers are equal.
I suppose that in Textpipe may be have some loop function, but i can find
If somebody know how to make Textpipe work that it will be very helpfull for me and other users of this wonderful soft.
Regards,
Ace Foster
Problem with adding lines to the header
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Problem with adding lines to the header
Hi Ace,
So every file needs a different header? How many files are we talking about?
You could easily use Filters\Special\Script (VBScript,JScript...) and embed the list of headers as an array, then simply substitute the correct one in each file and increase the array index each time.
So every file needs a different header? How many files are we talking about?
You could easily use Filters\Special\Script (VBScript,JScript...) and embed the list of headers as an array, then simply substitute the correct one in each file and increase the array index each time.
Re: Problem with adding lines to the header
Thanks for the answer Simon,
Yes, every file need a different header, and this header must not repeat.So every file needs a different header?
The number of files is about 90-100.How many files are we talking about?
I have some knowledge only in PHP, so writing on VBScript & JScript are the problem. If there some VBScript & JScript samples that could help me ?You could easily use Filters\Special\Script (VBScript,JScript...) and embed the list of headers as an array, then simply substitute the correct one in each file and increase the array index each time.
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Problem with adding lines to the header
Something like this; it assumes the header filename is called *.header:
Code: Select all
Const OpenFileForReading = 1
Dim fso, TextStream
function processLine(line, EOL)
processLine = line & EOL
end function
sub startJob()
Set fso = CreateObject("Scripting.FileSystemObject")
end sub
sub endJob()
'do nothing
end sub
function startFile()
Dim fileContents
Dim filename
filename = TextPipe.fullInputFilename & ".header"
'ignore the error if the file is not found
on error resume next
fileContents = "** " & filename & " was not found **"
'read what's in the file
Set TextStream = fso.OpenTextFile( filename, OpenFileForReading)
fileContents = TextStream.ReadAll
TextStream.close
startFile = fileContents
end function
function endFile()
endFile = ""
end function