# Script for export to nfo with Loop Funktion - Counting multiple entries divided by Comma

**URL:** <https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764>\
**Category:** Support\
**Created:** [July 16, 2021, 4:38am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764 "2021-07-16T04:38:39Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 4:38am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/1 "2021-07-16T04:38:39Z")

</div>

Hello Forum,

I try to get some simple \*.nfo files with the Export function. Everything works well until I have multiple tag fields divided by Comma like %actors% %artists% or %Genre%.

Heres how it should look like (created by metaX)

_\<?xml version="1.0" encoding="utf-16"?\>_

- MetaX for Windows\*
- Top Gun\*
- Top Gun\*
- Top Gun\*
- 1986\*
- \*
- \*
- 110 min.\*
- \*
- Tony Scott\*
- \*
- 

```
  <name>Tom Cruise</name>*

```

- \*
- \*
- 

```
  <name>Val Kilmer</name>*

```

- \*
- \*
- 

```
  <name>Kelly McGillis</name>*

```

- \*
- \*
- 

```
  <name>Meg Ryan</name>*

```

- \*
- \*
- 

```
  <name>Anthony Edwards</name>*

```

- \*
- \*
- 

```
  <name>Michael Iroside</name>*

```

- \*  

seems the scrip here counts all Commas in the field actor(s) and makes for each Name a new Entree.

So far the export result of my script looks like this:

- Top Gun\*
- 1986\*
- Krieg;Abenteuer;Love Story\*
- \*
- Tony Scott\*
- Paramount\*
- Tom Cruise,Val Kilmer,Kelly McGillis,Meg Ryan,Anthony Edwards,Michael Iroside\*  

I think I must use the $Loop function here for actors but can find any samples how to set it up right that it counts all commas and puts out 1 entree for each comma.  
Tried also someting with " **$meta\_sep**" but also no success

Thx for your help and Suggestions.

Chris

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 16, 2021, 4:47am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/2 "2021-07-16T04:47:21Z")

</div>

