Export and import a filter for change

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
shveicar980
Posts: 11
Joined: Thu Apr 26, 2012 11:57 pm

Export and import a filter for change

Post by shveicar980 »

Hello, I am from Russia.
I have got a problem. There is a big filter
"text pipe". It consists of 50 groups of individual filters. In each of them present the same value "(<a)".How can I to edit all the groups at once to remove this valuein all filters. I have tried so: export the filter into the notpad, editing in Akepad with conservation in expanding (.fll) - as a result writes "invalid stream format" at the opening of the filter. I did not find the import option. Manually to change the values in each filter - very uncomfortable.
I have not found the answer to the Russian-speaking forum.
I hope for your help. Thank you.
Last edited by shveicar980 on Wed May 02, 2012 7:42 am, edited 1 time in total.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Export and import a filter for change

Post by DataMystic Support »

Use
File Menu\Export\Export to JScript

Make the changes to the .js file, then uncomment

Code: Select all

'Uncomment the following line to load the filter
'  vb_load_filter()
'Uncomment the following line to generate the filter
'  vb_generate_filter()   <---- uncomment this line
Run the .js, and the filter will be recreated!
shveicar980
Posts: 11
Joined: Thu Apr 26, 2012 11:57 pm

Re: Export and import a filter for change

Post by shveicar980 »

Hello!
Thank you for your previous answer, but unfortunately I was unable to make changes to the filter
Perhaps it is because of the small experience with scripts.
In applying the script - open a window with different errors.
Here is an example of my mini-filter (name.fll), creation after export in the "js file".

Code: Select all

// TextPipe Pro 9.0 Single User Edition

// This JScript code was generated by TextPipe Pro -
// the fastest search and replace tool on the planet
//   Download from: http://www.datamystic.com


//The global TextPipe Application object
var TextPipeApp;
//The global TextPipe Filter Window
var TPWindow;


//connect to TextPipe if we haven't already
function js_connectTextPipe() {

  try {
    if (TextPipeApp == null) {
      TextPipeApp = new ActiveXObject("TextPipe.Application");
    }
  }
  catch(e) {
    MsgBox( "TextPipe Pro is not installed.\n\n" +
      "Please download and install it from\n" +
      "http://www.datamystic.com", 
      48 + 0,
      "TextPipe Pro needs to be installed" );
  }
  TPWindow = TextPipeApp.newWindow();

}


//disconnect from TextPipe
function js_disconnectTextPipe() {

  TPWindow.closeWithoutSave();
  TPWindow = null;

}


// 1) Use this code to simply load the saved filter:

function js_load_filter() {

  js_connectTextPipe();
  TPWindow.openFilter( "G:\\170\\name.fll" );
  if (TPWindow.execute() == false) MsgBox( 'ERROR \r\n' + TPWindow.errorText() );
  js_disconnectTextPipe();

}   


// 2) Use this code to build the filter from scratch, from a web page,
//    ASP script, .vbs file etc.

function js_build_filter( TPWindow ) {

var f1,f2,f3,f4,f5,f6;

TPWindow.startFilters();
TPWindow.clearAllFilters();
TPWindow.logEnabled = false;
TPWindow.logFilename = "textpipe.log";
TPWindow.logAppend = true;
TPWindow.logThreshold = 500;
TPWindow.inputMode = 1;
TPWindow.inputBinaryFiles = 1;
TPWindow.inputBinarySampleSize = 100;
TPWindow.inputPromptOnEach = false;
TPWindow.inputPromptOnReadOnly = false;
TPWindow.inputDeleteFiles = false;
TPWindow.inputInsideCompressed = false;
f1 = TPWindow.addReplaceFilter( "<a href=\"_/([^\"]+).htm", "<a href=\"1/$1.htm", 4, false, false, false, true, false, false, false, 0 );
f1 = TPWindow.setPerl( 4096, false, false, true, false );
f1 = TPWindow.addReplaceFilter( "<a href=\"__/([^\"]+).htm", "<a href=\"2/$1.htm", 4, false, false, false, true, false, false, false, 0 );
f1 = TPWindow.setPerl( 4096, false, false, true, false );
f1 = TPWindow.addReplaceFilter( "<a href=\"___/([^\"]+).htm", "<a href=\"3/$1.htm", 4, false, false, false, true, false, false, false, 0 );
f1 = TPWindow.setPerl( 4096, false, false, true, false );
f1 = TPWindow.addCommentFilter( "Comments\r\n\r\n" );
TPWindow.outputMode = 1;
TPWindow.outputRetainDate = false;
TPWindow.outputTestMode = 2;
TPWindow.outputAppend = false;
TPWindow.outputOnlyOutputChangedFiles = 1;
TPWindow.outputOpenOutputOnCompletion = false;
TPWindow.outputExtension = "";
TPWindow.outputFolder = "";
TPWindow.outputRemoveEmpty = false;
TPWindow.endFilters();


//File List:
TPWindow.clearAllFiles();
TPWindow.addFile( "", 0, 1 );
TPWindow.addFile( "Use the line below to remove common non-text files from website processing", 0, 3 );
TPWindow.addFile( ".[ 'gif' or 'png' or 'jpg' or 'bmp' or 'avi' or 'ico' or 'mp3', lineEnd ]", 0, 5 );
TPWindow.addFile( "Use the line below to remove common non-text folders from website processing", 0, 3 );
TPWindow.addFile( "_vti", 0, 5 );
TPWindow.addFile( "", 0, 1 );
TPWindow.addFile( "", 0, 1 );

}  


