Hi rko31415.
Using the Export function to write an MTA file: what a great idea!
Maybe it's been done before, but this is the first time I've paid attention.
I'll keep it in mind.
Try this Export script. It seems to work for the 3 specified cases.
$filename(C:\Documents and Settings\IDES\Application Data\Mp3tag\data\actions\Composer Fill.mta,UTF-8)'[#0]'$loop(%album%,1)
'T=5'
'F=COMPOSER'
'1=$if($eql(%album%,'$replace(%album%,'','''',',',''',''','[','''[''',']',''']''','%','''%''')'),$if($and(%composer%,$neql(%composer%,podcast),$neql(%composer%,iTunes U)),%composer%,'$replace(%composer%,'','''',',',''',''','[','''[''',']',''']''','%','''%''')'),%composer%)'$puts(counter,$add(1,$get(counter)))
'[#'$get(counter)']'$loopend()
$puts(REM,'if composer is empty or eql -podcast- or -itunesu- fill it with the albumtags default value')
It's always a challenge to parse somebody's code, especially when it is as "low-level" as Mp3tag scripts.
It seems as if you are using the $regexp function to ensure that the album-level tags are applied to only the files of the corresponding album.
However, my tests show that an apostrophe in the album-level ALBUM field will cause a syntax error.
Instead, I've used the $if($eql(w,x),y,z) structure.
Here's the template:
$if($eql(%album%, ALBUM_LEVEL_ALBUM), make changes (if appropriate) to %composer%, %composer%)
When writing the MTA file, various special characters must be escaped when writing ALBUM_LEVEL_ALBUM:
$replace(%album%,',',''',''') to replace comma with escaped comma
$replace(%album%,'[','''[''') to replace [ with escaped [
$replace(%album%,']',''']''') to replace ] with escaped ]
$replace(%album%,'%','''%''') to replace % with escaped %
$replace(%album%,'','''') to replace apostrophe with escaped apostrophe
(My tests showed that $ did not have to be escaped, which seems to be at odds with with the documentation.)
These can be combined into this single function:
$replace(%album%,'','''',',',''',''','[','''[''',']',''']''','%','''%''')
And the same replace function is used when writing the album-level composer.
BTW, I changed $loop(%album%) to $loop(%album%,1).