Mp3 Tag File (Built)

Write the while (true) loop like this:

while (true) {
    msg = dlg.GetMsg();
    if (!msg.result) break;

    var sayGoodBye = false;
    
    if (msg.event == "click") {

        switch (msg.control) {

            case "btn_anadir_caratula":
                coverart_usuario = dlg.open("Carátula");
                dlg.Control("caratula").label = Script.LoadImage(coverart_usuario);
                break;

            case "btn_eliminar_caratula":
                dlg.Control("caratula").label = '';
                dlg.Control("resolucion").label = '';
                break;

            case "btn_eliminar_todo":
                dlg.Control("titulo").value = '';
                dlg.Control("artista").value = '';
                dlg.Control("album").value = '';
                dlg.Control("anio").value = '';
                dlg.Control("pista").value = '';
                dlg.Control("genero").label = '';
                dlg.Control("comentario").value = '';
                dlg.Control("artista_album").value = '';
                dlg.Control("compositor").value = '';
                dlg.Control("numero_disco").value = '';
                dlg.Control("caratula").label = '';
                dlg.Control("resolucion").label = '';
                break;

            case "btn_guardar":
                var cmdLine = 'SetAttr META' +
                    ' "album:' + dlg.Control('album').value + '"' +
                    ' "albumartist:' + dlg.Control('artista_album').value + '"' +
                    ' "artist:' + dlg.Control('artista').value + '"' +
                    ' "comment:' + dlg.Control('comentario').value + '"' +
                    ' "composers:' + dlg.Control('compositor').value + '"' +
                    ' "discnumber:' + dlg.Control('numero_disco').value + '"' +
                    ' "genre:' + dlg.Control('genero').value.name + '"' +
                    ' "title:' + dlg.Control('titulo').value + '"' +
                    ' "track:' + dlg.Control('pista').value + '"' +
                    ' "year:' + dlg.Control('anio').value + '"' +
                    ' "coverart:3:' + coverart_usuario + '"';

                DOpus.Output(cmdLine);
                cmd.RunCommand(cmdLine);
                sayGoodBye = true;
                break;
        }
    }

    if (sayGoodBye) break;
}

I also added the title tag that was missing last time.

1 Like

Now I don't have anything else to add, just thank you, thank you and thank you, thank you a thousand times @lxp for everything!!! :clap: :clap: :clap:

Happy tagging! :partying_face:

1 Like

Thinking about musical genres, it would be ideal if these could be edited so that each person has the ones they like or need, could you help me with that?

Seeing other scripts I only knew how to write this:

    initData.config_desc = DOpus.Create.Map();
    configName = "genero";
    initData.Config[configName] = true;
    initData.config_desc(configName) = "Customize music genres";

