Can I 'Search and Replace text' from the whole file based on initial selection

Is there someone who can help me with a Macro that would Search and Replace text from the whole file based on initial selection before triggering the Macro
For e.g. If I have a document open and I select a string of text like I select a word 'originalWord’
and then trigger the macro then I would get a pop-up asking for replacement text and it would search and replace from the whole file

I am new to maestro. I would appreciate all the help. Thanks

If you look in the KM Editor Help menu you will see links to several KM documents that will help you get started, and answer questions.

In particular, try searching for “search and replace” in the
Keyboard Maestro Wiki

Also, this forum is a very valuable resource, but you have to know how to search it. You need to use a Google site-specific search, like this search and replace

Give that search a try, and I think you’ll find a number of examples to get you started. Once you have a macro built, if it is not doing what you want/expect, post the macro here for specific help.

Hey Kapil,

Please provide more information.

You want to do this in a specific app – or any app?

You're working in plain text or styled text?

Here's the general idea.


Find and Replace Selected Word in Clipboard.kmmacros (4.2 KB)


Hi, I am working with Atom reader and Sublime text. And the text is mostly xml

This has actually done the trick for me my friend. Thank you so much.

1 Like