Passing data through clipboard between filters

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

timmins
Posts: 2
Joined: Tue Oct 05, 2010 2:13 am

Passing data through clipboard between filters

Postby timmins » Tue Oct 05, 2010 2:36 am

I am trying to make use of the @clipboard variable in a series of filters but I am not getting the desired results.

The script should take an html file and restrict itself to a table cell. In that cell is an image that is linked. The link has three parts to the path and I need the third part. The third part is then copied to the clipboard so it can be used to replace the text in the image's ALT tag.

Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [ ] Delete input files after processing
| Skip binary files
| Sample size 100 characters
|
|--Restrict to between tags <td>...</td>
| | [X] Include text
| | [ ] Match case
| | Max size: 65536
| |
| |--Restrict to between tags <a>...</a>
| | | [X] Include text
| | | [ ] Match case
| | | Max size: 65536
| | |
| | +--EasyPattern [href="/[capture(2 to 3 letters)]_[capture(1 to 5 digits)]/[capture(1+ chars or punctuation) as 'clipboard']"] with ["/$1_$2/"]
| | | [ ] Match case
| | | [ ] Whole words only
| | | [ ] Case sensitive replace
| | | [ ] Prompt on replace
| | | [ ] Skip prompt if identical
| | | [ ] First only
| | | [ ] Extract matches
| | | Maximum text buffer size 4096
| | |
| | +--Capture to variable @clipboard
| | Reset: 2
| |
| +--EasyPattern [alt="[1+ chars or punctuation]"] with [alt="@clipboard"]
| [ ] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [X] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
|

So, now that I am reviewing what I pasted... I'm not sure why the EasyPattern is being replaced with "/$1_$2/" unless that is how it handles "send variable 3 to subfilter". Should I use an Extract filter? Originally, whenever I used an Extract filter it would actually remove the text that I wanted to keep.

I know this doesn't work but the more I tinker the more I stray from the solution. How is the best way to handle the hand off of data from the href="" to the enclosed image's ALT tag?

Thank you in advance.

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

Re: Passing data through clipboard between filters

Postby DataMystic Support » Thu Oct 07, 2010 8:15 pm

@clipboard is a special name I believe.

The best way is to capture both the href and alt in the one pattern and then simply copy the resulting captured expressions to the right spot.
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

timmins
Posts: 2
Joined: Tue Oct 05, 2010 2:13 am

Re: Passing data through clipboard between filters

Postby timmins » Thu Oct 07, 2010 10:44 pm

I tried that initially (capturing href, etc.) but there are variations in how those are formed.

I know @clipboard is a reserved variable. How do I capture a variable into that variable and then refer to it in the next filter? In this current design, the clipboard variable isn't being handed any data. I know @clipboard is working thanks to my prompted trials of that specific filter. What isn't working is

[capture(1+ chars or punctuation) as 'clipboard']

Isn't that how a filter puts a pattern into the clipboard? If not, how?

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

Re: Passing data through clipboard between filters

Postby DataMystic Support » Mon Oct 11, 2010 12:08 pm

@clipboard is a special case. We could certainly make as 'clipboard' put the result on the clipboard, but this is not your problem.

TextPipe in effect, processes the entire file through the first replace before the second replace (depending on the size of the file).

So you cannot guarantee that @clipboard will be correct.

Instead, you need to enclose your two patterns inside a 'Restrict to each line in turn' filter to ernsure they are both executed as one block.
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 1 guest