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.