Export to File (Order)

I have an action that is exporting Track numbers to a .txt file.
They are exporting properly but not in the order I was expecting. In mp3tag the files are listed in track order starting from 1. I selected all the files of one album & the txt file is set for something like

$IF($eql(%Variable%,'YES'),%TRACK%,•NO•)

The resulting text file is along the lines of

8
•NO•
1
•NO•
13
•NO•
...

Why is the list not in order? I was expecting

1
•NO•
•NO•
•NO•
•NO•
•NO•
•NO•
8
•NO•
•NO•
•NO•
•NO•
13
...

I was planning on concatenating these track numbers in order. The end goal was: 1,8,13...

Just trying to figure out what pattern mp3tag is following here, either that or a way to sort these again if they will be randomized each time I export

Please show us the export script - otherwise it is very tricky to get an idea.

Just a wild guess:
Check the $loop() statement which sort the tracks.
That should read $loop($num(%track%,2)).
Sorting is always alphabetical, not numerical.

$filename(txt,utf-8)$loop(%_path%)$IF($EQL(%BINC1%,%Cover Description 1%%FC Suffix%),%TRACK%,•NONE•)
$loopend()

Somehow I always imagined it just exported in the order the files were in when viewed in mp3tag

Then you have to use $loop(1) - and no variable that gets sorted.

Ahh, yeah that did it! THANK YOU.

I'll be honest I don't remember making the original export script I just duplicate it & edit the new one each time I need a script. So long as I was able to get the information over there in all my other cases I was fine