Page 1 of 1

Python scripts in TextPipe?

Posted: Thu Aug 23, 2012 9:52 pm
by dfhtextpipe
Can one use Python scripts within the TextPipe scripts filter?

cf. Currently, the two choices offered in the drop-down are VBScript and JScript.

Yet the contextual help lists, "VBScript, JScript, VBA, PerlScript, Python, Lisp, REXX etc."

Moreover, it goes on to say, "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)."

btw. If VBA is one of the default values, why is it absent from the dropdown selector?

If so, is there a template for the required IO functions for Python?

Are there any examples available?

David

Re: Python scripts in TextPipe?

Posted: Fri Aug 24, 2012 7:02 am
by DataMystic Support
Sorry, VBA is not a default - the help has now been updated.

We're not experts in those other languages, so we don't have any samples available - but we'd be happy to include them if a contribution was available.

Below are the 5 functions that TextPipe requires, with documentation.

Code: Select all

'Called for every line in the file
'EOL contains the end of line characters (Unix, DOS or Mac) that must be
'appended to each line
function processLine(line, EOL)
  processLine = line & EOL
end function


'Called at the start of a processing job -
'perform one-time initialisation here
sub startJob()
  'do nothing
end sub


'Called at the end of a processing job -
'destroy any declared objects here
sub endJob()
  'do nothing
end sub


'Called before each file is opened -
'perform per-file initialisation here
function startFile()
  startFile = ""
end function


'Called before each file is closed -
'flush all pending file output here
function endFile()
  endFile = ""
end function

Re: Python scripts in TextPipe?

Posted: Mon Apr 24, 2017 9:37 pm
by dfhtextpipe
The help was not updated! It still says,
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. You can download the Microsoft VBScript and JScript engines and reference documentation from the Microsoft web site at http://msdn.microsoft.com/scripting/default.htm
David

Re: Python scripts in TextPipe?

Posted: Mon Apr 24, 2017 10:17 pm
by DataMystic Support
Thanks - updated.