DYNAMIC FILENAMES

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

NPPI_Active
Posts: 4
Joined: Fri Aug 21, 2009 2:12 pm

DYNAMIC FILENAMES

Postby NPPI_Active » Fri Aug 21, 2009 2:42 pm

I have a fll that adds a file header from another file. Sweet.

I now have a situation where I have the file being loaded is "A<<NAME_X>>.txt" and I want to load "H<<NAME_X>>.txt" from the same folder.

So the folder contains:
AFred.txt
ABarney.txt
HFred.txt
HBarney.txt

And I want AFred.txt to load HFred.txt as a header and the same for ABarney.txt loading HBarney.txt but i dont want to create 2 filters! I want one filter to recognise which file is being used and then apply the correct header. One filter! Please tell me its possible........

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

Re: DYNAMIC FILENAMES

Postby DataMystic Support » Mon Aug 24, 2009 9:41 pm

Try this:

Load Fred into an environment variable, and change the 'header' filename to refer to that env var, e.g. c:\H%NAME%.txt

Code: Select all

In a batch file:
set NAME=Fred
textpipe.exe /f=myfilter.fll A%NAME%.txt /g /q
set NAME=Barney
textpipe.exe /f=myfilter.fll A%NAME%.txt /g /q


You can also script the whole lot from vbscript e.g.

Code: Select all

VBScript:
Set vb_TextPipeApp = CreateObject("TextPipe.Application")
Set vb_TPWindow = vb_TextPipeApp.newWindow
loop here over all names
  TPWindow.clearAllFiles
  TPWindow.addFile "A<name>.txt", 0, 1
  TPWindow.clearAllFilters
  f1 = TPWindow.addStringFilterFile( 19, "H<name>.txt", false )
  vb_TPWindow.execute
 
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

NPPI_Active
Posts: 4
Joined: Fri Aug 21, 2009 2:12 pm

Re: DYNAMIC FILENAMES

Postby NPPI_Active » Thu Sep 03, 2009 12:56 am

Used the Environment variable solution. Works a treat.

Thanks! :D


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

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 1 guest