How to effectively type the var value and not "%Variable%Vname%"

Hi.
Once again, I am really sorry to ask such a dumb question. Here is my Macro to use in the Finder:

Then the “Prompt for user input” action displays:

That’s ridiculous. :frowning:

What did I do wrong ?

Please note that the “Set Clipboard to Variable” action is named as “Set Clipboard to text” by KM. It sounds weird. No ?

Thank you.

KM Version 7.3.1

My purpose is to:
Copy the name of a file in the Finder
Create a new folder including this file (ctrl cmd N)
Name the folder with the file’s name

Hi irep,

As luck would have it, this particular problem of yours has already been solved neatly. You can find the solution, complete with example macro to download, here:

New folder according to current Finder-selected file, then move file inside?

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.

One key issue is that I don't see that you have set the value of KM Variable "nom" anywhere.

I suspect an error in this:

The last Action should probably be:

The post linked above by @gglick is probably a good solution, or at least a good example you can follow.

1 Like

@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.

Thank you gentlemen.

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 ? :slight_smile: