global variable scope

Get help with installation and running here.

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

Post Reply
dmaristizabal
Posts: 4
Joined: Thu Aug 27, 2009 7:45 am

global variable scope

Post by dmaristizabal »

Im trying to get textpipe to extract a piece of text from file "a" and then use that captured text to be the inserted replacement text it info file "b".

These are the steps Im following using easypatterns:

1. I do a search on file "a" and I capture the match into a global variable, output file none (as I dont need any replacement done on file "a")
2. Now I do a search on file "b" to match the specific range of text I want replaced and then set the replacement text as @myglobalvariable (actually global_variable_one)

I have all the commands together in a command file to be executed with the /Z textpipe switch

Im getting the match but the replaced text is blank as if the global variable had been vanished after each search and replace set. I´ve also tried putting the /G switch only at the end of the command file with no success.

Here is the full command line :
"C:\...........\textpipe.exe" /Z=moveseo01.txt

and Here is the command file (moveseo01.txt) contents:

; extract from "a" file
;===================================
d:\.......(a file path)........\a.html
/SX7=[capture('<title>')][capture(1 or more characters) as 'global_variable_one'][capture('</title>')]
; no replace needed here
;===================================

; put to "b" file
;===================================
d:\.......(a file path)........\b.html
/SX7=[capture('<title>')][capture(1 or more characters)][capture('</title>')]
/R=$1@global_variable_one$3
;===================================

Any clues ?

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

Re: global variable scope

Post by DataMystic Support »

Global variables are global for a filter - not between filters.

If you want to achieve this, the best way would be to write the value to the clipboard, then in your subsequent filter, use @clipboard.
Post Reply