Thank you @ccstone.
The excellent @Zabobon 's suggestion solved my problem using this action:
Your Macro below was very useful to help me understand how to pass KM variables to and from AppleScript which makes me wonder if it would be useful to have a supplemental "teaching macro" library as part of the macro library. These macros would start with a comment describing the teaching points and their pitfalls.