# Unique Album Category ID

**URL:** https://community.mp3tag.de/t/unique-album-category-id/12054
**Category:** Support
**Created:** [May 29, 2011, 4:45am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054 "2011-05-29T04:45:57Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [May 29, 2011, 4:45am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/1 "2011-05-29T04:45:57Z")

</div>

Hi everyone!

I have been working on getting my script up and running , but cant seem to figure out how to give an album an unique ID number.

The script i have so far:

```
$loop(%_folderpath%)%title%;$ifgreater($strstr($lower($get(memdirectory)),$lower(%_directory%)),0,test($get(memcounter)),$put(memcounter,%_counter%));$puts(memdirectory,%_directory%);

```

I use $strstr($lower($get(memdirectory)),$lower(%\_directory%)) to compare the current directory with the previous directory (memdirectory) and determine if this is true (1) or untrue (0).

I cannot figure this out and have been working 6 hours on it......

This is what i would like to accomplish, but i guess i am just to stupid to figure it out...

[😳](http://www.flickr.com/photos/62831983@N08/5770827582/)

---

<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: [May 29, 2011, 6:31am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/2 "2011-05-29T06:31:44Z")

</div>

> [@necrosis](#):
>
> ... I have been working on getting my script up and running , but cant seem to figure out how to give an album an unique ID number. ...

Hi 'necrosis', please can you elaborate what you want to achieve?  
What it the reason and what is the goal of your scripting efforts?  
Do you need a simple running counter number per album in a small set of albums?  
Do you need a worlwide everlasting unique id (GUID) per album?

DD.20110529.1032.CEST

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [May 29, 2011, 11:04am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/3 "2011-05-29T11:04:57Z")

</div>

> [@DetlevD](#):
>
> Hi 'necrosis', please can you elaborate what you want to achieve?  
> What it the reason and what is the goal of your scripting efforts?  
> Do you need a simple running counter number per album in a small set of albums?  
> Do you need a worlwide everlasting unique id (GUID) per album?
> 
> DD.20110529.1032.CEST

Hi DetlevD

Thank you for your quick response. Because i have so many music, I want to organize and import my complete mp3 collection within a webbased collection tool. Then i want to link this to (for example XBMC), and listen to my music when en where i want.

For this to work i need to create a CateroryID and a ProductID (Those are just the field names the tool uses).

Please take a look at my screenshot, where I circled the red parts in what i despreately try to achieve:

The script needs to generate, for each directory (Albums) and sub directory's, an unique CategoryID number (not need to be worldwide unique, just within the tool). Within these directory's (CategoryID) are MP3 songs. These need to get an unique ProductID according to the CategoryID. My idea to keep it simple is to just append \*.1, \*.2 etc..

So for example my screenshot. The first album from the top gets an unique CatalogID numer 1 and a unique ProductID for song 1 =\> 1.1 and song2 =\>1.2

I hope this makes things more clear?

Thank you for all your help, as i cant seem to figure things out!

---

<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: [May 29, 2011, 12:35pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/4 "2011-05-29T12:35:20Z")

</div>

> [@necrosis](#):
>
> ... I want to organize and import my complete mp3 collection within a webbased collection tool.  
> For this to work i need to create a CateroryID and a"ProductID" (Those are just the field names the tool uses. ... generate for each directory (and sub directory's) an unique ID number (not need to be worldwide unique, just within the tool). Within these directory's are MP3 songs. These need to get an unique ProductID according to the CategoryID (it just append\*.1, \*.2 etc..) ...

As I understand the situation ...

- You speak of CatalogID, CategoryID, ProductID, so CatalogID and CategoryID are used as synonyms?
- Does the CategoryID have the importance of Genre or other musical classification? Or is it in your case of application just the same as the folderpath?
- The ProductID is needed per track? You want to create the PRoductID simply by appending a running number to the CategoryID?
- Does it be true, that all IDs are not visible to the user, must not be human readable, and are only used internally by the database?

I recommend to use a GUID as ProductID per track and a GUID per Album as CategoryID.  
GUIDs can be created rather easy.  
See also ...  
[Cover Bilder exportieren - importieren](https://community.mp3tag.de/t/11520/4)  
Once the GUID list file has been created, the converter Textfile - Tag can import the GUIDs into the tracks.

If you want to create your own running number based routine, then you may play with the following MTE export script to understand how to code a $loop() ... $loopend() structure and how to use %\_counter% placeholder.  
Be aware that the Mp3tag Export Scripting Language does not support to $get() a $put() variable within a loop, which has been defined outside of the loop.

**$filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.txt',ANSI) $loop(%\_folderpath%,1)$loopend()'1: All FolderCount = '%\_max\_counter% $loop(%\_path%)$loopend()'2: All FileCount = '%\_max\_counter% $repeat('=',50) $loop(%\_folderpath%,1) '3: FolderNumber = '%\_counter% '4: FolderPath = '%\_folderpath% $loop(%\_path%)$loopend()'5: FileCount = '%\_max\_counter% $loop(%\_path%) '6: FileNumber = '%\_counter% '7: FilePath = '%\_path% $loopend()$repeat('-',50) $loopend()**

DD.20110529.1637.CEST

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 2, 2011, 12:33am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/5 "2011-06-02T00:33:50Z")

</div>

> [@DetlevD](#):
>
> As I understand the situation ...
> 
> - You speak of CatalogID, CategoryID, ProductID, so CatalogID and CategoryID are used as synonyms?
> - Does the CategoryID have the importance of Genre or other musical classification? Or is it in your case of application just the same as the folderpath?
> - The ProductID is needed per track? You want to create the PRoductID simply by appending a running number to the CategoryID?
> - Does it be true, that all IDs are not visible to the user, must not be human readable, and are only used internally by the database?
> 
> I recommend to use a GUID as ProductID per track and a GUID per Album as CategoryID.  
> GUIDs can be created rather easy.  
> See also ...  
> [Cover Bilder exportieren - importieren](https://community.mp3tag.de/t/11520/4)  
> Once the GUID list file has been created, the converter Textfile - Tag can import the GUIDs into the tracks.
> 
> If you want to create your own running number based routine, then you may play with the following MTE export script to understand how to code a $loop() ... $loopend() structure and how to use %\_counter% placeholder.  
> Be aware that the Mp3tag Export Scripting Language does not support to $get() a $put() variable within a loop, which has been defined outside of the loop.
> 
> **$filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Export.txt',ANSI) $loop(%\_folderpath%,1)$loopend()'1: All FolderCount = '%\_max\_counter% $loop(%\_path%)$loopend()'2: All FileCount = '%\_max\_counter% $repeat('=',50) $loop(%\_folderpath%,1) '3: FolderNumber = '%\_counter% '4: FolderPath = '%\_folderpath% $loop(%\_path%)$loopend()'5: FileCount = '%\_max\_counter% $loop(%\_path%) '6: FileNumber = '%\_counter% '7: FilePath = '%\_path% $loopend()$repeat('-',50) $loopend()**
> 
> DD.20110529.1637.CEST

Wow!! Thank you for your response, this helped me a great deal in getting me going 🙂

Is it also possible to get the CATEGORYID (see screenshot) within every row?

Now you first loop the CATEGORYID and then loop the PRODUCTID. I tried again for one day now to get the CATEGORYID listed in the same row as the PRODUCTID.

The output right now is like this:

# 1: All FolderCount = 7 2: All FileCount = 20

3: FolderNumber = 1  
4: FolderPath = \\Africa\_HiTech-Out\_In\_The\_Streets-(WAP315DV)-WEB-2011-KOUALA  
5: FileCount = 1

## 6: FileNumber = 1 7: FilePath = \\Africa\_HiTech-Out\_In\_The\_Streets-(WAP315DV)-WEB-2011-KOUALA\01-africa\_hitech-out\_in\_the\_streets-kouala.mp3

3: FolderNumber = 2  
4: FolderPath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320  
5: FileCount = 2

6: FileNumber = 1  
7: FilePath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320\01-appleblim\_and\_october-ny\_fizzzzz.mp3

## 6: FileNumber = 2 7: FilePath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320\02-appleblim\_and\_october-fountains\_of\_paradise.mp3

But what i try to achieve is

# 1: All FolderCount = 7 2: All FileCount = 20

3: FolderNumber = 1  
4: FolderPath = \\Africa\_HiTech-Out\_In\_The\_Streets-(WAP315DV)-WEB-2011-KOUALA  
5: FileCount = 1

## **3: FolderNumber = 1** 6: FileNumber = 1 7: FilePath = \\Africa\_HiTech-Out\_In\_The\_Streets-(WAP315DV)-WEB-2011-KOUALA\01-africa\_hitech-out\_in\_the\_streets-kouala.mp3 **5: FileCount = 1**

3: FolderNumber = 2  
4: FolderPath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320  
5: FileCount = 2

**3: FolderNumber = 2**  
6: FileNumber = 1  
7: FilePath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320\01-appleblim\_and\_october-ny\_fizzzzz.mp3  
**5: FileCount = 2**

## **3: FolderNumber = 2** 6: FileNumber = 2 7: FilePath = \\Appleblim\_And\_October-NY\_Fizzzzz-(PLATTER001)-WEB-2011-320\02-appleblim\_and\_october-fountains\_of\_paradise.mp3 **5: FileCount = 2**

I feel so stupid that i cant accomplish this. If i could just use my variables outside the loops my problems would all be solved.. Hope you can help!

Thanks for any response from you coding wizards!

---

<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: [June 2, 2011, 4:51am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/6 "2011-06-02T04:51:02Z")

</div>

> [@necrosis](#):
>
> Wow!! Thank you for your response, this helped me a great deal in getting me going 🙂 ...  
> Is it also possible to get the CATEGORYID (see screenshot) within every row?  
> Now you first loop the CATEGORYID and then loop the PRODUCTID.  
> I tried again for one day now to get the CATEGORYID listed in the same row as the PRODUCTID. ... I feel so stupid that i cant accomplish this.  
> If i could just use my variables outside the loops my problems would all be solved. ...

There are restrictions in the Mp3tag Export Scripting Language, I have pointed out.  
I assume that it is necessary to create some custom tag-fields, which you fill with the correct values ​​in order to use them in an export. After exporting you can delete the custom tag-fields.

Or write two export scripts, which creates text data files for both cases, with the proper values in order to load the values back into the files into the tag-fields using converter 'Textfile - Tag'.

Proove your concept of numbering with a serial number.  
Once you have to insert a new item into the set, you have to renumber the complete set.  
This is inefficient.

DD.20110602.0914.CEST

I have pity with you, so I wrote a Mp3tag MTE export script, which generates a VBScript VBS command file, which generates a CSV text file, which can be used as input for the Mp3tag converter 'Textfile- Tag' to set a serial number for each folder and within each folder for each file.

[20110602.Export\_VBS\_SerialNumber.mte](https://community.mp3tag.de/uploads/default/original/2X/5/5a8b9b55bc8c31537d244ebe34cd473e314a4089.mte) (5.6 KB)  
Note: After downloading this MTE script, ...  
please replace in the very first text line ... within the function $filename ...  
in the second parameter ... the word "UTF-8" with the word "ANSI".

DD.20110602.1234.CEST, DD.20150724.1020.CEST

[20110602.Export\_VBS\_SerialNumber.mte](https://community.mp3tag.de/uploads/default/original/2X/5/5a8b9b55bc8c31537d244ebe34cd473e314a4089.mte) (5.6 KB)

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 2, 2011, 12:23pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/7 "2011-06-02T12:23:39Z")

</div>

> [@DetlevD](#):
>
> There are restrictions in the Mp3tag Export Scripting Language, I have pointed out.  
> I assume that it is necessary to create some custom tag-fields, which you fill with the correct values ​​in order to use them in an export. After exporting you can delete the custom tag-fields.
> 
> Or write two export scripts, which creates text data files for both cases, with the proper values in order to load the values back into the files into the tag-fields using converter 'Textfile - Tag'.
> 
> Proove your concept of numbering with a serial number.  
> Once you have to insert a new item into the set, you have to renumber the complete set.  
> This is inefficient.
> 
> DD.20110602.0914.CEST
> 
> I have pity with you, so I wrote a Mp3tag MTE export script, which generates a VBScript VBS command file, which generates a CSV text file, which can be used as input for the Mp3tag converter 'Textfile- Tag' to set a serial number for each folder and within each folder for each file.
> 
> [20110602.Export\_VBS\_SerialNumber.mte](https://community.mp3tag.de/uploads/default/original/2X/5/5a8b9b55bc8c31537d244ebe34cd473e314a4089.mte) (5.6 KB)
> 
> DD.20110602.1234.CEST

I am lost with words on the way you help people with their problems.. This is really fantastic, thank you so much for helping me out on my quest to get my export right and working!

Creating some custom tag fields is no problem as long as i don't overwrite the original source file (MP3). I also thought about the two text files option, but wouldn't know where to begin...

The .vbs option didn't even come to mind......

The mp3tag generation of the vbs works fine, but when i click on the .vbs to execute i get an Windows Script Host error? Am i missing something or doing something wrong here?

[![](https://community.mp3tag.de/uploads/default/original/3X/d/c/dcefb2c573fbe12e8d192743ace2e689ed68c1bd.jpeg)](http://www.flickr.com/photos/62831983@N08/5789836857/)

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 2, 2011, 12:41pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/8 "2011-06-02T12:41:32Z")

</div>

QUOTE (necrosis @ Jun 2 2011, 16:23) \<{POST\_SNAPBACK}\>

I am lost with words on the way you help people with their problems.. This is really fantastic, thank you so much for helping me out on my quest to get my export right and working!

Creating some custom tag fields is no problem as long as i don't overwrite the original source file (MP3). I also thought about the two text files option, but wouldn't know where to begin...

The .vbs option didn't even come to mind......

The mp3tag generation of the vbs works fine, but when i click on the .vbs to execute i get an Windows Script Host error? Am i missing something or doing something wrong here?

[🙂 Changed UTF-8 to ANSI and then it exports the txt file.](http://www.flickr.com/photos/62831983@N08/5789836857/)

Now on to figuring out the rest 😃

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 3, 2011, 2:05pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/9 "2011-06-03T14:05:37Z")

</div>

> [@necrosis](#):
>
> I got the script working 🙂 Changed UTF-8 to ANSI and then it exports the txt file.
> 
> Now on to figuring out the rest 😃

Thanks to your help i got everything almost ready for processing 😃 Without your help i wouldn't have come this far in a million years! Your examples really given me a boost in understanding MP3TAG its possibilities and limitations.

I still have two mayor problem left where i have spend the night on trying to solve (yes again now the fourth day in a row...). Seems like i can't tackle these problems so any help is REALLY appreciated!

**First problem i am facing:**

Is the extraction/renaming of mp3 files, here a couple of example files:

Cameo-1xtra\_Showcase\_Live\_on\_Radio\_1\_(Jason\_Kaye\_Guestmix)-CABLE-05-22-2011-uC  
3rd\_Party-3RD02-noise\_factory-1992-sour  
Dillinja\_-\_Cybotron-Retail\_CD-2001-BOSS\_INT  
Refresh-Your\_Skills\_Once\_In\_A\_While\_By\_Pressing\_Buttons-2011-404  
VA-Hardware\_XV-15\_Years\_Of\_Renegade\_Hardware-(HWAREXVCD1)-3CD-2011-hM  
VA-Legendary\_Sounds\_Volume\_1-RIVETCD21-2005-PiCKLE\_iNT  
VA-MOS\_The\_Mash\_Up\_Mix\_Bass\_\_Mixed\_By\_The\_Cut\_Up\_Boys-2CD-2011-BPM  
Kromestar-Bonafied\_Hustlahz-(DPH003)-Vinyl-2010-BNP  
white\_label-unknown\_artist-bw001-(200 **x** )-sour

Basically remove the last part (which can consist out of character and or number) but is not allways present to should check, remove the year and encapsulation (always written as 4 numbers or three numbers and any character e.g. 200x, sometimes accompanied bij encapsulation e.g. (1999)

Secondly i would really like to copy the ALBUM ID's to a separate tag field %albumsort%. These ID's are currently not in the Tag fields, but only in the directory name ☹  
This are ID's like (DPH003), 3RD02 or RIVETCD21). These album ID's are always formatted like this e.g. Any word character times \* followed bij two or 3 numbers =\>DPH003  
Sometimes they are encapsulated bij () and sometimes bij spaces or the - signs.  
It would be visually nice to give each first character a YUppercase and the ALBUM ID all uppercases.

When done i would be ecstatic if the result will show:

Cameo-1xtra\_Showcase\_Live\_on\_Radio\_1\_(Jason\_Kaye\_Guestmix)  
3rd\_Party-3RD02-noise\_factory  
Dillinja\_-\_Cybotron-Retail\_CD  
Refresh-Your\_Skills\_Once\_In\_A\_While\_By\_Pressing\_Buttons  
VA-Hardware\_XV-15\_Years\_Of\_Renegade\_Hardware-(HWAREXVCD1)-3CD  
VA-Legendary\_Sounds\_Volume\_1-RIVETCD21  
VA-MOS\_The\_Mash\_Up\_Mix\_Bass\_\_Mixed\_By\_The\_Cut\_Up\_Boys-2CD  
Kromestar-Bonafied\_Hustlahz-(DPH003)  
White\_Label-Unknown\_Artist-BW001

And be presented cleanly in the output like:

Cameo - 1xtra Showcase Live on Radio 1 - (Jason Kaye Guestmix)  
3rd Party - Noise\_Factory - 3RD02  
Dillinja - Cybotron - Retail CD  
Refresh - Your Skills Once In A While By Pressing Buttons  
VA - Hardware XV - 15 Years Of Renegade Hardware - HWAREXVCD1 - 3CD  
VA - Legendary Sounds Volume 1 - RIVETCD21  
VA - MOS The Mash Up Mix Bass - Mixed By The Cut Up Boys - 2CD  
Kromestar - Bonafied Hustlahz - DPH003  
White Label - Unknown Artist - BW001

**Second Problem**

Second problem im facing is that when i add new songs to my library and run your awesome vbs script again, everything gets renumbered.... Is there a way to only update new and or changed songs? I thought of using filters? but i don't know if that is the best way to approach this? Maybe store the last catergoryid and productid in a text file and go from there?

And that's about it....... Not your everyday problem around here i guess... I feel so stupid that i cant solve these (even after two nights of coding).

Thank you all for any help you can give me in trying to solve my technically challenged questions 🙂

---

<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: [June 3, 2011, 3:18pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/10 "2011-06-03T15:18:09Z")

</div>

> [@necrosis](#):
>
> **First problem i am facing:**  
> Cameo-1xtra\_Showcase\_Live\_on\_Radio\_1\_(Jason\_Kaye\_Guestmix)-CABLE-05-22-2011-uC

If data is as wildly structured as this, I would always use filters to see whether any wildcard action really hits the files I want to manipulate.  
If I have a look at the examples it looks like the following pattern to me:

-\_-  
So any string you want to chop off the end from has the pattern  
underscorehyphen.  
A filter with  
%_filename% MATCHES ".-._._-._"  
should filter all those that still have a hyphen at the end.  
Then you could perform a replace with regular expression action to chop off the end until you are left with no other hypen than the starting one.

One problem that you have to solve for yourself is the wish to in some cases keep data at the end

> [@](#):
>
> VA-Hardware\_XV-15\_Years\_Of\_Renegade\_Hardware-(HWAREXVCD1)-3CD-2011-hM  
> ...  
> VA - Hardware XV - 15 Years Of Renegade Hardware - HWAREXVCD1 - 3CD

and sometimes not.  
Also the change places bit in

> [@](#):
>
> 3rd\_Party-3RD02-noise\_factory-1992-sour  
> ....  
> 3rd Party - Noise\_Factory - 3RD02

requires a lot of clairvoyance by a program/script...

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 11, 2011, 12:01am UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/11 "2011-06-11T00:01:17Z")

</div>

Thanks for your reaction 🙂

I have done some serious diggin on ReEx and written a script to do most of what i need!

\b[\d0-9]?([a-z]{2,}?[\d0-9]{2,}?|[a-z]{2,}?[\d0-9]+[a-z]+|[a-z]{4,}?[\d0-9]+|[a-z]{2,}?[\d0-9]{2,}?|[\d0-9]+[a-z][\d0-9]+|[\d0-9]{5,})\b

9 times out of 10 it filters out the Album ID:

VA-Points\_in\_Time\_007-(GLRPIT007)-CD1-2000-CT\_INT  
XL\_Recordings-XLS24CD-SL2-1991-sour

It picks up GLRPIT007 and also XLS24CD.

I have searched everywhere, but how can use this regex and manage to match these within a directory field and put this in a custom Field? I only see the replace function within mp3tag?

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 13, 2011, 12:37pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/12 "2011-06-13T12:37:18Z")

</div>

Anybody has knowledge on this?

I have turned to Visual Basic as i believe it is not possible within MP3TAG....

---

<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: [June 13, 2011, 1:24pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/13 "2011-06-13T13:24:02Z")

</div>

Take a look at the Actions (Alt+5)  
**Format value** with $regexp() function and **Replace with regular expression** can be used.

---

<div class="post-metadata">

### Author: ![necrosis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@necrosis](https://community.mp3tag.de/u/necrosis)
#### Post date: [June 13, 2011, 1:42pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/14 "2011-06-13T13:42:20Z")

</div>

Hi Dano,

Thank you for your response. I looked at that, but i cant seem to figure out how to do this. I do not want to replace anything i just want to match the Albumid within the Directory and place this match in a tag field? Could you please help me? I looked all around the forum and couldn't find any topic related to my problem.

---

<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: [June 13, 2011, 2:43pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/15 "2011-06-13T14:43:35Z")

</div>

Ok this one seems best:

_Action type:_ **Guess values**  
_Source format:_ **$regexp(%\_directory%,'\b\d?([a-z]{2,}?\d{2,}?|[a-z]{2,}?\d+[a-z]+|[a-z]{4,}?\d+|[a-z]{2,}?\d{2,}?|\d+[a-z]\d+|\d{5,})\b', ~~~$1~~~ ,1)**  
_Guessing pattern:_ **%dummy% ~~~%albumsort%~~~ %dummy%**

- I shortened [\d0-9] to \d

---

<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:23pm UTC](https://community.mp3tag.de/t/unique-album-category-id/12054/16 "2026-02-09T12:23:07Z")

</div>


