View Variable Values While Debugging?

This conversation, and the one on %ExecutingInstance% token made me realize you should be able to expand this to support Local and Instance variables from other macros. Perhaps you can incorporate this idea into your macro.

Here's a macro that you can run at anytime and it'll grab the value of different variables, global, local or instance from a running instance. In the original macro to fetch values FROM, set a global variable named DebuggingInstance to the %ExecutingInstance% token. I also set a local variable to hold the macro name for the output, but this isn't required.

Here's the output:

To use this, in the macro you're debugging you need to set a global variable the holds the %ExecutingInstance% token for that macro. The independent variable display macro can take that info, and the names of the variables you want to report on, retrieve the variables with AppleScript and push the values back into the current macro.

Macro: Display variables from another instance

Macro: Example macro to debug

This macro sets the DebuggingInstance global variable to its %ExecutingInstance% token and defines some variables. It pauses 5 minutes to give you time to launch the other display variable macro. It also defines a variable with the name of this macro so it can be retrieved by the display variable macro.

Macro Downloads

Display variables from other instance.kmmacros (7.3 KB)

1 Like