> [@ostybe](#):
>
> I think I must use the $Loop function here

That is very hard to tell as I do not see anything from the script.

> [@ostybe](#):
>
> Tried also someting with " **$meta\_sep**" but also no success

What did you try? An actual example would help.

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 6:35am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/3 "2021-07-16T06:35:17Z")

</div>

Hello, thx for your help.

I have for example in the tag field actor multiple entrees divided by"," like Tom Cruies,Kelly McGillis,Meg Ryan

in the exported nfo file it should look like:

 ![should](https://community.mp3tag.de/uploads/default/original/2X/e/e9162adb768236de636be595ed4981feb0733149.jpeg)

but all I can get so far is:

 ![sofar](https://community.mp3tag.de/uploads/default/original/2X/2/2390e10660a22e6cb3f538e3f60d6872cc12a186.jpeg)

the script is so far:  
 ![scriptsofar](https://community.mp3tag.de/uploads/default/original/2X/8/8fbdfb52f3e98e843f96164797acebdfa609a026.png)

But how do I manage that nfo looks like in first picture with each actor seperated ?

Chris

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [July 16, 2021, 7:05am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/4 "2021-07-16T07:05:15Z")

</div>

> [@ostybe](#):
>
> But how do I manage that nfo looks like in first picture with each actor seperated ?

Please show us your producing script (the one with the `$loop` and `$meta_sep` commands).

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 7:22am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/5 "2021-07-16T07:22:28Z")

</div>

Sorry, for $Loop I just tried to modify a Loop function I found here on the forum but it didnt work and was not for comma divided multitag field used.

About the sept funktions I only read on the wiki, I thought that was a solution for my problem....  
[https://hilfe.mp3tag.de/main\_scripting.html](https://hilfe.mp3tag.de/main_scripting.html)

But didnt work either...or more like I have no clue how to do it.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 16, 2021, 7:23am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/6 "2021-07-16T07:23:53Z")

</div>

You could try an expression like  
`<actor>$replace('Tom Cruies,Kelly McGillis,Meg Ryan',',',</actor><actor>)</actor>`  
for the line where you write the actor.  
Instead of the string constant 'Tom Cruies,Kelly McGillis,Meg Ryan' it should be possible to use `$meta_sep(actors,',')`

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 8:23am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/7 "2021-07-16T08:23:34Z")

</div>

> [@ohrenkino](#):
>
> $meta\_sep(actors,',')

So far your suggestion works great...

 ![new](https://community.mp3tag.de/uploads/default/original/2X/4/4dc9cde73cae8e9fc69719edff4dc3b66de19013.png)

but my zidoo player needs the "name thing" arround to read out the different actors.

like here

 ![should](https://community.mp3tag.de/uploads/default/original/2X/e/e9162adb768236de636be595ed4981feb0733149.jpeg)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 16, 2021, 8:26am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/8 "2021-07-16T08:26:49Z")

</div>

> [@ostybe](#):
>
> but my zidoo player needs the "name thing" arround

So it's not just  
`</actor><actor>`  
but  
`</name></actor><actor><name>`

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 8:41am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/11 "2021-07-16T08:41:09Z")

</div>

Ok, coooool!

but the first name isnt covered with"Name" cause the tag-field doesnt start with a comma I guess ?

 ![new2](https://community.mp3tag.de/uploads/default/original/2X/c/cdd646035d3835a60a45d1e31027d6e70fec4189.png)

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 8:44am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/12 "2021-07-16T08:44:15Z")

</div>

![script2](https://community.mp3tag.de/uploads/default/original/2X/3/36a612bae909851f65c12607ba8b38579d07c88b.png)

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 9:29am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/13 "2021-07-16T09:29:05Z")

</div>

Ok, I tried on my Zidoo: No sucess to retrieve the Actors. I put them in lines like MetaX does. Added the name opener for first actor and name closer for last actor by hand and than it worked by Zidoo !!

So in the script I have handle the opener closer for name tag for the first and last Actor in the tag  
2nd I need to seperate them in lines like on the picture by the script....

 ![1](https://community.mp3tag.de/uploads/default/original/2X/a/a2a97d31559bcdfe0800ca0ed2dcb5584c6e1df6.png)  
 ![2](https://community.mp3tag.de/uploads/default/original/2X/0/035e53c87592722dcc9ffcdf231d8e1005e7a81b.png)  
 ![script](https://community.mp3tag.de/uploads/default/original/2X/f/fbf830c44f77ff8e07a6bf0b18c22f84a29dcb40.png)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 16, 2021, 9:55am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/14 "2021-07-16T09:55:21Z")

</div>

You are missing the opening part `<actor><name>` in front of the $Replace() statement and the corresponding closing part.

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [July 16, 2021, 11:18am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/15 "2021-07-16T11:18:20Z")

</div>

😀  
Thank you very much Ohrenkino...Vielen Dank. It works fine now. And all Actors are displayed seperately in the player.

But one last thing...

When I run the exportfunction in a script for tagging and exporting multiple files / nfos.....

How can I set it up that the nfo will be exported to the sourcefolder of the video with the name of "sourcefolder".nfo or "sourcefilename".nfo ?

All I can specify is a filename and outputfolder in the export funktion. In a script that would overwrite again and again the same nfo file.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 16, 2021, 1:16pm UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/16 "2021-07-16T13:16:55Z")

</div>

instead of a constant filename, use something like  
`$filename(%_directory%.nfo,UTF-8)`

---

<div class="post-metadata">

**Author:** ![ostybe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/o/9de0a6/32.png) [@ostybe](https://community.mp3tag.de/u/ostybe)\
**Post date:** [August 7, 2021, 2:30pm UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/17 "2021-08-07T14:30:45Z")

</div>

Hello again 🙂

With "%\_directory%.nfo"

for "Dateiname der Exportdatei" and "Eine Datei pro Verzeichnis" checked the exported nfo's go all in the Parent Directory and not in the folders where the source media file is.

If I do a search and collect all media files I need and do an nfo export they land all in a parent directory together and it takes ages to find the right folders for the nfo.

No Problem with just 1 file, that lands correct in the source folder.

Thx for help.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 8, 2021, 7:30am UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/18 "2021-08-08T07:30:21Z")

</div>

As I said:

> [@ohrenkino](#):
>
> something **like**  
> `$filename(%_directory%.nfo,UTF-8)`

If that information does not distinguish enough then you have to add further data like  
`$filename(%_directory%\%album%.nfo,UTF-8)`  
(Again: **"like"** - it still means that you have to look whether it suits your needs and adapt it accordingly.)

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:29pm UTC](https://community.mp3tag.de/t/script-for-export-to-nfo-with-loop-funktion-counting-multiple-entries-divided-by-comma/53764/19 "2026-02-09T12:29:18Z")

</div>


