Option Explicit Function OnInit(initData) initData.name = "Commande_AddCoverartFromSelection" initData.desc = "Ajoute les fichiers image de la sélection comme pochette d'un mp3." initData.min_version = "11.12" initData.copyright = "2015 Albator V (Michiels Thomas)" initData.version = "v1.0" initData.default_enable = true initData.config.EffacerJournal = false initData.config.InscriptionJournal = false initData.config_desc = Dopus.Create.Map("EffacerJournal", "Effacer le journal au lancement de la commande.", _ "InscriptionJournal", "Afficher les messages dans le journal.") End Function Function OnAddCommands(addCmdData) Dim cmd: Set cmd = addCmdData.AddCommand() cmd.name = "AddCoverartFromSelection" cmd.method = "OnAddCoverartFromSelection" cmd.desc = "Ajoute les fichiers image de la sélection comme pochette d'un mp3" cmd.label = "AddCoverartFromSelection" cmd.icon = "imageshack" cmd.template = "DESELECT/S" End Function Function OnAddCoverartFromSelection(funcData) Dim fileSelection Dim ImageFile Dim strSelArrayJpg ' Clear log If script.config.EffacerJournal = True Then Dopus.clearOutput ' Find image in selection Set fileSelection = funcData.func.sourcetab.selected strSelArrayJpg = Empty For Each ImageFile In fileSelection If (Not ImageFile.is_dir) Then If Right(ImageFile,3) = "jpg" then If IsEmpty(strSelArrayJpg) Then ReDim strSelArrayJpg(0) Else ReDim Preserve strSelArrayJpg(UBound(strSelArrayJpg)+1) End If strSelArrayJpg(UBound(strSelArrayJpg)) = ImageFile ' If script.config.InscriptionJournal = True Then Dopus.OutputString ImageFile End if End If Next ' Add image to selection If IsEmpty(strSelArrayJpg) Then If script.config.InscriptionJournal = True Then DOpus.OutputString "Alerte: Aucun fichier image dans la sélection." Else If script.config.InscriptionJournal = True Then Dopus.OutputString "Information: " & UBound(strSelArrayJpg)+1 & " fichier(s) image à ajouter." For each ImageFile in strSelArrayJpg If script.config.InscriptionJournal = True Then Dopus.OutputString "Fichier image de la sélection: " & ImageFile If script.config.InscriptionJournal = True Then Dopus.OutputString "Commande envoyée: " & "SetAttr META ""coverart:+3:" & ImageFile & """" ' -------- If file is mp3 then... funcData.Func.Command.RunCommand "SetAttr META ""coverart:+3:" & ImageFile & """" ' -------- End If Next End If ' Look if argument exists If funcData.func.args.got_arg.deselect = 1 Then funcData.func.command.RunCommand("Select NONE") End Function