Export field to a file

I would like to save info from the PUBLISHER field to a filename. That may be a 0 byte file with only the Publisherfield as filename.

I did manage to export a cover to a file named %PUBLISHER%.jpg
But the disadvantage is that if there is no cover there will be no file and if the PUBLISHER field is empty I get a nameless ".jpg" file.

Does someone knows how to create an action which creates an empty filename with the Publisher as filename? And only if the publisher field is present. When the Publisher field is blank no file is needed. 1 file for 1 directory is enough.

Do not use an action but a tool.
Create a tool in File>Options>Tools
Select the command shell cmd.exe as program and add these parameters:
/c echo Publisher '%publisher%' > %publisher%.txt

That works. I had to place the filename between " " to make it work correctly.

Still, when there is no publisher I get a nameless .txt file.

And it could lead to many instances of the command prompt at the same time when processing many files.

It is not a very elegant solution but it works. I'd rather use an action because there I do all most other things. An action which starts a tool would be nice to prevent one has to use the right mousebutton to start a tool.

If I prefer the method with exporting a cover fom a file named %publisher%.jpg, which can be done from an action, which notation can I use to prevent creating a nameless .jpg file?

Use a filter?
Enter a dummy publisher?
If there is an embedded picture, the export will create a file... So you have to take precautions like filtering.
Even the absence of data is data.

In respect to the command shell: you can use a batch file that checks for the existence of data or files. You would then call that batch file instead of the command shell command directly.
See e.g. here for more information about shell syntax: http://ss64.com/nt/syntax.html

You have to go via Mp3tag "Export" dialog or via Mp3tag "Export" action.
Apply an export script like following ...

1: $filename($getEnv('TEMP')'\CreateTextfileForPublisher.cmd',ANSI)

2: $loop(%folderpath%)$if(%PUBLISHER%,'@ECHO.>"'$left(%folderpath%$validate($meta_sep(PUBLISHER,''),''),255)'.txt"',)
3: $loopend()
4: '@DEL %0>NUL'

DD.20150903.1132.CEST, DD.20150903.1330.CEST

What I basicly want is when the Publisher field contains data, a file with a name like "Publisher- Stockfisch Records" is placed in the directory where the album is. No extension needed, and no file has to be created when the publisher is unknown/blank.

I use it just as reminder when browsing in windows explorer. If path length wasn't an issue I would put it in the directory name.

I will have a look with scripts, I have never used it, but I will try Detlevs proposal.

Another possbility is to create a file with information which is always available and which makes some sense.
I.e. a file with Bitdepth-Samplefreq-Filetype (Publisher):

16bit-44kHz-FLAC (.no extesion)
16bit-44kHz-FLAC (Publisher- Stockfisch Records) (.no extesion)
when the publisher is available.

Ideas ideas...

The windows explorer has a number of search options for the advanced search that would make this information available without the use of extra files (which then have to be kept up to date)

see e.g. http://windows.microsoft.com/de-de/windows...hing-in-windows

(there should be non-German site).

Actually I do my searches with Everything file finder. It only indexes file- and foldernames but with instant results and zero waittime.

Are you sure this works?

I created a 'new export configuration' file, deleted what's in and pasted your 4 rows of code.
When applied as an action I get a '[ SYNTAX ERROR IN FORMATTING STRING ]' file.
Via the menu file export the same result

Sorry for the inconvenience, I have attached the mte file, which works for me.
Export.CMD.CreateTextfileForPublisher.mte (213 Bytes)


Export.CMD.CreateTextfileForPublisher.mte (213 Bytes)

I learned a lot today :slight_smile:

It almost works. In the Temp directory a file named CreateTextfileForPublisher.cmd is created.
But it isn't executed so no publisher file in the album directory. If I launch it manually the publisher file is created and the CreateTextfileForPublisher.cmd file deletes itself, just as expected.

Looking how to get the cmd file executed automaticly.

If I do the export via the file menu the export ends wit a dialog box with a question if I want to view the export file. If I choose yes, the publisher file will be created in the album's directory. So answering yes triggers the .cmd file.

In an export action such dialog box/question isn't shown, maybe the problem is there?