Find and Edit Multiple Actions Used in Macros

Hello!

I have an action which is used several times in one macro / several macros.
The goal is to edit the action so all other same actions are edited also instead of copying and pasting.

For example i have 10 same "move and double click actions with same conditions" i'd like to edit coordinates / found image condition / window title

Is there a solution for this?

1 Like

Yes, but not in the way you’re currently thinking. The current best answer to this kind of problem is to make the key action a sub-routine that the other macros can run. Essentially, you’ll want to make a new macro that only contains the action you’re currently using across 10 macros, then replace that action in the other macros with an Execute a Macro action that executes the new macro. This way, you can just edit the sub-routine macro, and that change will be reflected when all the other macros run it.

1 Like

That’s smart!

1 Like

How to edit multiple macros at the same time?

I have same problem for now.

I am currently playing with a software, for example, called ABC, and I have more than 50 macros to manipulate this software.

All these macros contain the same action – activate software ABC.

Now the software has been updated to new version, called ABC Pro.

All actions - activate software ABC cannot work correctly – the action in each macro needs to be edited to - activate software ABC Pro.

Do I have to do this 50 times manually?

In the above answer, use subroutine, But does this mean I need to apply the new subroutine into all 50 macros one by one by hand?

This way doesn't change much.

Yes.

Keyboard Maestro has no built-in facility to edit multiple macros at once.

It is possible to do this kind of thing with AppleScript, but that takes a good deal of specialized knowledge.

1 Like

Well, while you’re doing all those edits why not future-proof yourself so as to avoid having to do them again when the next change happens?

How do you do that? The clue to the answer is given in the KM wiki page for the Activate a Specific Application action here: action:Activate a Specific Application [Keyboard Maestro Wiki] - see the section on activating app by variable.

By replacing that action with one for the third party plugin Activate an Application by Name to be found here:

The advantage of this plugin is that you can use a variable containing the name of the application you want to activate so all you do is set up a global variable with the application name and then use that variable in the plugin. So when the application changes from ABC to DEF all you need do is change the contents of the variable from ABC to DEF and you’re done!

Here's an example:
image

3 Likes

Subroutine is a good method. Easier than using AS, XML & variable token.
But you need to put subroutine into these many macros one by one.
Nothing changed. You still need to do this one by one.
And it's hard to know what do you want in the future. Since KM is so useful.
The number of macros of a theme increases rapidly.
I ever did this kind of thing to more than 100 macros one by one.
Iooks like there is no easy way.
I'll keep studying in practical.

Live and learn...

This kind of painful lesson gives you the incentive to look for and employ more efficient and effective solutions.

Believe me – I've experienced many growing pains over the nearly 20 years I've used Keyboard Maestro.

1 Like