I've been working on this off and on today and I'm kind of stumped. Have you made any progress?
EDIT: This is what I came up with BUT... because of what I believe are accessibility issues (as documented here) there is a significant delay (about 6 seconds) between clicking the add button and clicking variable...adding ignoring application responses
does not make a difference unfortunately.
----------------------------------------------------------
# Author: Chris Thomerson
#
# Current Version: 1.0
# Version History: 1.0 (Initial script)
#
# Created: Thursday, December 2, 2021
# Modified: Thursday, December 2, 2021
# macOS: 11.6.1 (Big Sur)
#
# Notes:
# I claim no responsibility nor guarantee compatibility
# As with any kind of custom scripts, these must be tested thoroughly on each person's device
# May be used and distributed freely
----------------------------------------------------------
tell application "System Events"
tell application process "Keyboard Maestro"
-- ignoring application responses
click (last button whose role is "AXButton" and description is "Add Button") of scroll area 1 of window "Value Inspector"
click menu item "Variable" of menu 1 of scroll area 1 of window "Value Inspector"
-- end ignoring
end tell
end tell