AS to test whether global variables are actually used in a script?

Some of my AppleScript applications have evolved over many years to work with changes in macOS, and some global variables have become obsolete - they’re no longer used in the actual code.

Is there any way to test whether a global is used in the script? Is there possibly an AppleScript that can check on this? If no one has written one, I’ll try on my own, but I would prefer not to reinvent the wheel.

There was something I’ve used before that check your actual use of functions, but not properties.

For properties I would first do a search within the text to see where they are used. Then after they are used put in log statements to check whether those functions actually get called or used.

If your using script debugger just assign the variable either missing value or Something obvious: 99999, “testVarOne”, “is this used”

Run the script then in the results area of the properties of the script check if the values have changed

If you’re using script debugger just assign the variable either missing value or Something obvious: 99999, “testVarOne”, “is this used”

This is a very clever idea. Thank you. I will use this if nothing automated shows up. Thank you.