KM 10 - Easy Global Variable Clean-Up

@cdthomer and @ccstone:

It just dawned on me that using %AccessedVariables% to delete "unwanted" variables might be a horrible idea, at least until @peternlewis changes something.

This may not explain @cdthomer's situation, but it's important anyway.

I'm gonna start off talking about a Custom HTML Prompt, but stick with me here, because I think this may extend beyond just the prompt.

A week or two ago, I discovered that if I ran my Variable Inspector Prompt (custom HTML prompt) twice in one macro, the second time %AccessedVariables% returned ALL KM variables.

When you run a Custom HTML Prompt, KM puts ALL KM variables in "document.kmvar". I believe that when KM does this, it is inadvertently marking every variable as having been accessed by the macro. I think Peter agrees with me here, but I won't speak for him.

So if you were to use the "Easy Global Variable Clean-Up" macro after running a Custom HTML Prompt, you'd probably delete all your variables.

So that's bad as it is. But I'm wondering if other things may inadvertently affect %AccessedVariables% that we don't know about.

So beware.

2 Likes