How to copy mp3artist name into mp3albumartist

I want to create a button for
copy mp3artists
paste into mp3albumartist
Can anyone help me with this code
This code create a
Metadata parsing error

function OnClick(clickData) {
	clickData.func.command.deselect = false;
	for (var enumSelected = new Enumerator(clickData.func.sourcetab.selected_files);!enumSelected.atEnd();enumSelected.moveNext()) {
		clickData.func.command.RunCommand('SetAttr "'+enumSelected.item()+'" META "mp3albumartist:'+enumSelected.item().metadata.audio.mp3artists+'"');
	}
}

Change clickData.func.command.RunCommand to DOpus.Output and then look at the script log to see the list of commands your code is generating.

Do the generated commands look correct for all your files?

Do the generated commands work if you run them on their own, outside of the script?

1 Like

The keyword is spelled mp3artist.

1 Like

Ok now I spelled mp3artist .
Changed clickData.func.command.RunCommand to DOpus.Output

function OnClick(clickData) {
	clickData.func.command.deselect = false;
	for (var enumSelected = new Enumerator(clickData.func.sourcetab.selected_files);!enumSelected.atEnd();enumSelected.moveNext()) {
		DOpus.Output('SetAttr "'+enumSelected.item()+'" META "mp3albumartist:'+enumSelected.item().metadata.audio.mp3artist+'"');
	}
}

and the script log is here

Use albumartist instead of mp3albumartist.

One of the small differences between Keywords for Columns and Keywords for SetAttr META.

1 Like

Thank you so much for your great help.
This is the final jscript code can copy Artist name to Albumartist

function OnClick(clickData) {
	clickData.func.command.deselect = false;
	for (var enumSelected = new Enumerator(clickData.func.sourcetab.selected_files);!enumSelected.atEnd();enumSelected.moveNext()) {
		clickData.func.command.RunCommand('SetAttr "'+enumSelected.item()+'" META "albumartist:'+enumSelected.item().metadata.audio.mp3artist+'"');
	}
}

2 Likes