How to Delete Local Variables From the “Edit > Insert Variable” List

I saw another thread talking about how local variables show up in the list of variables, and I get both sides of the argument (1 side is that they should only show up in the macro using them while the other side says we may want to use the same name in different macros). But, what I'm trying to do is to clear out the list, i.e. delete, the local variables. For global variables I know I can set the value of the variable to %Delete%. This doesn't work for local variables.

In the 1st screenshot you'll see I searched for it in all macros for local_Bill_Month and it only comes up once - so it isn't a case of me using the same name in more than one location. In the 2nd screenshot you'll see the action to delete that variable, which I ran from the macro that contained it. But, as you see in the 3rd screenshot the variable is still there.

This seems to be related to the issue I mentioned at the start: i.e. having local variables show up everywhere in the list of variables. I'm guessing that since local variables "delete" themselves once the macro runs, I get why explicitly deleting them wouldn't help. If that is the case, then I would vote on the side of us having a toggle to show, or not, local variables in the list of variables outside of the macro(s) containing them. If that is not the cause of this, then how do I delete a local variable so it doesn't come up in any of the variable lists or elsewhere?

Search for "local_Bill_Month" shows it is only in 1 macro, AA Check - Get All Bills

Inside AA Check - Get All Bills is the action to delete that variable (which I "tried")

Here it is, still in the variable list, along with all the other local variables I can't figure out how to delete:

Screen Shot 2022-03-19 at 4.46.18 PM

To delete the names of Local Variables from that Edit>Insert Variable list, delete all uses of that Local Variable name from all your Macros. Then quit and restart the Keyboard Maestro Editor.

Once there are no Macros using that local Variable name it will no longer appear in the list.

Edit>Insert Variable is only a convenient list of Variable names you have used. It can seem cluttered (which is why it's best to just not worry about it too much and why I never use it). The fact that setting a persistent Variable's contents to %Delete% also removes its name from that list has been the cause of lots of confusion (for me as well). It implies that the list is a list of active Variables with remembered data, when it is just a list of used Variable names for convenient reuse.

1 Like