Page 1 of 1

Creat File names from List

Posted: Fri Oct 15, 2010 2:40 pm
by japanese
Maybe this can be done and I haven't figured it out.

I have a list of say car models. I want to input each model individually into a specific file in a specific place and output each file with the model as the file name. ie if there are 100 models then there would be 100 files output, each with the specific file name inside a specific place in the file.

eg, target file content = This is a {input variable from list}

one model in the list is Corrolla.

output:

File content = This is a Corolla.
File name = Corolla.htm

next model in the list is Landcruiser.

output:

File content = This is a Landcruiser.
File name = Landcruiser.htm

I hope this makes sense. Can it be done? If not, it owuld be a usedful feature 9for me in any case!)

Tony.

Re: Creat File names from List

Posted: Mon Oct 18, 2010 7:52 am
by DataMystic Support
Hi Tony,

You can easily do this by converting your filter to jscript or vbscript:

Code: Select all

'The global TextPipe Application object
dim vb_TextPipeApp
'The global TextPipe Filter Window
dim vb_TPWindow

  Set vb_TextPipeApp = CreateObject("TextPipe.Application")
  Set vb_TPWindow = vb_TextPipeApp.newWindow



..for loop for each car_name..

car_name = list[ index ]

dim f1,f2,f3,f4,f5,f6

TPWindow.startFilters
TPWindow.clearAllFilters
TPWindow.logEnabled = false
TPWindow.logFilename = "textpipe.log"
TPWindow.logAppend = true
TPWindow.logThreshold = 500
TPWindow.inputMode = 1
TPWindow.inputBinaryFiles = 0
TPWindow.inputBinarySampleSize = 100
TPWindow.inputPromptOnEach = false
TPWindow.inputPromptOnReadOnly = false
TPWindow.inputDeleteFiles = false
TPWindow.inputInsideCompressed = true
f1 = TPWindow.addReplaceFilter( "{input variable from list}", car_name, 0, false, false, false, false, false, false, false, 0 )
TPWindow.outputMode = 2
TPWindow.outputMergeFile = "c:\car name.txt"
TPWindow.endFilters


'File List:
TPWindow.clearAllFiles
TPWindow.addFile "c:\" _ car_name _ ".txt", 0, 1
if vb_TPWindow.execute = false then MsgBox "ERROR " & vbCrLF & vb_TPWindow.errorText

..end for loop