Opus already has a list of genres. Do you want to maintain a second list? The internal list could be made available in the object model (I don't think it is yet). Then it'd be straightforward to add this collection to a drop-down.

If you don't want to wait, you could parse musicgenres.xml yourself. Here's an example you could copy:

RecentToCollection

dasota I saw my shadow in you, I also have tried create some button for tagging Music files. Please Share your Button and script with me when it's complete.

Hi @khalidhosain, the script is ready, you can access it from here. There is a version in Spanish and another in English, enjoy it!

@lxp I published a version of the script in English with the musical genres that you proposed, those of Opus, but knowing that musical genres vary a lot from person to person, I would like the script to allow the customization of musical genres, either by eliminating some of those present, as if adding something new.

Something like this...

01

02

That's fine, check out ScriptConfig and decide if you prefer a comma-separated or a multi-line entry.

Then fill it with the default value and read any changes made by the user at the beginning of your script. The rest will be the same.

Mind that there are two types of genre tags - ID3V1 with numerical value indicating a genre from a predefined set (some devices support only V1) and ID3V2 TCON which is a free text field (ID3 Tags).
I assume you are not considering Vorbis/APE?

Thank you very much @lxp, I will study that part of the manual.

True @, my goal is the IDE3V2 Tag.

I have managed to write the following lines, but I have two problems:

  1. The data has to be specified separated by commas, and not multi-line as I would like.

  2. The data specified in the script configuration is not what appears in the "Genre" field of the script in use.

Could you help me?

initData.config_desc = DOpus.Create.Map();
var genero = "Romántico, Balada, Bolero, Trova, Patrio, Son, Salsa, Guaracha, Montuno, Cumbia, Merengue, Tropical, Ranchera, Reggae, Reggaetón, Hip Hop, Pop, Rock, Tecno, Electrónico, Jazz, Infantil, Religioso, Instrumental, Vocal, Efecto sonoro, Inglés, Bossa Nova, Tropicália, Samba, Pagode, Lambada, MPB, Forró, Sertanejo, Sertanejo universitário, Axé, Funk, Gospel, Brega, Choro, Frevo, Baião, Piseiro, Pisadinha"; 
configName = "genero";
initData.config[configName] = genero;
initData.config_desc(configName) = "Modificar géneros musicales";

01

@WKen and @lxp I'm sorry to bother you, but I'm stuck in this situation and I don't know how to get out of it, could you help me relate this part of the code:

initData.config_desc = DOpus.Create.Map();
configName = "genero";
initData.config_desc(configName) = "Modificar géneros musicales";

var genero_pre = DOpus.NewVector();
genero_pre.push_back = "Jazz";
genero_pre.push_back = "Pop";

initData.config[configName] = genero_pre;

with:

dlg.Control("genero").label = item.metadata.audio.mp3genre; 

I replaced:
dlg.Control("genero").label = item.metadata.audio.mp3genre; com
dlg.Control("genero").label = genero_pre;
but it does not work.

What I'm trying to do is that the "genero" control (editable combobox) can be customized, that is, genres can be added or removed from the script's settings button. Thank you very much and sorry for inconvenience.

Complete code
// Mp3 Tag File
// (c) 2024 DASOTA
// Script para Directory Opus.

function OnInit(initData) {
    initData.name = "Mp3 Tag File";
    initData.version = "1.0";
    initData.copyright = "(c) 2024 DASOTA";
    initData.desc = "Editor Mp3 Tag de archivo único";
    initData.default_enable = true;
    initData.min_version = "13.0";

// Personalizar géneros musicales

	initData.config_desc = DOpus.Create.Map();
    configName = "genero";
	initData.config_desc(configName) = "Modificar géneros musicales";

     var genero_pre = DOpus.NewVector();
     genero_pre.push_back = "Romántico";
     genero_pre.push_back = "Balada";
     genero_pre.push_back = "Bolero";
     genero_pre.push_back = "Trova";
     genero_pre.push_back = "Patrio";
     genero_pre.push_back = "Son";
     genero_pre.push_back = "Salsa";
     genero_pre.push_back = "Guaracha";
     genero_pre.push_back = "Montuno";
     genero_pre.push_back = "Cumbia";
     genero_pre.push_back = "Merengue";
     genero_pre.push_back = "Tropical";
     genero_pre.push_back = "Ranchera";
     genero_pre.push_back = "Reggae";
     genero_pre.push_back = "Reggaetón";
     genero_pre.push_back = "Hip Hop";
     genero_pre.push_back = "Pop";
     genero_pre.push_back = "Rock";
     genero_pre.push_back = "Tecno";
     genero_pre.push_back = "Electrónico";
     genero_pre.push_back = "Jazz";
     genero_pre.push_back = "Infantil";
     genero_pre.push_back = "Religioso";
     genero_pre.push_back = "Instrumental";
     genero_pre.push_back = "Vocal";
     genero_pre.push_back = "Efecto sonoro";
     genero_pre.push_back = "Inglés";
     genero_pre.push_back = "Bossa Nova";
     genero_pre.push_back = "Tropicália";
     genero_pre.push_back = "Samba";
     genero_pre.push_back = "Pagode";
     genero_pre.push_back = "Lambada";
     genero_pre.push_back = "MPB";
     genero_pre.push_back = "Forró";
     genero_pre.push_back = "Sertanejo";
     genero_pre.push_back = "Sertanejo universitário";
     genero_pre.push_back = "Axé";
     genero_pre.push_back = "Funk";
     genero_pre.push_back = "Gospel";
     genero_pre.push_back = "Brega";
     genero_pre.push_back = "Choro";
     genero_pre.push_back = "Frevo";
     genero_pre.push_back = "Baião";
     genero_pre.push_back = "Piseiro";
     genero_pre.push_back = "Pisadinha";

	initData.config[configName] = genero_pre;
}

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand();
    cmd.name = "Mp3TagFile";
    cmd.method = "OnMp3TagFile";
    cmd.desc = "";
    cmd.label = "Mp3 Tag File";
    cmd.template = "Mp3TagFile";
    cmd.hide = false;
    cmd.icon = "script";
}

