TextPipe: Online Help
    TextPipe Internal Automation Object
 

Submit feedback on this topic 

 Home  User Assistance   Tutorials   How to Use TextPipe
 Menus: File   Edit   Filters[ Wizards  Convert   Unicode   Add   Remove   Replace   Extract   Special   Maps   Restrict ]  Tools   Window   Help   Advanced
Home
Up

 

 

 (Pro version only)

The TextPipe automation object ('TextPipe') may only be called from a VBScript or JScript script to request information from TextPipe or to control processes and log information.

See also

Automating TextPipe from another program

Normal Functions

sub logError( messageText : string )

Logs an error message string to the log file and to the status window's Error tab e.g.

function processLine(line, EOL)
   processLine = line & EOL
  TextPipe.logError( line & " found " )
end function

sub logWarning( messageText : string )

Logs a warning message string to the log file e.g.

function processLine(line, EOL)
   processLine = line & EOL
  TextPipe.logWarning( line & " found " )
end function

sub logInfo( messageText : string )

Logs an information message string to the log file e.g.

function processLine(line, EOL)
   processLine = line & EOL
  TextPipe.logInfo( line & " found " )
end function

function inputFilename() : string

Returns the name (without the drive or path) of the file being processed e.g.

function processLine(line, EOL)
 
  processLine = TextPipe.inputFilename & " - " & line & EOL
end function

function fullInputFilename() : string

Returns the name (with the drive and path) of the file being processed.

function processLine(line, EOL)
 
  processLine = TextPipe.fullInputFilename & " - " & line & EOL
end function

function version() : string

Returns the TextPipe version number e.g.

function startFile()
  dim crlf
  crlf = chr(13) & chr(10)

  startFile = _
    "TextPipe version " & TextPipe.version & crlf & _
       "Input filename=" & TextPipe.inputFilename & crlf & _
       "Full input filename=" & TextPipe.fullInputFilename & crlf & _
       crlf

end function

sub terminate()

Terminates the current filter thread.

function processLine(line, EOL)
  if EOL = "" then
 
     TextPipe.logError( "Line with no EOL found " )
    TextPipe.terminate
  else
    processLine = line & EOL
  end if
end function

function getGlobalVar( name : string ) : string

Returns the string value of a global variable. Name is not case-sensitive, and multi-line values can be stored.

Global variables are shared between all filters in the same thread e.g.

function processLine(line, EOL)
  processLine = TextPipe.getGlobalVar( "myvariable" ) & line & EOL
end function

sub setGlobalVar( name, value : string )

Sets the value of a global variable called "name" to value. Name is not case-sensitive, and multi-line values can be stored.

Global variables are shared between all filters in the same thread e.g.

function processLine(line, EOL)
 
  TextPipe.setGlobalVar "myvariable", line & EOL
   'still output the text unaffected
   processLine = line & EOL
end function

sub terminateTextPipe()

Terminates TextPipe. Warning! This function may have undesirable side-affects.

sub alert( message : string )

Displays a message in a window, with an OK button to close it. This helps JScript users debug their code - as there is currently no JScript alert function as there is for VBScript.

property line : integer

Returns the current line of the text being processed. If the text is inside a restriction, this reports the current line number of the restricted text.

property offset : integer

Returns the current file offset of the text being processed. If the text is inside a restriction, this reports the offset of the restricted text.

Sub filter functions

The following functions only operate when the ActiveX script filter has sub filters.

function subFilterEntireText( inputText : string ) : string

Applies the sub filters to inputText as though inputText was an entire file in its own right. If you need more control over the sub filters use the next set of functions e.g.

function processLine(line, EOL)

  lineNumber = lineNumber + 1

  if (lineNumber mod 2) = 0 then
    'an even-numbered line
    processLine = TextPipe.subFilterEntireText(line) & EOL
  else
    'an odd-numbered line
    processLine = line & EOL
  end if

end function

 

sub initSubFilters()

Prepares sub filters for processing text. MUST be called before sending data into sub filters.

dim lineNumber


function processLine(line, EOL)

  lineNumber = lineNumber + 1

  if (lineNumber = 100) then
    'start the special processing on line 100
    TextPipe.initSubFilters
    TextPipe.subFilterChunk( line & EOL )
    processLine = ""
  else if (lineNumber > 100) and (lineNumber < 200) then
    'special processing for lines 100..200
    TextPipe.subFilterChunk( line & EOL )
    processLine = ""
  else if (lineNumber = 200) then
    'end special processing on line 200
    TextPipe.flushSubfilters
    processLine = line & EOL
  else
    processLine = line & EOL
  end if

end function


function endFile()

  if (lineNumber = 100) then
    endFile = ""
  else if (lineNumber > 100) and (lineNumber < 200) then
    TextPipe.flushSubfilters
    endFile = ""
  else if (lineNumber = 200) then
    TextPipe.flushSubfilters
    endFile = ""
  else
    endFile = ""
  end if

end function


function startJob()
   lineNumber = 0
end function

sub flushSubfilters()

Flushes all cached data from all sub filters prior to resuming normal straight-through processing.

sub subFilterChunk( inputString : string )

Sends inputString to the sub filters. Remember to call flushSubfilters at the end of the file or beforehand.

 

 

 Contact Us   Support   Community   Tutorials and User Guides (online)
 Copyright © 1999-2006 DataMystic. All rights reserved.