I need to find and replace strings in several .xhtml files. Usually I do this manually in Sublime text editor, but I'm trying to find a way to automate the process. Is there a way to create a macro that will prompt me for the original string and the replacement string and then find & replace each instance? Would I open each file in Sublime, or is there another way to do it?
I don’t use Sublime Text, but I think it has a way of treating a collection of files as a “project,” and once you’ve done that you can do the search-and-replace across the entire project instead of one file at a time.
Yes that's exactly what I do manually (great feature). I'm just trying to figure out if there's a way to automate that process with KM. I'm struggling with how to enter the original string and replacement string within Sublime using KM.
I confess I'm having trouble understanding how entering two strings in Keyboard Maestro could be much more efficient than entering those same two strings in Sublime. Are there other aspects (clicking radio buttons or checkboxes) of doing the search/replace in Sublime that are slowing you down? If so, you probably can automate those aspects of the process by having Keyboard Maestro tab through the controls and activate the ones you need.
This bit can be tricky -- when you are using a KM prompt to set a variable to make a regex to paste into an app you get some funky text processing flows. See this post from @peternlewis for a better explanation than I could ever manage!
Given that, and the fact you'll be filling in a dialog whatever you do, I'd echo @drdrang and start by automating everything but search/replace string insertion. You could then deep-dive into @peternlewis's token processing explanation if you found you wanted to take things further.