Three events following , [upload name], [download name] and [archive name],necessarily have to supply a result of type string containing no illegal character, but after several tries, the results of these events, which have to supply a name of coherent file, had some surprises in reserve: every result has to like on a single line, it was not thus possible to use a formulation of the kind:
[xxxx name]
{.if|%user%|%user%-|anonymous-.}
%date%
%item-name%
At present only the first line is held(retained) as being valid, thus it is necessary to use this:
[xxxx name]
{.if|%user%|%user%-|anonymous-.}%date%%item-name%
When there is not enough information to be converted or to calculate, then a line is sufficient, but for more clarity, if we wish a resultat which takes into account all lines them of the section then here is the code adequate
// see if an event script wants to change the upload name
s:=xtpl(trim(runEventScript('upload name')),[#10,'',#13,'',#09,'']);
// see if an event script wants to change the download name
s:=or_(xtpl(trim(runEventScript('download name')),[#10,'',#13,'',#09,'']), f.name);
// see if an event script wants to change the archive name
data.lastFN:=or_(trim(xtpl(runEventScript('archive name',
['%archive-name%', data.lastFN,
'%mode%', if_(selection, 'selection','folder')
]),[#10,'',#13,'',#09,''],)), data.lastFN);
all cararcters Tab LineFeed and CariageReturn are deleted in the result name.
An excellent test is to use for example
[xxxx name]
this is
the new
name.tmp
You should obtain 'this is the new name.tmp' and not 'this is'