photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: axel.hennig on March 20, 2023, 01:40:14 PM

Title: File Window Tip
Post by: axel.hennig on March 20, 2023, 01:40:14 PM
Based on the currently ongoing discussion regarding the File Window Tip I had a deeper look into this and wanted to test things. I've started simple and tried:

{File.Categories.Direct|prefix:<Run FontSize='12pt'>;postfix:</Run>;replace:~;==<LineBreak/>}
But this does not produce "real" linebreaks, it just displays the word "<LineBreak/>". What am I doing wrong? I've worked with the example in this help-page (https://www.photools.com/help/imatch/var_basics.htm?dl=a_replace).
Title: Re: File Window Tip
Post by: Mario on March 20, 2023, 01:52:32 PM
This is a bit tricky. The row output of your variable produces a Run using prefix and postfix (for the font size).
You cannot add <LineBreak/> to a <Run>.

How to introduce hard line breaks is for example shown in the row for the Description tag in the default File Window Tip.
You have to close the run, add your line break, and then re-open the run.

In your example, this will work:

{File.Categories.Direct|prefix:<Run FontSize='12pt'>;postfix:</Run>;pereplace:~;==</Run><LineBreak/><Run>}

Note the use of pereplace instead of replace to avoid the special characters < and > being stripped out during escaping.

Without the Run it becomes simpler:

{File.Categories.Direct|pereplace:~;==<LineBreak/>}
Title: Re: File Window Tip
Post by: JohnZeman on March 20, 2023, 02:34:18 PM
Below is the way I display Hierarchal Keywords in a file window tip.
First I use replace to replace ; with temporary text XXX then I use pereplace to replace XXX with <LineBreak/>

Title: Re: File Window Tip
Post by: Mario on March 20, 2023, 02:43:02 PM
{File.MD.hierarchicalkeywords|pereplace:~;==<LineBreak/>}

Should so it, unless you do complex runs etc.
Title: Re: File Window Tip
Post by: axel.hennig on March 20, 2023, 09:18:35 PM
Thanks to both of you. Works perfect.