function OnMp3TagFile(scriptCmdData) {
    var dlg = scriptCmdData.func.Dlg();
    dlg.title = "Mp3 Tag File - Directory Opus";
    dlg.template = 'Mp3TagFile';
    dlg.detach = true;
    dlg.Create

    var tab = scriptCmdData.func.sourcetab;
    var item = tab.selected_files(0);

    dlg.Control("archivo").value = item.name_stem;
    dlg.Control("titulo").value = item.metadata.audio.mp3title;
    dlg.Control("artista").value = item.metadata.audio.mp3artist;
    dlg.Control("album").value = item.metadata.audio.mp3album;
    dlg.Control("anio").value = item.metadata.audio.mp3year;
    dlg.Control("pista").value = item.metadata.audio.mp3track;
    dlg.Control("genero").label = item.metadata.audio.mp3genre;
    dlg.Control("comentario").value = item.metadata.audio.mp3comment;
    dlg.Control("artista_album").value = item.metadata.audio.mp3albumartist;
    dlg.Control("compositor").value = item.metadata.audio.composers;
    dlg.Control("numero_disco").value = item.metadata.audio.mp3disc;

    if (item.metadata.audio.coverart > 0) {
        var tmpFile = DOpus.FSUtil().GetTempFile();
        tmpFile.Write(item.metadata.audio.coverart(0).data);
        tmpFile.Close();
        dlg.Control("caratula").label = Script.LoadImage(tmpFile);
    } else {
        dlg.Control("caratula").label = '';
    }

    dlg.Control("caratula").bg = "#FFFFFF";

    if (item.metadata.audio.coverart > 0) {
        var tmpFile = DOpus.FSUtil().GetTempFile();
        tmpFile.Write(item.metadata.audio.coverart(0).data);
        tmpFile.Close();
        var reso = item.metadata.audio.coverart(0);
        dlg.Control("resolucion").label = reso.width + " x " + reso.height + " x " + reso.depth + " (" + reso.size.fmt + ")";
    } else {
        dlg.Control("resolucion").label = '';
    }

    dlg.Control("resolucion").fg = "#000000";
    dlg.Control("resolucion").bg = "#FFFFFF";

    dlg.Show

    while (true) {
        msg = dlg.GetMsg();
        if (!msg.result) break;

        var sayGoodBye = false;

        var cmd = scriptCmdData.func.command;
        var coverart_usuario;


        if (msg.event == "click") {
            switch (msg.control) {

                case "btn_anadir_caratula":
                    coverart_usuario = dlg.open("Carátula");
                    dlg.Control("caratula").label = Script.LoadImage(coverart_usuario);
                    break;

                case "btn_eliminar_caratula":
                    dlg.Control("caratula").label = '';
                    dlg.Control("resolucion").label = '';
                    break;

                case "btn_eliminar_todo":
                    dlg.Control("titulo").value = '';
                    dlg.Control("artista").value = '';
                    dlg.Control("album").value = '';
                    dlg.Control("anio").value = '';
                    dlg.Control("pista").value = '';
                    dlg.Control("genero").label = '';
                    dlg.Control("comentario").value = '';
                    dlg.Control("artista_album").value = '';
                    dlg.Control("compositor").value = '';
                    dlg.Control("numero_disco").value = '';
                    dlg.Control("caratula").label = '';
                    dlg.Control("resolucion").label = '';
                    break;

                case "btn_guardar":
                    var cmdLine = 'SetAttr META' +
                        ' "title:' + dlg.Control('titulo').value + '"' +
                        ' "artist:' + dlg.Control('artista').value + '"' +
                        ' "album:' + dlg.Control('album').value + '"' +
                        ' "year:' + dlg.Control('anio').value + '"' +
                        ' "track:' + dlg.Control('pista').value + '"' +
                        ' "genre:' + dlg.Control('genero').value.name + '"' +
                        ' "comment:' + dlg.Control('comentario').value + '"' +
                        ' "albumartist:' + dlg.Control('artista_album').value + '"' +
                        ' "composers:' + dlg.Control('compositor').value + '"' +
                        ' "discnumber:' + dlg.Control('numero_disco').value + '"' +
                        ' "coverart:3:' + coverart_usuario + '"';

                    DOpus.Output(cmdLine);
                    cmd.RunCommand(cmdLine);
                    sayGoodBye = true;
                    break;

            }
        }
        if (sayGoodBye) break;
    }
}