function js_generate_filter() {

  js_connectTextPipe();
  js_build_filter( TPWindow );
  if (TPWindow.execute() == false) MsgBox( 'ERROR \r\n' + TPWindow.errorText() );
  js_disconnectTextPipe();

}


// 3) Use this code to build the filter from scratch and process a form field

function js_filter_string() {

  js_connectTextPipe();
  js_build_filter( TPWindow );
  form1.output.value = TPWindow.processString( form1.input.value );
  js_disconnectTextPipe();

}  


//Uncomment the following line to load the filter
//  js_load_filter()
//Uncomment the following line to generate the filter
//  js_generate_filter()
It is specifically reduced to three components of filters, so as not to hold a lot of space.Please explain what I need to change, so I after saving, and
run the script I got the same filter
name1.fll name next to the original (name.fll)
Thank you very much.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Export and import a filter for change

Post by DataMystic Support »

These are the lines you need to change:

Code: Select all

f1 = TPWindow.addReplaceFilter( "<a href=\"_/([^\"]+).htm", "<a href=\"1/$1.htm", 4, false, false, false, true, false, false, false, 0 );
The '<a href...' is the start of the string you need to change.

Once done, change the end of the script from:

Code: Select all

//Uncomment the following line to load the filter
//  js_load_filter()
//Uncomment the following line to generate the filter
//  js_generate_filter()
to:

Code: Select all

//Uncomment the following line to load the filter
//  js_load_filter()
//Uncomment the following line to generate the filter
  js_generate_filter()
shveicar980
Posts: 11
Joined: Thu Apr 26, 2012 11:57 pm

Re: Export and import a filter for change

Post by shveicar980 »

Thank you very much for your help.
My problem was in the use of Portable version TextPipe
The way specified by you does not work in portable form.
I hope future versions will be able to import filter from a text file.
It would be convenient.
Thank you for the excellent program.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Export and import a filter for change

Post by DataMystic Support »

Ah - where did you get the Portable version from? And what version is it?
shveicar980
Posts: 11
Joined: Thu Apr 26, 2012 11:57 pm

Re: Export and import a filter for change

Post by shveicar980 »

I made a portable version from a stationary version of the program (I did it on a virtual machine) for my own convenience.This version is fully functional.But the portable version has its own independent registry.And the script uses the registry of windows to convert the filter.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Export and import a filter for change

Post by DataMystic Support »

Can I ask you more about that?

How does TP have a registry independent from the rest of Windows?
And how does the .js script rely on the Windows registry?
shveicar980
Posts: 11
Joined: Thu Apr 26, 2012 11:57 pm

Re: Export and import a filter for change

Post by shveicar980 »

I think we should not consider the detailed aspects of win xp and its components here.
I can only say that the phrase has been specified in the vbs script to convert the filter

Code: Select all

Set vb_TextPipeApp = CreateObject("TextPipe.Application")
it requires a stationary version of the program.
In other words:so that the object was available, a library, it implements must be registered in the register of the local system.
I have not found other solutions yet.
dfhtextpipe
Posts: 986
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Export and import a filter for change

Post by dfhtextpipe »

Simon,

As an observer of the context for this issue, and knowing a number of people who live in countries where such an edition would be most valuable, may I encourage you to develop and release a portable edition of TextPipe, one which can run from a USB thumb drive, and which leaves behind no footprint in the host PC.

In this way, a registered user of TextPipe would be free to use the software in places such as an Internet Café or a Library with PCs available for users, etc.

For more background - please visit http://portableapps.com/.

Best regards,

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

Re: Export and import a filter for change

Post by DataMystic Support »

Thanks David - will definitely look into.

For the user above, I don't think TextPipe can be run in this manner 'registry free' - the registration must be done by an admin first.
Post Reply