Rename item from current action gear menu (KM to automate KM)

I’m creating a lot of Macros by copying existing ones. I’ve discovered that emptying an Action’s name field in the currently selected action of the current Macro allows it to take the name of the customizable part. For example if the current action is an “Activate specific application” action used to activate TextEdit, and I’ve copied it to create an activation macro for BBEdit, after I select BBEdit next to Activate, if I clear the name field containing Activate TextEdit by choosing Rename from the contextual or gear menu, and pressing delete, then exit the name editing field, the name will then contain “Activate BBEdit”.
I’d like to automate that process, so how can I make a KM macro to select the Rename item from the gear menu the the currently selected action while editing the macro? Thanks.

Turns out I already have a set of macros that to just that, and more.
Please check them out, and let us know if they meet your need.

###Macro Set: ReName Action (3 macros)

OK, I’m working on adapting the auto-set macro of the three. I have a pretty general question. How can I manipulate the debug window when the macro I’m troubleshooting requires the cursor to be elsewhere?

In the meantime, I used some “wait” actions to troubleshoot. I created an auto-set instance (case) for the Activate action that removes the current name of the activate action (remember, I’m copying and applying changes), replaces it with the default name (Activate followed by a space then the name of the app being activated), removes the “Activate” followed by a space at the beginning of the default name, then copies the remaining text in the name field of the Activate action for pasting into the Macro’s name field or elsewhere.

If you create an Activate a Specific Application action and then configure it the BBEdit, then its name will show as Activate BBEdit. If you duplicate that action and then change the application to TextEdit, the name of the action will change.

So there should be no need to Select Rename from the gear menu and clear the name unless you have explicitly named the action in the first place.

So I am a little confused as to how you are getting to the point of needing to do this regularly…?

If I copy another macro that already has an action, the action retains its name. Also, I don’t want "Activate " in the name of the action for “Activate”, so it has already been renamed before I copy it, therefore it doesn’t accept a default name when I change the Activate target. Just a personal preference.

OK, yes, if you have already renamed the action, then it will not change the name dynamically.