# Exporting data from the highest numbered track in an album

**URL:** https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081
**Category:** Support
**Created:** [August 31, 2014, 12:31am UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081 "2014-08-31T00:31:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 31, 2014, 12:31am UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/1 "2014-08-31T00:31:23Z")

</div>

What export script will export data from the highest numbered track in an album?

I have used $loop(%album%,1) to get just one track, but the selection seems random and I cannot see how to specify the highest numbered.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 31, 2014, 4:40am UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/2 "2014-08-31T04:40:26Z")

</div>

> [@chrisjj](#):
>
> What export script will export data from the highest numbered track in an album? ...

Sort or loop by TRACK ascending ... and try this ...  
[Determine the last loop inside loop?](https://community.mp3tag.de/t/7231/5)

DD.20140931.0840.CEST

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 31, 2014, 10:28pm UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/3 "2014-08-31T22:28:27Z")

</div>

Thanks D. That worked fine:

```
$filename(D:\temp\test.m3u,ANSI)$loop(%album%)$loop(%track%)$puts(CountMax,%_counter%)$loopend()$loop(%track%)$if($eql($get(CountMax),%_counter%),Album ''%album%'' last track is #%track%
,)$loopend()$loopend()

```

![](http://i.imgur.com/dj8tGvr.png)

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 31, 2014, 10:43pm UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/4 "2014-08-31T22:43:41Z")

</div>

PS I see you uses a variable in a loop, a combination which was not working according to last time I tried and read reports hereabouts. Does this meet some exception criterion? Or has the bug been fixed, do you know?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 1, 2014, 4:35am UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/5 "2014-09-01T04:35:27Z")

</div>

> [@chrisjj](#):
>
> PS I see you uses a variable in a loop, a combination which was not working according to last time I tried and read reports hereabouts. Does this meet some exeption corterion? Or has the bug been fixed, do you know?

The Mp3tag Export Scripting Language is an adventure playground per se.  
The visibility of user defined variables ist still rather ugly.  
Once a variable is defined in one loop, then it becomes visible in following loops too.  
Note: Before any loop command has been invoked, the script knows some predefined system variables, %\_max\_counter% and others, and can immediately display their values, on scrpt level.  
But within a loop %\_max\_counter% delivers nothing.  
I was not able to "lift up" the value from %\_max\_counter% from script level into the loop over the files.  
Therefore the first loop was needed to define a user variable to carry the needed value into the second loop.

DD.20140901.0832.CEST

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [September 1, 2014, 9:44am UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/6 "2014-09-01T09:44:50Z")

</div>

Good info. Thanks.

---

<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:25pm UTC](https://community.mp3tag.de/t/exporting-data-from-the-highest-numbered-track-in-an-album/16081/7 "2026-02-09T12:25:13Z")

</div>


