As for where you went wrong with your current macro, I’ll let one of the far more knowledgeable and experienced posters handle why you’re getting “%tags%tags%” in the variable name (though I suspect that it’s because that’s the current contents of %Variable%nom%, though for what reasons I couldn’t say from here) but I can tell you that you’re effectively erasing the file name from the clipboard after copying it by setting the clipboard to your Nom variable after the copy operation, essentially undo-ing the copy before it can be of use. I suspect what you wanted to do was save the file name to a variable after it had been copied, and you most likely overlooked adding the “Set Clipboard to Variable” action, and ended up going straight to using the variable before setting it to the content (i.e. the copied file name) that you wanted.
At any rate, please do take a look at that other thread, as it really solves your problem in a much more elegant way and will hopefully give you an idea of what KM can do with native actions.
Thank you very much gglick I have had a look at this topic. Maybe It will give me some track to solve my problem.
Please note that the “prompt user” action is to test. When I didn’t use it I have my folder named %tags%tags% as well.
Maybe I should have written in my request for help that the idea is also to copy tags associated with the selected file. So I have to (at least I think I have to) copy two data: filename and tags name before pasting or typing those info respectively in the “edit name mode” of the Finder and then in the “read folder infos” panel.
If I don’t manage to apply the solution proposed in the other thread or if doesn’t suit my needs, I thought that I could use the Finder’s cmd right arrow and arrow down keyboard shortcuts to select alternatively the folder or the file and do the copy paste process in two steps allowing to deal only with the clipboard without variables.
@JMichaelTX has already answered where your problem is.
A couple notes.
Since variables are just text, the Set Clipboard to Variable is a pseudo action that is handled by the Set Clipboard to Text action using the Variable token to get the value of the variable. This is typical of Keyboard Maestro, where I try to use simple building blocks that you can stack together in a variety of ways.
But as @JMichaelTX notes, the problem is that you are setting the clipboard, not the variable.
So you are using Set Clipboard to (Variable or Text), when really what you want to be doing is using the Set Variable to Text action with the CurrentClipboard token. The latter token returns the text that is on the clipboard.
I think I get it. It works now.
Maybe the verb “to set… to” lead me to confusion. For a non English speaker, “To set” is very imprecise. It’s not so obvious to understand in which direction the transfert is done. Set A to B = Fill A with B, but for me it was: Copy (the content of) A to B. Do you see what I mean ?