Search & Replace in a Macro yet?

I have a variable that keeps vanishing, I think I have two macros triggering close together and the first deletes a variable that the second uses (same name).

I saw a request for this some time ago so wondered if any progress has been made?

So two questions.

1 - Can variables be local to a Macro rather than global?

2 - Is there any way to do a search/replace within a macro? I know I can search but being able to replace too would be very handy, then I could search for the variable within the macro and replace it with another.

Cheers.

Mark.

PS: Oh and a third question!

3 - Can I search for a specific item, so if I enter 'myDate' it lists all instances of myDate, but also myDateX, myDateY etc etc

Can I limit it to JUST myDate?

One suggested solution?

1 Like

Yes. See Variables user manual section, Local and Instance variables.

No. Technically, it is possible in some instances to copy the macro to XML, Search&Replace in the XML, then import it back in. But basically, no.

Unfortunately, no, there is no “word” search.

Excellent news on the variables, not sure how I missed that!

Can I add a suggestion for a word search and a text-view/search/replace mode?

v9 is excellent so far.

Noted. The former might happen, but I'd have to figure out a syntax for it. The latter would be quite difficult, I wouldn't expect that any time soon.

I'm creating a smart group, the idea is to show enabled macros, not modified before a given time/date so that I can then go through each one, change variables and then when I save it it is no longer in the list.

Is that possible? I don't think I can specify an absolute value for mod: etc, just an offset?

so I want '-mod:2019/08/14' or something like that, if I used the 1d then it would keep moving which isn't what I want.

I can't see any other way, in the Finder I would use a temporary label/tag, or create a dummy group and add/remove from there but I don't think a macro can be in two groups other than the smart groups?

Update: found a workaround, in the macro I add a comment 'VariablesUpdated' and then in the smart group '-VariablesUpdated'.

If you just opened it in a text view, showing the bare xml, then you could enable a replace feature within find that is only active in that view. then you are just doing a plain text search/replace.

Due to this behaviour I have developed some workarounds. One workaround is to avoid using common words, especially words used in KM actions, as variable names. So for example instead of using the word "mouse" when creating a routine that works with the mouse, I use the word "cat" instead. This approach solves most of my problems. This way I can search for "cat" or "mouse" and get the narrow results I want. (Mnemonic: it's a cat and mouse game.)

Unfortunately, no, the mod Search String only handles relative times.

Peter - Plus one vote here on word search within a macro. I have several macros that are essentially very long lists of search & replace actions that impose my preferred writing/notation style on blocks of text.

I literally get a transient sick feeling every time I need to edit one of them slightly!

p.s. KM is WONDERFUL!

1 Like