Trying to amend the VBScript in a standard filter

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

DM_Cal
Posts: 10
Joined: Thu Oct 18, 2007 9:08 pm

Trying to amend the VBScript in a standard filter

Postby DM_Cal » Fri Dec 19, 2008 8:58 pm

Hello
I was trying to create a new filter based on an existing standard filter. The standard filter is 'rename files according to contents.fll'

I want to change it so that rather than it creating a 'rename' line for each line in the input I just want a file created with only one rename line (i.e if I have an input file with 5 lines I only want 1 output rename line not 5). I've tried taking out the looping part of the below script but my VBS is just not good enough and it doesn't work. Can you advise how I get this filter to create a file with only one rename command line on it? I think the section that needs changing is below but I am not sure how...

'Our filename counter
dim fileNumber
Dim fso, f1

'Called for every line in the file
function processLine(line, EOL)
recid = line

f1.WriteLine( "ren """ & TextPipe.fullInputFilename & """ """ & _
newFilename & recid & newFileExtension & """" )

processLine = line & EOL
end function

thanks

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Trying to amend the VBScript in a standard filter

Postby DataMystic Support » Mon Jan 05, 2009 9:08 am

Instead of using the processLine function, use the endFile function.
You haven't defined your new filename variable anywhere...
eg.

Code: Select all

'Our filename counter
dim fileNumber
Dim fso, f1, recid

function processLine(line, EOL)
  recid = line
  processLine = line & EOL
end function


sub startJob()
end sub


sub endJob()
end sub


function startFile()
  startFile = ""
end function


'Called before each file is closed -
'flush all pending file output here
function endFile()
  endFile = ""
  f1.WriteLine( "ren """ & TextPipe.fullInputFilename & """ """ & _
    newFilename & recid & newFileExtension & """" )
end function
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests