Filename function in export configurations

I can't figure out how to use it.
The help says:

but my file always ends up with the "Export file name" from the "Export" window (Mp3tag won't let me leave that field blank).

Here is an example export script, have a closer look at the $filename directive ...

1: $filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Report.tagdump.'$replace(%_datetime%,' ','.','-',)'.txt',UTF-8)

2: $loop(%path%)'^'
3: $regexp($regexp($list(,': ''',''$char(13)''$char(10)),'\r\n','U+000DU+000A'),'\r_\n','\r\n')'*'
4: $regexp($regexp($listtec(,': ''',''$char(13)''$char(10)),'\r\n','U+000DU+000A'),'\r\n','\r\n')'$'
5: $loopend()
6: 'MP3TAGAPP: '''$getEnv('MP3TAGAPP')''
7: 'MP3TAGAPPDATA: '''$getEnv('MP3TAGAPPDATA')''

DD.20140619.0753.CEST

Hmm, do I need some kind of path placeholder (e.g %_directory%) for it to work?

Does it matter what I put in "Export file name" box of "Export" window, or will the filename function from the export configuration .mte override it?

Indeed, there is no need to code a $filename function into a Mp3tag export script.
Using this export script ...

1: 'Test - export script without $filename directive.'

2: $loop(%_path%)
3: %_counter%' - '%_path%
4: $loopend()

... and filling in a properly named file path into the edit field for the filename within the "Export" dialog, ... let Mp3tag create the named output text file, e. g. 'T:\TEMP\TEST.TXT'.
In this way, the output text will be always encoded as ANSI.

I prefer the way to code the file path to the export's output file directly into the MTE export script, using the $filename function.
In this way, the user can control the output text encoding to be ANSI, UTF-16 or UTF-8, by setting the second parameter of the $filename function to the wanted value.

The file path to the export's output file is scriptable.
The file path can be written as one literal string, ...
or can be assembled from several parts of 'literal string' or %tagfield% value or %_system% value or $function() output.

Once the export's output file path has been defined or changed within the export script, it is recommended to update the memory of the "Export" dialog edit field, by moving the pick list selection bar over the name of the related export script, ...
... well ... this is rather quirky, but it seems to work.

DD.20140619.1928.CEST

Ah! Got it now. Very quirky, indeed. :flushed:
So, the file will always be named after "Export file name" box ("Dateiname der Exportdatei") of "Export" window regardless of $filename function in .mte, so I have to make sure to update that box with $filename function by clicking the desired export script in "Export" window.