Set tag from another one

Hello,
I want to copy the artist tag to the album tag, from the same mp3 file.
Can you help me, please ?

Thanks in advance...

Option Explicit
Function OnClick(ByRef clickData)
	Dim selItem, Artiste
	If clickData.func.sourcetab.selected.count > 0 Then
		For Each selItem In clickData.func.sourcetab.selected
			If selItem.metadata = "audio" Then
				Artiste = selItem.Metadata.audio.mp3artist
				ClickData.Func.command.RunCommand "SetAttr """ & selItem.name & """ META ""album:" & Artiste & """"
			End If
		Next
	End If
End Function

Thanks for your help AlbatorV (ça fait plaisir de voir un compatriote aussi investi... et compétent ! :slight_smile: ).
May be I made something wrong, but it didn't work (nothing happened).
Any idea, please ?

Edit : The problem is the part with selItem.metadata = "audio".
I removed it and now it works fine... Still investigating to add this security !

What kind of file are you testing with? (e.g. mp3)

Yes, it is an mp3 file.
In fact it's my configuration the problem : If I make a "msgbox selItem.metadata", the answer is "video" !
How did it happen ?? mystery !

the type of file that selitem.metada returns : Is it a windows parameter, or a DO parameter ??

Edit : In DO File Type Groups, in "Vidéos", no mp3 extension stored, but in the "Musiques" group yes, as expected... Still investigating...

Is it really an MP3 file? It might be a video format file with the wrong extension on the name, perhaps.

I tried with some MP3 files and got audio as the main metadata type for all of them:

Turning on the Description column in the file display is also worth a try. It will report the file's internal format. (Should be MPEG-1 Audio Layer 3 version 1.0 or similar for an MP3 file.)

The description reports me that my mp3's audio codec are MPEG-1 Audio Layer 3 version 1.0, while selitem.metada returns "video" !
It's probably more a windows problem than DO but if you have an idea I will be very grateful for your help...

Could you zip one of the audio files and send it to me via private message?

Hi @Leo , did you receive my zip, and did you have time to investigate ?
I have spent more time on my problem, found nothing... and today everything seems ok, my mp3 are "audio" back !!! I did nothing to fix the problem... One more computer mystery !
So now the script works perfectly, thanks again AlbatorV.
I'm sorry for the inconvenience...

Edit :
I just added clickData.func.command.deselect = false to keep my files selected...