Page 1 of 1

Get triggering file structure in HTML email

Posted: Fri Nov 21, 2014 4:32 pm
by gabrielp
Is it possible to get this block in HTML emails instead of just plain text ones?




Get triggering file structure in HTML email

Posted: Mon Nov 24, 2014 12:00 pm
by freddyp
[Job.NestedName:Indent=" ",Separator=]



Freddy

Get triggering file structure in HTML email

Posted: Mon Nov 24, 2014 6:15 pm
by gabrielp
freddyp wrote: [Job.NestedName:Indent=" ",Separator=]



Freddy


Wonderful! Thanks so much. Works well in a :



<p>

<span style="font-size:14px;">File Structure</span><br>

<pre style="display: block;font-family: Consolas,monaco,monospace;white-space: pre; margin: 0;max-width: 500px;overflow: visible;">{% spaceless %}

[Job.NestedName:Indent="ÂÂÂÂ",Separator=<br>]

{% endspaceless %}</pre>



</p>



I don't suppose there is a way to get to the end of a line that is indented. For example, if I wanted to indent with a and then close that indention with a ? or possibly specify the end of an indented string (a folder) with a trailing slash (but not the files inside)? If not, no worries. This works well enough.

Get triggering file structure in HTML email

Posted: Tue Nov 25, 2014 10:20 am
by freddyp
You can always write a script expression that uses s.getVariableAsString("[Job.NestedName]"). That returns the list of folders and files as a string, by default separated by a semi-colon and prefixed with 4 spaces per indentation level (I would change that to 1 space for what follows).



You can split the string to an array. You start off with an empty HTMLstring and you loop over the array and check if the indent level changes, ie the number of leading spaces changes. Here you see why I would use just 1 space: there is no point in counting by fours. A change of indent level is a trigger to insert (number of leading spaces goes up) or (number of leading spaces goes down).



At the end you return the HTML-formatted string. Note that "returning" a string in a script expression is not done by writing:



return HTMLstring;



but simply by writing:



HTMLstring;



If it is worth the trouble is your decision:)



Freddy