global variable scope

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

global variable scope

Postby dmaristizabal » Thu Aug 27, 2009 8:25 am

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: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: global variable scope

Postby DataMystic Support » Thu Aug 27, 2009 12:51 pm

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.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 2 guests