# Counter doesn't work - need help

**URL:** https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365
**Category:** Support
**Created:** [August 28, 2007, 10:57pm UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365 "2007-08-28T22:57:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Stevest](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Stevest](https://community.mp3tag.de/u/Stevest)
#### Post date: [August 28, 2007, 10:57pm UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365/1 "2007-08-28T22:57:44Z")

</div>

Hi,

if use this simple script

$filename(test.txt)  
$loop($num(%track%,2))$loopend()%\_max\_counter%$loop(%artist%,1)$loopend() - %\_max\_counter%$loop(%year%,1)$loopend() - %\_max\_counter%

in a file list of 12 files with the same artist and the same year, the result is

12 - 12 - 12

instead of

12 - 1 - 1.

What is the problem?

Yours sincerely,

st

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [August 29, 2007, 7:30am UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365/2 "2007-08-29T07:30:11Z")

</div>

I get 12 - 1 - 1

---

<div class="post-metadata">

### Author: ![Stevest](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Stevest](https://community.mp3tag.de/u/Stevest)
#### Post date: [August 29, 2007, 7:59am UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365/3 "2007-08-29T07:59:12Z")

</div>

I think you're right. I paste a wrong script. But here is the problematic one:

I run this script in a single album (all file has the same %album%) with 25 files (13 different artists):

> [@](#):
>
> $filename(test.txt)  
> $loop(%album% %artist%,1)  
> %\_counter% - %album%: %artist%$loopend()
> 
> $loop(%artist%,1)$loopend()%\_max\_counter% artist(s) | $loop(%album%,1)$loopend()%\_max\_counter% Album(s) in %\_total\_files% File(s) | %\_total\_size%, %\_total\_time% Hrs

And the result:

> [@](#):
>
> 1 - Grease Soundtrack: Cindy Bullens  
> 2 - Grease Soundtrack: Frankie Avalon  
> 3 - Grease Soundtrack: Frankie Valli  
> 4 - Grease Soundtrack: John Travolta  
> 5 - Grease Soundtrack: John Travolta & Olivia Newton-  
> 6 - Grease Soundtrack: John Travolta, Olivia Newton-J  
> 7 - Grease Soundtrack: Louis St. Louis  
> 8 - Grease Soundtrack: Louis St. Louis & Cindy Bullen  
> 9 - Grease Soundtrack: Olivia Newton-John  
> 10 - Grease Soundtrack: Sha-Na-Na  
> 11 - Grease Soundtrack: Stockard Channing  
> 12 - Grease Soundtrack: Theme  
> 13 - Grease Soundtrack: Various Artists
> 
> 13 artist(s) | **13** Album(s) in 25 File(s) | 94,43 MB, 01:08:50 Hrs

The number of album should be 1, not 13.  
How to solve that problem? Any idea?

Thank you in advance.

---

<div class="post-metadata">

### Author: ![Stevest](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Stevest](https://community.mp3tag.de/u/Stevest)
#### Post date: [August 29, 2007, 3:50pm UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365/4 "2007-08-29T15:50:49Z")

</div>

Here is a possible solution for my own problem 😛 : if I asked for the %\_max\_counter% _before_ the second loop (put its value in an unused variable), the script works. 😃

Like this:

> [@](#):
>
> $filename(test.txt)  
> $loop(%album% %artist%,1)  
> %\_counter% - %album%: %artist%$loopend()
> 
> $puts(trash,%\_max\_counter%)
> 
> $loop(%artist%,1)$loopend()%\_max\_counter% artist(s) | $loop(%album%,1)$loopend()%\_max\_counter% Album(s) in %\_total\_files% File(s) | %\_total\_size%, %\_total\_time% Hrs

The result:

> [@](#):
>
> 1 - Grease Soundtrack: Cindy Bullens  
> 2 - Grease Soundtrack: Frankie Avalon  
> 3 - Grease Soundtrack: Frankie Valli  
> 4 - Grease Soundtrack: John Travolta  
> 5 - Grease Soundtrack: John Travolta & Olivia Newton-  
> 6 - Grease Soundtrack: John Travolta, Olivia Newton-J  
> 7 - Grease Soundtrack: Louis St. Louis  
> 8 - Grease Soundtrack: Louis St. Louis & Cindy Bullen  
> 9 - Grease Soundtrack: Olivia Newton-John  
> 10 - Grease Soundtrack: Sha-Na-Na  
> 11 - Grease Soundtrack: Stockard Channing  
> 12 - Grease Soundtrack: Theme  
> 13 - Grease Soundtrack: Various Artists
> 
> 13 artist(s) | 1 Album(s) in 25 File(s) | 94,43 MB, 01:08:50 Hrs

Anyway, I think it is some kind of bug.

---

<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:20pm UTC](https://community.mp3tag.de/t/counter-doesnt-work-need-help/5365/5 "2026-02-09T12:20:28Z")

</div>


