In folder, I have mp3 and jpg…
I want to easily add coverart to mp3.
Now, I copy jpg to clipboard, select mp3 and click Paste button in metapane.
I want to do the same thing with button or hotkey but command like "SetAttr META coverart:+clipboard" is missing.
Also if I copy more than one jpg, only the 1st is paste in mp3.
So I imagine 2 solutions…
Option 1
I copy jpg (1 or more) to clipboard.
I select some mp3 file and paste (button or hotkey) all jpg from clipboard to selection.
Option 2
I select jpg (1 or more) and some mp3 then paste (button or hotkey) all jpg to selection.
Do you need any additional assistence Albator? I could explain some details from the ClipboardEx add-in, it features a TextMagic prototype/object and some ready-to-use methods to get validated and sanitized content from clipboard.
With TextMagic it's only two lines of code to get all valid paths contained in the text-clipboard e.g:
var doItems = TextMagic.TextToDOItems( DOpus.GetClip("text") );
DOpus.Output("First file in text-clip: " + doItems[0].realpath);
It's ok, I create a new command.
Look if you see something wrong...
But I think create a new one, I'd rather to not use clipboard. Commande_AddJpgFromClipboard.vbs.txt (2.67 KB)
If you don't specify a FILE argument for the SetAttr command, it will run on all the files given to the command. Outside of a script, that means all the selected files. Inside a script, it is whichever files have been added to the Command object you are using. (funcData.Func.Command will have the selected files added to it by default, but you can change that using the appropriate methods on the Command object).
So you probably want to remove any non-mp3 files from the command object. I'm not sure if that is the only thing wrong, although I can't see anything obviously wrong from a quick look at the code.
What does the script output at the moment when you run it? Do the commands it runs look correct?
Oh, you might need to turn ImageFile into a full path, not just a filename, although I am not certain of that.
Yes, "Setattr *.mp3 META coverart:...", but in manual for FILE argument :
If you only specify the filename instead of the full path of the file or files, Opus will look in the current source folder.
So I need to have full path of each selected mp3 files.
If you tell it to do *.mp3 it will do *.mp3 in the current folder.
What I suggested above is that you add/remove whichever files you want from the Command object, then run SetAttr without any FILE argument at all, and it will act on the files attached to the command object. Look at the Command object methods like AddFile, RemoveFile, ClearFiles.