==SCRIPT RESOURCES
<resources>
	<resource name="Mp3TagFile" type="dialog">
		<dialog fontsize="9" height="180" lang="esm" title="Mp3TagFile" width="332">
			<control halign="left" height="8" name="archivo_t" title="Archivo:" type="static" valign="top" width="48" x="8" y="10" />
			<control halign="left" height="12" name="archivo" readonly="yes" type="edit" width="148" x="58" y="8" />
			<control halign="left" height="8" name="titulo_t" title="Título:" type="static" valign="top" width="48" x="8" y="26" />
			<control halign="left" height="12" name="titulo" type="edit" width="148" x="58" y="25" />
			<control halign="left" height="8" name="artista_t" title="Artista:" type="static" valign="top" width="48" x="8" y="43" />
			<control halign="left" height="12" name="artista" type="edit" width="148" x="58" y="42" />
			<control halign="left" height="8" name="album_t" title="Álbum:" type="static" valign="top" width="48" x="8" y="60" />
			<control halign="left" height="12" name="album" type="edit" width="148" x="58" y="59" />
			<control halign="left" height="8" name="anio_t" title="Año:" type="static" valign="top" width="48" x="8" y="78" />
			<control halign="center" height="12" name="anio" number="yes" type="edit" updown="yes" val_min="1" width="50" x="58" y="76" />
			<control halign="left" height="8" name="pista_t" title="Pista:" type="static" valign="top" width="18" x="136" y="78" />
			<control halign="center" height="12" name="pista" number="yes" type="edit" updown="yes" val_min="1" width="30" x="157" y="76" />
			<control halign="left" height="8" name="genero_t" title="Género:" type="static" valign="top" width="48" x="8" y="94" />
			<control edit="yes" height="40" name="genero" sort="yes" type="combo" width="148" x="58" y="93">
				<contents>
					<item text="Montuno" />
					<item text="Cumbia" /> 
					<item text="Merengue" />
					<item text="Tropical" />
					<item text="Ranchera" />
					<item text="Reggae" />
					<item text="Reggaetón" />
					<item text="Hip Hop" />
					<item text="Pop" />
					<item text="Rock" />
					<item text="Tecno" />
					<item text="Electrónico" />
					<item text="Jazz" />
					<item text="Infantil" />
					<item text="Religioso" />
					<item text="Instrumental" />
					<item text="Vocal" />
					<item text="Efecto sonoro" />
					<item text="Inglés" />
					<item text="Bossa Nova" />
					<item text="Tropicália" />
					<item text="Samba" />
					<item text="Pagode" />
					<item text="Lambada" />
					<item text="MPB" />
					<item text="Forró" />
					<item text="Sertanejo" />
					<item text="Sertanejo universitário" />
					<item text="Axé" />
					<item text="Funk" />
					<item text="Gospel" />
					<item text="Brega" />
					<item text="Choro" />
					<item text="Frevo" />
					<item text="Baião" />
					<item text="Piseiro" />
					<item text="Pisadinha" />
				</contents>
			</control>
			<control halign="left" height="8" name="comentario_t" title="Comentario:" type="static" valign="top" width="48" x="8" y="111" />
			<control halign="left" height="12" name="comentario" type="edit" width="148" x="58" y="110" />
			<control halign="left" height="8" name="artista_album_t" title="Artista álbum:" type="static" valign="top" width="48" x="9" y="128" />
			<control halign="left" height="12" name="artista_album" type="edit" width="148" x="59" y="127" />
			<control halign="left" height="8" name="compositor_t" title="Compositor:" type="static" valign="top" width="48" x="8" y="145" />
			<control halign="left" height="12" name="compositor" type="edit" width="148" x="58" y="144" />
			<control halign="left" height="8" name="numero_disco_t" title="Número disco:" type="static" valign="top" width="48" x="8" y="162" />
			<control halign="left" height="12" name="numero_disco" type="edit" updown="yes" val_min="1" width="148" x="58" y="161" />
			<control halign="center" height="8" name="resolucion" type="static" valign="top" width="100" x="218" y="95" />
			<control height="122" name="caratula_t" title="Carátula" type="group" width="113" x="212" y="4" />
			<control halign="center" height="86" image="yes" name="caratula" type="static" valign="center" width="100" x="218" y="15" />
			<control height="14" name="btn_anadir_caratula" title="Añadir..." type="button" width="41" x="224" y="107" />
			<control height="14" name="btn_eliminar_caratula" title="Eliminar" type="button" width="41" x="272" y="107" />
			<control height="15" name="btn_eliminar_todo" title="Eliminar todo" type="button" width="76" x="229" y="135" />
			<control default="yes" height="15" name="btn_guardar" title="Guardar" type="button" width="76" x="229" y="155" />
		</dialog>
	</resource>
