# How to make on-demand context menu tagger script?

**URL:** https://community.metabrainz.org/t/how-to-make-on-demand-context-menu-tagger-script/601291
**Category:** MusicBrainz Picard
**Tags:** tagger, duplicates, taggerscript, sorting, picard
**Created:** [September 14, 2022, 7:35pm UTC](https://community.metabrainz.org/t/how-to-make-on-demand-context-menu-tagger-script/601291 "2022-09-14T19:35:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Deleted\_Editor\_1345327](https://community.metabrainz.org/user_avatar/community.metabrainz.org/deleted_editor_1345327/32/59492_2.png) [@Deleted\_Editor\_1345327](https://community.metabrainz.org/u/Deleted_Editor_1345327)
#### Post date: [September 14, 2022, 7:35pm UTC](https://community.metabrainz.org/t/how-to-make-on-demand-context-menu-tagger-script/601291/1 "2022-09-14T19:35:55Z")

</div>

I am trying to make an on-demand context menu tagger script that sorts multiple values in the %genre% field, as well as purges duplicate values in the %genre% field.

My issue is that the context menu, _Run Scripts_, when clicked from either the _Unclustered Files_ or _Clusters_ node has no effect on the %genre% tag.

My tagger script,

> $sortmulti(%genre%)  
> $unique(%genre%)

Am I doing something wrong?

The reason I want to access this from the _Unclustered Files_/_Clusters_ node is that my files are already tagged with MB metadata, so I do not need to retag them from MB. I basically want to sanitize my %genre% tags with my own existing values.

---

<div class="post-metadata">

### Author: ![rdswift](https://community.metabrainz.org/user_avatar/community.metabrainz.org/rdswift/32/7032_2.png) [@rdswift](https://community.metabrainz.org/u/rdswift)
#### Post date: [September 14, 2022, 8:31pm UTC](https://community.metabrainz.org/t/how-to-make-on-demand-context-menu-tagger-script/601291/2 "2022-09-14T20:31:11Z")

</div>

I think that the problem is that you’re not assigning the returned values to anything. Perhaps try something like:

```auto
$set(genre,$unique($sortmulti(%genre%)))

```

---

<div class="post-metadata">

### Author: ![Deleted\_Editor\_1345327](https://community.metabrainz.org/user_avatar/community.metabrainz.org/deleted_editor_1345327/32/59492_2.png) [@Deleted\_Editor\_1345327](https://community.metabrainz.org/u/Deleted_Editor_1345327)
#### Post date: [September 15, 2022, 12:44am UTC](https://community.metabrainz.org/t/how-to-make-on-demand-context-menu-tagger-script/601291/3 "2022-09-15T00:44:11Z")

</div>

> [@rdswift](#):
>
> `$set(genre,$unique($sortmulti(%genre%)))`

That worked. Thank you sir.
