Problems with simple search replace in clipboard macro

I must be missing something basic. thank you very much

Search Replace in Clipboard with User Input.kmmacros (21.1 KB)

Because you don’t provide examples of how your macro is misbehaving it’s hard to give sensible advice. For example, examples of the clipboard content before/after and the search/replace strings that demonstrate the problem.

In the meantime, you might want to look at this thread which might provide some insight:

2 Likes

you are right and I apologize. I forgot to mention that the outcome is that %Variable%post_Replace_String% (literally) is pasted. I will look at your link. thank you very much

That might indicate that “process tokens” is not set in the action’s gear menu…

1 Like

I went through all the gear menus and don't see anything like process tokens.
thank you

It was just a shot in the dark since I don’t have a Mac to check stuff out on at the moment.

1 Like

I suspect that the text "%Variable%post_Replace_String%" was already stored in the System Clipboard before you ran the Macro to test it. I notice that your Macro itself does not initially set the Clipboard to anything (so, whatever you last copied will be the text that is searched).

I'm guessing you want to select some text, run the Macro and replace the selected text with the result? In which case you need to add a Copy Action to the start of the Macro.

A couple of other suggestions -

Maybe name the Variables so they display nicer in the Prompt by using double underscores. By naming the Variables as "instructions" it avoids having to have other instructions in the Prompt.

As you are using Global Variables, maybe use them in the default enter fields so, the Macro remembers your last search and starts with that. Or, if that is not wanted, use Local Variables.

Something like this (for Global Variables). On the first run the fields will be blank, but next time the Macro is run it will start off with the fields pre-filled with your last search and replace.

Search Replace in Clipboard with User Input - Global Variables.kmmacros (4.1 KB)

Click to Show Image of Macro

Or this (for Local Variables). On each run the search and replace fields will be blank.

Search Replace in Clipboard with User Input - Local Variables.kmmacros (4.0 KB)

Click to Show Image of Macro

2 Likes

you are right (obviously). I can't have it both ways. If I select text must copy it first. thank you very much

1 Like