Stealing shamelessly from @noisneil and @ccstone, I'll contribute my spin...
PURPOSE
Used during macro editing, this macro will add a group action to display a macro variable. The specific group action added depends on the the state of the shift key (⇧) when the macro is triggered:
⇧ up : Display Text (in window)
⇧ dwn: Prompt for User Input
The first form (⇧ up) is useful in a target macro when one prefers to display the value of a variable but immediately continue macro execution.
The second form (⇧ up down) is useful in a target macro when one prefers to pause a macro and view the value of a variable. After reviewing, the macro can be resumed or canceled.
Note that the text cursor must be properly placed before this macro is triggered. For example, with the Set Variable to Text action or the Set Variable to Calculation action, the text cursor must be placed in the first field of the action, i.e., the field labeled Set variable.
Once the text cursor is properly placed and this macro is triggered, it will insert the new group action immediately below the action that includes the cursor. The inserted group can then be optionally moved manually.
MACRO SETUP
Before triggering this macro for the first time, complete the SETUP STEPS detailed within the macro.
ACKNOWLEDGEMENTS
In a Keyboard Maestro forum thread started by @Sleepy, Various Methods for Displaying KM Variables and Data, @noisneil first suggested this clever technique; @ccstone subsequently contributed his take on the idea. This macro builds off the ideas from both.
TESTED WITH
• Keyboard Maestro v10.2
• Ventura Version 13.0 Beta (22A5342f)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
1.0 - Initial version
1.1 - Changed the Title of the groups to use [Debug] in the name.
1.2
a) Changed name from Insert ⇨****Actions to Display a Macro Variable to Insert Actions to Display a Macro Variable.
b) Changed hot key triggers and changed alternate modifier from ⌥ to ⇧.
c) Removed insered tabs before Display Text dialog
d) Change the vertical bar to a consistent unicode character (⏐).
2.0
a) Added an alternate output format that works better if a variable is a text list. This format is inserted if the trigger includes ⌥.
b) For Display Text action, change unicode character (⏐) to [ and ]. This is consistent with syntax used in Augment or Filter Text.
DOWNLOAD Macro File:
Insert⇨Actions to Display a Macro Variable.kmmacros (38 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.