# Sequential numbering action

**URL:** https://community.mp3tag.de/t/sequential-numbering-action/16136
**Category:** Support
**Created:** [September 13, 2014, 8:26pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136 "2014-09-13T20:26:00Z")
**Posts on this page:** 17
**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: [September 13, 2014, 8:26pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/1 "2014-09-13T20:26:00Z")

</div>

Is there an action that will set a field to an autoincrementing number start at the value of the first track?

E.g. I select four tracks, the first of which has track number = 42 . I reun the action. This leaves the tracks numbered 42, 43, 44, 45.

Thanks.

---

<div class="post-metadata">

### Author: ![stanman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@stanman](https://community.mp3tag.de/u/stanman)
#### Post date: [September 13, 2014, 11:42pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/2 "2014-09-13T23:42:45Z")

</div>

You can do that with the Autonumbering wizard.

Just change the value for "Begin at tracknumber".

---

<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 14, 2014, 12:20am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/3 "2014-09-14T00:20:07Z")

</div>

Thanks, but Autonumbering wizard is inaccessible from an action. I do need this in an action.

---

<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 14, 2014, 7:37am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/4 "2014-09-14T07:37:20Z")

</div>

> [@chrisjj](#):
>
> Is there an action that will set a field to an autoincrementing number start at the value of the first track?  
> E.g. I select four tracks, the first of which has track number = 42 .  
> I reun the action. This leaves the tracks numbered 42, 43, 44, 45. Thanks.

Begin Action Group **Format TRACK#Set TRACK count from 42** 

Action #1  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **42**

 

Action #2  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **$add(%TRACK%,$sub(%\_counter%,1))**

 

End Action Group **Format TRACK#Set TRACK count from 42** (2 Actions)

 

... or ...

 

The following proposal is nothing for production use.  
It is just a hack around the limitations of mp3tag, ...  
... because currently there is no shared memory between two tracks.  
Unfortunately there is no action to remove a (temporary) file from the filesystem.

 Begin Action Group **Format TRACK#Set TRACK count from given number** 

Action #1  
_Actiontype 15:_ **Export**  
_Select script filename:_ **Test.20140914.chrisjj.CountTrackStart**  
_Export filename \_\_\_\_\_\_:_ **$getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt'**

 [\_] Append data [\_] One file per folder 

Action #2  
_Actiontype 14:_ **Import text file**  
_Field \_\_:_ **TRACK**  
_Filename:_ **$getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt'**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **$add(%TRACK%,$sub(%\_counter%,1))**

 

End Action Group **Format TRACK#Set TRACK count from given number** (3 Actions)

 

Test.20140914.chrisjj.CountTrackStart.mte

 **$filename($getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt',UTF-8)%TRACK%** 

Note:  
For some reason Mp3tag executes the export as recently as at the end of action group, so the action group has to be performed twice.  
The export output file must not exist when starting the procedure.

 

You may split this process into two independent action groups

 

DD.20140914.1321.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 14, 2014, 10:19am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/5 "2014-09-14T10:19:09Z")

</div>

Thanks D.

The first is unsuitable because the start value is not the existing value of the first track.

The second looks promising. Is there some tool to import your listing into the .mte?

> [@DetlevD](#):
>
> For some reason Mp3tag executes the export as recently as at the end of action group

Florian explains here: [/t/6286/1](https://community.mp3tag.de/t/6286/1)

> [@DetlevD](#):
>
> The export output file must not exist when starting the procedure.

Why is that?

> [@DetlevD](#):
>
> You may split this process into two independent action groups

Perhaps that avoids "so the action group has to be performed twice."

---

<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 14, 2014, 11:01am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/6 "2014-09-14T11:01:50Z")

</div>

> [@chrisjj](#):
>
> ... The second looks promising. Is there some tool to import your listing into the .mte? ...

I could have offered the mte file, but you would like to rename it anyway ... 😉

> [@chrisjj](#):
>
> ... The export output file must not exist when starting the procedure. // Why is that?

If the export output file from the last run does exist, then the stored value from this file will be read, on the first run of the three-steps action, and this will cause erroneous behaviour.

> [@chrisjj](#):
>
> ... Perhaps that avoids "so the action group has to be performed twice."

I would say yes.

There will stay the unsolved problem to automatically remove the temporary export text file.  
Maybe it could be done by an additionally exported cmd file, which deletes the data file and itself.

DD.20140914.1501.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 14, 2014, 2:01pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/7 "2014-09-14T14:01:42Z")

</div>

> [@DetlevD](#):
>
> If the export output file from the last run does exist, then the stored value from this file will be read, on the first run of the three-steps action, and this will cause erroneous behaviour.

Ah, I see. Indeed unacceptable for production.

Perhaps this could be solved by an initial group that empties the file, using an export action.

> [@DetlevD](#):
>
> There will stay the unsolved problem to automatically remove the temporary export text file.

I can make the remaining temporary desktop file acceptable to me by placing it instead in %TEMP% .

> [@DetlevD](#):
>
> Maybe it could be done by an additionally exported cmd file, which deletes the data file and itself.

I was unaware that an action could execute a cmd file.

---

<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 14, 2014, 2:41pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/8 "2014-09-14T14:41:25Z")

</div>

> [@chrisjj](#):
>
> ... I was unaware that an action could execute a cmd file.

You can use the export feature of Mp3tag to create textual output, and name the filetype of the output file as you wish, you know that already, I am sure, there are many examples in the forum.  
Yes, the problem is, that Mp3tag does not 'invoke' or 'execute' or 'launch' an export script from within a running action.  
When using [Strg+E] Export, the just created export script will be 'launched' and so it can be 'executed'.

DD.20140914.1841.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 14, 2014, 2:57pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/9 "2014-09-14T14:57:59Z")

</div>

> [@DetlevD](#):
>
> You can use the export feature of Mp3tag to create textual output, and name the filetype of the output file as you wish, you know that already, I am sure, there are many examples in the forum.

Indeed. But as you say, that is not 'execute'.

---

<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 14, 2014, 3:27pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/10 "2014-09-14T15:27:55Z")

</div>

> [@chrisjj](#):
>
> Indeed. But as you say, that is not 'execute'.

If the Mp3tag export feature creates a text file named like "however export script_.cmd_", then it will be automatically launched to the system, perhaps a Mp3tag warning will come up (maybe adjustable in Tools/Options), then the cmd script will be executed.

DD.20140914.1927.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 14, 2014, 3:59pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/11 "2014-09-14T15:59:19Z")

</div>

> [@DetlevD](#):
>
> If the Mp3tag export feature creates a text file named like "however export script_.cmd_", then it will be automatically launched to the system

Not in an action, I find.

---

<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 15, 2014, 9:17am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/12 "2014-09-15T09:17:48Z")

</div>

> [@chrisjj](#):
>
> Is there an action that will set a field to an autoincrementing number start at the value of the first track? E.g. I select four tracks, the first of which has track number = 42 . I reun the action. This leaves the tracks numbered 42, 43, 44, 45. Thanks.

_[garbage removed]_

Here is another proposal, coded as a 2-step process, last trial ...

Begin Action Group **Format TRACK#Set TRACK count from given number.step1** 

Action #1  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TRACK\_TMP**

 

Action #2  
_Actiontype 15:_ **Export**  
_Select script filename:_ **Test.20140914.Track.tmp.step1**  
_Export filename \_\_\_\_\_\_:_ **$getEnv('TEMP')'\Track.tmp.txt'**

 [\_] Append data [\_] One file per folder 

End Action Group **Format TRACK#Set TRACK count from given number.step1** (2 Actions)

 Begin Action Group **Format TRACK#Set TRACK count from given number.step2** 

Action #1  
_Actiontype 14:_ **Import text file**  
_Field \_\_:_ **TRACK\_TMP**  
_Filename:_ **$getEnv('TEMP')'\Track.tmp.txt'**

 

Action #2  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK\_TMP**  
_Formatstring:_ **$regexp(%TRACK\_TMP%,'(\D._)_$',)**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **$if(%TRACK\_TMP%,$add($num(%TRACK\_TMP%,1),$sub(%\_counter%,1)),%TRACK%)**

 

Action #4  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TRACK\_TMP**

 

End Action Group **Format TRACK#Set TRACK count from given number.step2** (4 Actions)

 

Export script ...  
Test.20140914.Track.tmp.step1

 **$filename($getEnv('TEMP')'\Track.tmp.txt',ANSI)%TRACK%** 

How to use ...

 
1. Select the tracks to renumber.
2. Execute action "Format TRACK#Set TRACK count from given number.step1"
3. Execute action "Format TRACK#Set TRACK count from given number.step2"

 

You may create menu entries for both action groups in the Actions dialog "Utils".

 

Open questions:

 
- How to open "Utils" directly with only one hotkey?
- How to execute one specific meta group directly with only one hotkey?

 

DD.20140915.1332.CEST, DD.20140915.1714.CEST, DD.20140915.1959.CEST, DD.20140916.0936.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 15, 2014, 9:50am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/13 "2014-09-15T09:50:04Z")

</div>

> [@DetlevD](#):
>
> Using the dialog "Utils" within the dialog "Actions", I have tried to combine both action groups into one meta group, to start both action groups by one menu command, and this seems to work.

They appear in one menu group [http://i.imgur.com/zTAWOVu.png](http://i.imgur.com/zTAWOVu.png) but here cannot be started by that single menu command.

So I shall use the "Action groups" dialog [http://i.imgur.com/nLVYbf3.png](http://i.imgur.com/nLVYbf3.png)

First run gives this error: [http://i.imgur.com/WaPoYEQ.png](http://i.imgur.com/WaPoYEQ.png) . I have no idea why.

Second run fails silently. Perhaps CountTrackStop is misplaced?

---

<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: [September 15, 2014, 9:55am UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/14 "2014-09-15T09:55:26Z")

</div>

For several hours each day I sit behind a firewall that does allow access to that picture server you prefer to use.  
So could you either please upload the pictures to the mp3tag server or describe what they show?

---

<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 15, 2014, 1:10pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/15 "2014-09-15T13:10:32Z")

</div>

> [@chrisjj](#):
>
> ... Perhaps CountTrackStop is misplaced?

Make sure, within the Export dialog, which is called from within an action, that the filename edit field knows the correct output filename (we know this problem already).

DD.20140915.1710.CEST

See changes in post #12.

DD.20140915.2004.CEST, DD.20140916.0943.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 15, 2014, 11:26pm UTC](https://community.mp3tag.de/t/sequential-numbering-action/16136/16 "2014-09-15T23:26:15Z")

</div>

> [@DetlevD](#):
>
> Make sure, within the Export dialog, that the filename edit field knows the correct output filename (we know this problem already).

I did. It looks fine:

[http://i.imgur.com/QeZAUYo.png](http://i.imgur.com/QeZAUYo.png)  
[http://i.imgur.com/pDTp7CH.png](http://i.imgur.com/pDTp7CH.png)

---

<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/sequential-numbering-action/16136/17 "2026-02-09T12:25:16Z")

</div>