</resources>

Please, someone help me here, no matter how much I study, I don't know how to resolve this situation.

push_back is a method which you call with (...), but you're trying to assign to it.

If you do some basic javascript tutorials, this kind of mistake will become obvious to you.

Thanks @Leo for your advice, I'm going to try to plan my time better to see if I can study more, although really my only intention is to finish this script and return to my normal life, without any code.

Thanks to God and the help of all of you, I finished another script that I was very interested Resize Image

Now I'm going to study a lot about push_back, I should have done it before, but I didn't know it was a method.

I have no experience with this. I started learning Opus Scripting at the end of 2022 and browsed many scripts in forums for reference.
Here's what I know:

    dlg.Control("genero").label = item.metadata.audio.mp3genre;   // Defalut value
	for (var i = 0; i < Script.config[configName].count; i++)
	{
		dlg.Control("genero").AddItem(Script.config[configName][i]);   // Add each item to drop-down list
	}
Summary
// Mp3 Tag File
// (c) 2024 DASOTA
// Script para Directory Opus.

var configName = "genero";
function OnInit(initData) {
    initData.name = "Mp3 Tag File";
    initData.version = "1.0";
    initData.copyright = "(c) 2024 DASOTA";
    initData.desc = "Editor Mp3 Tag de archivo único";
    initData.default_enable = true;
    initData.min_version = "13.0";

// Personalizar géneros musicales

	initData.config_desc = DOpus.Create.Map();
	initData.config_desc(configName) = "Modificar géneros musicales";

     var genero_pre = DOpus.NewVector();
     genero_pre.push_back = "Romántico";
     genero_pre.push_back = "Balada";
     genero_pre.push_back = "Bolero";
     genero_pre.push_back = "Trova";
     genero_pre.push_back = "Patrio";
     genero_pre.push_back = "Son";
     genero_pre.push_back = "Salsa";
     genero_pre.push_back = "Guaracha";
     genero_pre.push_back = "Montuno";
     genero_pre.push_back = "Cumbia";
     genero_pre.push_back = "Merengue";
     genero_pre.push_back = "Tropical";
     genero_pre.push_back = "Ranchera";
     genero_pre.push_back = "Reggae";
     genero_pre.push_back = "Reggaetón";
     genero_pre.push_back = "Hip Hop";
     genero_pre.push_back = "Pop";
     genero_pre.push_back = "Rock";
     genero_pre.push_back = "Tecno";
     genero_pre.push_back = "Electrónico";
     genero_pre.push_back = "Jazz";
     genero_pre.push_back = "Infantil";
     genero_pre.push_back = "Religioso";
     genero_pre.push_back = "Instrumental";
     genero_pre.push_back = "Vocal";
     genero_pre.push_back = "Efecto sonoro";
     genero_pre.push_back = "Inglés";
     genero_pre.push_back = "Bossa Nova";
     genero_pre.push_back = "Tropicália";
     genero_pre.push_back = "Samba";
     genero_pre.push_back = "Pagode";
     genero_pre.push_back = "Lambada";
     genero_pre.push_back = "MPB";
     genero_pre.push_back = "Forró";
     genero_pre.push_back = "Sertanejo";
     genero_pre.push_back = "Sertanejo universitário";
     genero_pre.push_back = "Axé";
     genero_pre.push_back = "Funk";
     genero_pre.push_back = "Gospel";
     genero_pre.push_back = "Brega";
     genero_pre.push_back = "Choro";
     genero_pre.push_back = "Frevo";
     genero_pre.push_back = "Baião";
     genero_pre.push_back = "Piseiro";
     genero_pre.push_back = "Pisadinha";

	initData.config[configName] = genero_pre;
}

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand();
    cmd.name = "Mp3TagFile";
    cmd.method = "OnMp3TagFile";
    cmd.desc = "";
    cmd.label = "Mp3 Tag File";
    cmd.template = "Mp3TagFile";
    cmd.hide = false;
    cmd.icon = "script";
}

