TextPipe COM API Reference | DataMystic
TextPipe COM API Reference
Complete COM object reference for programmatic control of TextPipe Pro. Use these objects to automate data transformations, batch file processing, and text mining from any COM-capable language.
regsvr32 TextPipe.dll (run as Administrator).
COM Object Instantiation
TextPipe exposes two COM objects. Create an instance using the standard COM instantiation method for your language:
| Language | Instantiation Code |
|---|---|
| VBScript | Set oTP = CreateObject("TextPipe.Application") |
| PowerShell | $tp = New-Object -ComObject TextPipe.Application |
| Python (pywin32) | tp = win32com.client.Dispatch("TextPipe.Application") |
| JavaScript/JScript | var oTP = new ActiveXObject("TextPipe.Application"); |
| C# | dynamic tp = Activator.CreateInstance(Type.GetTypeFromProgID("TextPipe.Application")); |
TextPipe.Application Object
The primary automation object. Use TextPipe.Application to load filters,
specify input/output files, execute transformations, and control the TextPipe engine.
Methods
LoadFilter(FilterPath As String) As Boolean
Loads a TextPipe filter list file (.fll) into the current session.
| Parameter | Type | Description |
|---|---|---|
FilterPath |
String | Full path to the .fll filter file to load |
Returns: Boolean — True if the filter was loaded successfully, False otherwise.
AddInputFile(FilePath As String) As Boolean
Adds a file to the input file list for processing.
| Parameter | Type | Description |
|---|---|---|
FilePath |
String | Full path to the input file to add |
Returns: Boolean — True if the file was added successfully.
AddInputFolder(FolderPath As String, FileMask As String, IncludeSubfolders As Boolean) As Boolean
Adds all matching files from a folder to the input file list.
| Parameter | Type | Description |
|---|---|---|
FolderPath |
String | Full path to the input folder |
FileMask |
String | Wildcard file mask (e.g., "*.txt", "*.csv") |
IncludeSubfolders |
Boolean | True to recursively include subfolders |
Returns: Boolean — True if the folder was added successfully.
ClearInputFiles()
Removes all files from the input file list.
Returns: None (void).
Go() As Long
Executes the loaded filter against all input files. Blocks until processing is complete.
Returns: Long — The number of files processed successfully.
Quit()
Closes the TextPipe application and releases all COM resources. Always call this method when finished to avoid memory leaks.
Returns: None (void).
GetLastError() As String
Returns the error message from the last failed operation.
Returns: String — Error description, or empty string if no error occurred.
GetVersion() As String
Returns the TextPipe version string.
Returns: String — Version string (e.g., "12.5.1").
Properties
| Property | Type | Access | Description |
|---|---|---|---|
OutputFile |
String | Read/Write | Path to the output file. When set, all processed output is written to this single file. |
OutputFolder |
String | Read/Write | Path to the output folder. Each input file produces a corresponding output file in this folder. |
OverwriteOutput |
Boolean | Read/Write | When True, existing output files are overwritten without prompting. Default: False. |
LogFile |
String | Read/Write | Path to the log file. Set to empty string to disable logging. |
Silent |
Boolean | Read/Write | When True, suppresses all dialog boxes and UI prompts. Essential for unattended automation. Default: False. |
InputFileCount |
Long | Read Only | Number of files currently in the input file list. |
FilesProcessed |
Long | Read Only | Number of files processed in the last Go() call. |
Visible |
Boolean | Read/Write | Controls whether the TextPipe window is visible during automation. Default: False. |
TextPipe.FilterWindow Object
Provides programmatic access to the filter list for creating, modifying, and managing
filters without loading from a .fll file. Obtain a reference via
TextPipe.Application.FilterWindow.
Methods
AddFilter(FilterType As String) As Long
Adds a new filter of the specified type to the filter list.
| Parameter | Type | Description |
|---|---|---|
FilterType |
String | The filter type name (e.g., "Search and Replace", "Remove Lines", "Add Line Numbers") |
Returns: Long — The index of the newly added filter in the list (0-based).
RemoveFilter(Index As Long) As Boolean
Removes the filter at the specified index from the filter list.
| Parameter | Type | Description |
|---|---|---|
Index |
Long | Zero-based index of the filter to remove |
Returns: Boolean — True if the filter was removed successfully.
SetFilterProperty(Index As Long, PropertyName As String, Value As Variant) As Boolean
Sets a property on an existing filter.
| Parameter | Type | Description |
|---|---|---|
Index |
Long | Zero-based index of the filter |
PropertyName |
String | Name of the property (e.g., "SearchText", "ReplaceText", "CaseSensitive") |
Value |
Variant | New value for the property |
Returns: Boolean — True if the property was set successfully.
GetFilterProperty(Index As Long, PropertyName As String) As Variant
Retrieves the value of a property from an existing filter.
| Parameter | Type | Description |
|---|---|---|
Index |
Long | Zero-based index of the filter |
PropertyName |
String | Name of the property to retrieve |
Returns: Variant — The property value.
ClearFilters()
Removes all filters from the filter list.
Returns: None (void).
SaveFilterList(FilePath As String) As Boolean
Saves the current filter list to a .fll file.
| Parameter | Type | Description |
|---|---|---|
FilePath |
String | Full path where the .fll file should be saved |
Returns: Boolean — True if saved successfully.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
FilterCount |
Long | Read Only | Number of filters currently in the list. |
FilterName(Index) |
String | Read Only | Returns the name/type of the filter at the given index. |
FilterEnabled(Index) |
Boolean | Read/Write | Gets or sets whether the filter at the given index is enabled. |
VBScript Examples
Basic Filter Execution
Load an existing filter file, process input files, and write output:
' Basic TextPipe COM automation example
Dim oTP
Set oTP = CreateObject("TextPipe.Application")
' Configure for unattended operation
oTP.Silent = True
oTP.Visible = False
oTP.OverwriteOutput = True
' Load a filter and specify input/output
oTP.LoadFilter "C:\Filters\cleanup_csv.fll"
oTP.AddInputFile "C:\Data\raw_export.csv"
oTP.OutputFile = "C:\Data\cleaned_export.csv"
' Execute the transformation
Dim filesProcessed
filesProcessed = oTP.Go()
If filesProcessed > 0 Then
WScript.Echo "Success: " & filesProcessed & " file(s) processed."
Else
WScript.Echo "Error: " & oTP.GetLastError()
End If
' Always release the COM object
oTP.Quit
Set oTP = Nothing
Batch Folder Processing
Process all CSV files in a folder tree:
' Process all CSV files in a folder recursively
Dim oTP
Set oTP = CreateObject("TextPipe.Application")
oTP.Silent = True
oTP.OverwriteOutput = True
' Load the transformation filter
oTP.LoadFilter "C:\Filters\standardize_dates.fll"
' Add all CSV files from folder (including subfolders)
oTP.AddInputFolder "C:\Data\Monthly_Reports", "*.csv", True
' Output to a separate folder (preserves originals)
oTP.OutputFolder = "C:\Data\Processed"
' Run the transformation
Dim count
count = oTP.Go()
WScript.Echo "Processed " & count & " of " & oTP.InputFileCount & " files."
oTP.Quit
Set oTP = Nothing
Building Filters Programmatically
Create a search-and-replace filter at runtime using the FilterWindow object:
' Build a filter list programmatically
Dim oTP, oFW
Set oTP = CreateObject("TextPipe.Application")
Set oFW = oTP.FilterWindow
oTP.Silent = True
' Clear any existing filters
oFW.ClearFilters
' Add a search-and-replace filter
Dim idx
idx = oFW.AddFilter("Search and Replace")
oFW.SetFilterProperty idx, "SearchText", "oldserver.company.com"
oFW.SetFilterProperty idx, "ReplaceText", "newserver.company.com"
oFW.SetFilterProperty idx, "CaseSensitive", False
' Add a second replacement
idx = oFW.AddFilter("Search and Replace")
oFW.SetFilterProperty idx, "SearchText", "http://"
oFW.SetFilterProperty idx, "ReplaceText", "https://"
oFW.SetFilterProperty idx, "CaseSensitive", False
' Save the filter list for reuse
oFW.SaveFilterList "C:\Filters\server_migration.fll"
' Process files
oTP.AddInputFile "C:\Config\app.config"
oTP.OutputFile = "C:\Config\app_updated.config"
oTP.OverwriteOutput = True
oTP.Go
oTP.Quit
Set oTP = Nothing
PowerShell Examples
Basic COM Automation
Invoke TextPipe from PowerShell with error handling:
# TextPipe COM automation from PowerShell
$tp = New-Object -ComObject TextPipe.Application
try {
$tp.Silent = $true
$tp.Visible = $false
$tp.OverwriteOutput = $true
# Load filter and configure
$tp.LoadFilter("C:\Filters\ebcdic_to_ascii.fll")
$tp.AddInputFile("C:\Data\mainframe_extract.dat")
$tp.OutputFile = "C:\Data\converted_output.txt"
# Execute transformation
$count = $tp.Go()
Write-Host "Successfully processed $count file(s)."
}
catch {
$errorMsg = $tp.GetLastError()
Write-Error "TextPipe error: $errorMsg"
Write-Error $_.Exception.Message
}
finally {
# Always release COM object
$tp.Quit()
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($tp) | Out-Null
[System.GC]::Collect()
}
Batch Processing with Logging
Process multiple folders with full logging:
# Batch processing with logging
$tp = New-Object -ComObject TextPipe.Application
try {
$tp.Silent = $true
$tp.OverwriteOutput = $true
$tp.LogFile = "C:\Logs\textpipe_$(Get-Date -Format 'yyyyMMdd').log"
# Load the data cleansing filter
$tp.LoadFilter("C:\Filters\data_cleansing.fll")
# Process multiple input folders
$folders = @(
"C:\Data\Sales",
"C:\Data\Marketing",
"C:\Data\Finance"
)
foreach ($folder in $folders) {
$tp.ClearInputFiles()
$tp.AddInputFolder($folder, "*.csv", $true)
$tp.OutputFolder = "$folder\Processed"
$count = $tp.Go()
Write-Host "Processed $count files from $folder"
}
Write-Host "Total files processed: $($tp.FilesProcessed)"
}
finally {
$tp.Quit()
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($tp) | Out-Null
}
Error Handling
All methods that return Boolean indicate success (True) or failure (False).
After a failure, call GetLastError() to retrieve the error description.
Common Error Codes
| Scenario | Cause | Resolution |
|---|---|---|
| CreateObject fails | COM object not registered | Run regsvr32 TextPipe.dll as Administrator, or reinstall TextPipe Pro |
| LoadFilter returns False | Filter file not found or invalid | Verify the .fll file path exists and is a valid TextPipe filter file |
| Go() returns 0 | No input files, or all files failed | Check InputFileCount is > 0 and review GetLastError() output |
| Permission denied | Output file/folder not writable | Ensure the running user has write access to the output path |
| License error | TextPipe Pro not licensed or trial expired | Activate TextPipe Pro license on the machine running the automation |