softwareupdate.tv
Home Home Contact us Contact us Resources Resources Add your Manuals Add your Manuals Remove your Manuals Remove your Manuals

 
 
TextPipe: Script filter applied on VBScript, JScript, VBA, PerlScript, Python, Lisp and REXX
 
Buy TextPipe Online!

Buy TextPipe Online!

Script Filter

This filter allows you to program your own TextPipe filter in VBScript, JScript, VBA, PerlScript, Python, Lisp, REXX etc. You could use your own code to perform custom text processing, e.g. adding line numbers to the end of each line, deleting every second line, deleting every third blank line etc. You could use a message box to ask the user for some input, and then add that input to every line. Or you could invoke Excel, paste text into it, perform a complex statistical calculation and then put the result back in the file. See the example filters in the VBScript folder (such as the one to copy numeric data into an excel spreadsheet, create a 3d graph and then rotate it!). The possibilities are endless!

Script Filter

Inside an script, TextPipe provides the TextPipe internal automation object so that scripts can determine vital data about the current filter, and turn on and off sub filters according to programmed criteria.

Script Language
The script language to use. Default values are VBScript, JScript and VBA, but you can download and install others (they will not appear in the list - you must enter them manually). TextPipe will display an error message if the language you specified is not installed.

USB data leakage prevention usb port disabler memory card undelete software
file undelete memory card compact flash undelete mac recover data sd
restore pictures digital picture restore picture recovery

Timeout (milliseconds)
Specify the timeout in milliseconds. A script will be aborted if it runs for more than the specified number of milliseconds. The default value is 10000 (i.e. 10 seconds).

Check script
This button checks the script for any errors. If there is an error, a dialog box will appear with a description of the error.

Use default
This button replaces the existing script with the default script for the current language. This can be used as a template for your own code. TextPipe comes with a default script for VBScript inbuilt, and a sample JScript script can be loaded from the VBScript folder.

Set default
This button sets the default script for the current language to the current script. The default script is language dependant, so you can have different scripts for JScript and VBScript etc.

Functions
The following functions are REQUIRED by the script filter. Each filter is followed by explanatory text.

A processing run results in a series of calls as follows:

startJob()

for each input file
startFile()

for each line of the file
processLine(...)

endFile()

endJob()

function processLine( line : string; EOL : string) : string
TextPipe calls this function for every line in the input file (if your file has 10,000 lines, this function will get called 10,000 times). The function must return the processed line with the EOL string already appended to it.

Lines can be of unlimited length, and are delimited by CR/LF, CR or LF, depending on how the file was generated. TextPipe allows a file to contain more than one kind of end of line character. If needed, you can force all end of line characters to be standard by preceding this filter with a convert end of lines filter. You can also use your own end of line character instead of EOL.

If you need to process multiple lines, paragraphs, pages of text or the entire file, the best approach is to accumulate each line and EOL into a global buffer variable, and then output the entire processed buffer in the endFile() function.

sub startJob()
Called once at the start of a processing job, before any files are processed. Use it to initialize any job-wide variables. A processing job is the combination of all filters applied at once.

sub endJob()
Called once at the end of a processing job, after all files have been processed. Use it to dispose of OLE objects etc. A processing job is the combination of all filters applied at once.

function startFile() : string
Called at the start of each file. Use it to initialize file variables. The return value is any string that must be output at the beginning of the file (header text).

Note: startFile() is ALSO called when the Script is a sub filter, for each text value that the sub filter operates on. The impact of this is that real per-file initialization/finalization needs to be performed in a script that is not inside any sub filters. Global variables set using TextPipe.setGlobalVar should be initialized in this script as well.

function endFile() : string
Called at the end of each file. The return value is any string that must be output at the end of the file (footer text). This may also be used to flush any pending output, such as when the entire file is buffered before being output.

Note: endFile() is ALSO called when the Script is a sub filter, for each text value that the sub filter operates on. The impact of this is that real per-file initialization/finalization needs to be performed in a script that is not inside any sub filters. Global variables set using TextPipe.setGlobalVar should be initialized in this script as well.

Global variables
You can declare global variables at the top of the script (see the 'a' variable below). You should initialize these values in the startJob() function, and dispose of them (e.g. for OLE Objects) in the endJob() function.

Debugging
Currently, the easiest way to debug the script is to use VBScript MsgBox() or alert() functions to display text.

Dim MyVar
MyVar = MsgBox ("Hello World!", 65, "MsgBox Example")
' MyVar contains either 1 or 2, depending on which button is clicked.
JScript: Does NOT have an alert or MsgBox method. These are part of Internet Explorer, not JScript (but strangely they are in VBScript). Use the alert function of the TextPipe object instead.

Buy TextPipe Online!

Buy TextPipe Online!

 
 
 
 
Introduction
=: TextPipe
=: Features
   
Tutorials
=: Basics
=: Change Filter List
=: Move and Delete Filters
=: Add Files
=: Restrictions and Sub-filters
   
Using TextPipe
=: Filter Lists
=: Sub filters
=: File Lists
=: Comments Tab
=: Scratch Pad Tab
=: Trial Run Tab
=: Drag and Drop
=: Status Tab
=: Results Tab
=: Errors Tab
   
Filters
=: Input Filter
=: Output Filter
=: File Menu
=: Edit Menu
   
Conversion Filter
=: Fixed Width to Delimited Wizard
=: Convert End of Lines
=: IBM Drawing Characters
=: Tabs to Spaces
=: Uppercase
=: Lowercase
=: Title Case
=: Expand Packed Decimal
=: Expand Zoned Decimal
=: Convert PDF to Text
=: HTTP Encode
=: UUDecode
=: XXEncode
=: Unscramble
=: Character Maths
   
Add Filters
=: Add Line Number
=: Left Margin
=: Right Margin
=: Header
=: Footer
=: Word Wrap
   
Advanced Filter Operations
=: Remove Filters
=: Extract Filters
=: Replace Filters
=: Restriction Filters
=: Map Filters
=: Pattern Matching
   
Special Filters
=: Database Connection
=: Sort
=: Script Filter
=: Capture Text
=: Comments
=: Advanced Options
=: Advanced Features
=: Tools Menu
=: Window Menu
=: Help Menu
   
 
 

  Home | Contact us | Resources | Add your Manuals | Remove your Manuals