function OnMp3TagFile(scriptCmdData) {
    var dlg = scriptCmdData.func.Dlg();
    dlg.title = "Mp3 Tag File - Directory Opus";
    dlg.template = 'Mp3TagFile';
    dlg.detach = true;
    dlg.Create

    var tab = scriptCmdData.func.sourcetab;
    var item = tab.selected_files(0);

    dlg.Control("archivo").value = item.name_stem;
    dlg.Control("titulo").value = item.metadata.audio.mp3title;
    dlg.Control("artista").value = item.metadata.audio.mp3artist;
    dlg.Control("album").value = item.metadata.audio.mp3album;
    dlg.Control("anio").value = item.metadata.audio.mp3year;
    dlg.Control("pista").value = item.metadata.audio.mp3track;
    dlg.Control("genero").label = item.metadata.audio.mp3genre;   // Defalut value
	for (var i = 0; i < Script.config[configName].count; i++)
	{
		dlg.Control("genero").AddItem(Script.config[configName][i]);   // Add each item to drop-down list
	}
    dlg.Control("comentario").value = item.metadata.audio.mp3comment;
    dlg.Control("artista_album").value = item.metadata.audio.mp3albumartist;
    dlg.Control("compositor").value = item.metadata.audio.composers;
    dlg.Control("numero_disco").value = item.metadata.audio.mp3disc;

    if (item.metadata.audio.coverart > 0) {
        var tmpFile = DOpus.FSUtil().GetTempFile();
        tmpFile.Write(item.metadata.audio.coverart(0).data);
        tmpFile.Close();
        dlg.Control("caratula").label = Script.LoadImage(tmpFile);
    } else {
        dlg.Control("caratula").label = '';
    }

    dlg.Control("caratula").bg = "#FFFFFF";

    if (item.metadata.audio.coverart > 0) {
        var tmpFile = DOpus.FSUtil().GetTempFile();
        tmpFile.Write(item.metadata.audio.coverart(0).data);
        tmpFile.Close();
        var reso = item.metadata.audio.coverart(0);
        dlg.Control("resolucion").label = reso.width + " x " + reso.height + " x " + reso.depth + " (" + reso.size.fmt + ")";
    } else {
        dlg.Control("resolucion").label = '';
    }

    dlg.Control("resolucion").fg = "#000000";
    dlg.Control("resolucion").bg = "#FFFFFF";

    dlg.Show

    while (true) {
        msg = dlg.GetMsg();
        if (!msg.result) break;

        var sayGoodBye = false;

        var cmd = scriptCmdData.func.command;
        var coverart_usuario;


        if (msg.event == "click") {
            switch (msg.control) {

                case "btn_anadir_caratula":
                    coverart_usuario = dlg.open("Carátula");
                    dlg.Control("caratula").label = Script.LoadImage(coverart_usuario);
                    break;

                case "btn_eliminar_caratula":
                    dlg.Control("caratula").label = '';
                    dlg.Control("resolucion").label = '';
                    break;

                case "btn_eliminar_todo":
                    dlg.Control("titulo").value = '';
                    dlg.Control("artista").value = '';
                    dlg.Control("album").value = '';
                    dlg.Control("anio").value = '';
                    dlg.Control("pista").value = '';
                    dlg.Control("genero").label = '';
                    dlg.Control("comentario").value = '';
                    dlg.Control("artista_album").value = '';
                    dlg.Control("compositor").value = '';
                    dlg.Control("numero_disco").value = '';
                    dlg.Control("caratula").label = '';
                    dlg.Control("resolucion").label = '';
                    break;

                case "btn_guardar":
                    var cmdLine = 'SetAttr META' +
                        ' "title:' + dlg.Control('titulo').value + '"' +
                        ' "artist:' + dlg.Control('artista').value + '"' +
                        ' "album:' + dlg.Control('album').value + '"' +
                        ' "year:' + dlg.Control('anio').value + '"' +
                        ' "track:' + dlg.Control('pista').value + '"' +
                        ' "genre:' + dlg.Control('genero').value.name + '"' +
                        ' "comment:' + dlg.Control('comentario').value + '"' +
                        ' "albumartist:' + dlg.Control('artista_album').value + '"' +
                        ' "composers:' + dlg.Control('compositor').value + '"' +
                        ' "discnumber:' + dlg.Control('numero_disco').value + '"' +
                        ' "coverart:3:' + coverart_usuario + '"';

                    DOpus.Output(cmdLine);
                    cmd.RunCommand(cmdLine);
                    sayGoodBye = true;
                    break;

            }
        }
        if (sayGoodBye) break;
    }
}

