I've been getting frustrated with the Search function in the KBM Editor. It seems that if I includes spaces in the search string, then it treats the space as a delimiter of multiple terms and I get results that have the individual terms anywhere in the macro.
I've tried surrounding the string with quotes, and then it only finds instances where the first term is preceded by a quote and the last term is followed by a quote (usually nothing). I've tried puting backslashes before the spaces and then, similarly, nothing is matched.
How can I match a literal space in a search string in the Editor? Now I'm especially looking for variable names that have spaces, but the problems has shown up when looking for a phrase in Comments or commands in AppleScript too.
For example, this window shows that I have a permanent variable called "
Alert Button" in my system. I'd like to convert that to a Local variable before deleting this unnecessary Global variable. But I cannot find where that variable is used.
When I search for that name, I get five results:
Looking into them, none of the "found" macros uses that variable. So I can delete it and there's nothing to have to "localize". The one active macro consists simply of an Execute AppleScript action that sets no variables.
However, very oddly, the inactive macros from the Checkpoint system that have been "found" don't have any actions highlighted as containing the search string, the Search system is finding the macros but not identifying any actions within them. Could that be related to the search string having a space in it? That's a wild guess, but it's a weird symptom.
Thanks! I had no idea that all those options were available. I'll do some digging ...
Hi, @August. I've shared a macro, Search All Macros, that you might find helpful. It's available here: Keyboard Maestro Editor Megathread
I'm not sure what I'm doing wrong, but your macro isn't helping.
I was looking for a macro where I had an AppleScript script with a line commented out:
-- activate DeskSpaceID
In the KBM Editor, I select All Macros. When I run your macro and enter "
-- activate DeskSpaceID", it gets entered at the upper right with quotes around it. That's exactly what I had tried previously.
In both cases the result is every macro. How in the world does every macro match that search string? It even matches placeholder macros I've created that are completely empty except for the name. In one case the name is simply "
M========" and in another the name is simply "
A=)". How does either of those macros get matched by the search string?
If you look at the Search Strings [Keyboard Maestro Wiki] page you'll see this:
You can use a negative sign (-) to negate any match (for example, “-name:PDF”).
I don't see a way to escape the
You could enter your comments like this:
--# activate DeskSpaceID
And the search for
"# activate DeskSpaceID"
Foo. Of course. I might have had a clue from the fact that it matched everything.
That's too bad. I'm pretty sure the line I'm trying to find is indented, so maybe searching for "
--" could be made to work.
If I could find the code to change the comment format, I could find the code, so that's not solving the immediate problem of finding something I've lost track of.
[Update] I finally found the code snippet that I was looking for and have copied it in a couple of places to help ensure that I can find it again.