==SCRIPT RESOURCES
<resources>
	<resource name="Mp3TagFile" type="dialog">
		<dialog fontsize="9" height="180" lang="esm" title="Mp3TagFile" width="332">
			<control halign="left" height="8" name="archivo_t" title="Archivo:" type="static" valign="top" width="48" x="8" y="10" />
			<control halign="left" height="12" name="archivo" readonly="yes" type="edit" width="148" x="58" y="8" />
			<control halign="left" height="8" name="titulo_t" title="Título:" type="static" valign="top" width="48" x="8" y="26" />
			<control halign="left" height="12" name="titulo" type="edit" width="148" x="58" y="25" />
			<control halign="left" height="8" name="artista_t" title="Artista:" type="static" valign="top" width="48" x="8" y="43" />
			<control halign="left" height="12" name="artista" type="edit" width="148" x="58" y="42" />
			<control halign="left" height="8" name="album_t" title="Álbum:" type="static" valign="top" width="48" x="8" y="60" />
			<control halign="left" height="12" name="album" type="edit" width="148" x="58" y="59" />
			<control halign="left" height="8" name="anio_t" title="Año:" type="static" valign="top" width="48" x="8" y="78" />
			<control halign="center" height="12" name="anio" number="yes" type="edit" updown="yes" val_min="1" width="50" x="58" y="76" />
			<control halign="left" height="8" name="pista_t" title="Pista:" type="static" valign="top" width="18" x="136" y="78" />
			<control halign="center" height="12" name="pista" number="yes" type="edit" updown="yes" val_min="1" width="30" x="157" y="76" />
			<control halign="left" height="8" name="genero_t" title="Género:" type="static" valign="top" width="48" x="8" y="94" />
			<control edit="yes" height="40" name="genero" sort="yes" type="combo" width="148" x="58" y="93" />
			<control halign="left" height="8" name="comentario_t" title="Comentario:" type="static" valign="top" width="48" x="8" y="111" />
			<control halign="left" height="12" name="comentario" type="edit" width="148" x="58" y="110" />
			<control halign="left" height="8" name="artista_album_t" title="Artista álbum:" type="static" valign="top" width="48" x="9" y="128" />
			<control halign="left" height="12" name="artista_album" type="edit" width="148" x="59" y="127" />
			<control halign="left" height="8" name="compositor_t" title="Compositor:" type="static" valign="top" width="48" x="8" y="145" />
			<control halign="left" height="12" name="compositor" type="edit" width="148" x="58" y="144" />
			<control halign="left" height="8" name="numero_disco_t" title="Número disco:" type="static" valign="top" width="48" x="8" y="162" />
			<control halign="left" height="12" name="numero_disco" type="edit" updown="yes" val_min="1" width="148" x="58" y="161" />
			<control halign="center" height="8" name="resolucion" type="static" valign="top" width="100" x="218" y="95" />
			<control height="122" name="caratula_t" title="Carátula" type="group" width="113" x="212" y="4" />
			<control halign="center" height="86" image="yes" name="caratula" type="static" valign="center" width="100" x="218" y="15" />
			<control height="14" name="btn_anadir_caratula" title="Añadir..." type="button" width="41" x="224" y="107" />
			<control height="14" name="btn_eliminar_caratula" title="Eliminar" type="button" width="41" x="272" y="107" />
			<control height="15" name="btn_eliminar_todo" title="Eliminar todo" type="button" width="76" x="229" y="135" />
			<control default="yes" height="15" name="btn_guardar" title="Guardar" type="button" width="76" x="229" y="155" />
		</dialog>
	</resource>
</resources>

1 Like

Perfect :pray: Perfect :clap: Perfect :star_struck:

I had three nights practically without sleep, studying the subject, inventing a thousand different things, but nothing resembles your solution, I really would never have solved this.

I thank you from the bottom of my heart, I will soon update the script, now it will be better, each person will be able to customize their list of genres, THANK YOU A THOUSAND TIMES. :smiling_face_with_three_hearts:

1 Like

Please let me know when you update the script.