Hey Jay,
You'll have to provide a more complete picture of your workflow to get realistic help.
If you haven't read this it's worth a couple of minutes of your time.
Tip: How Do I Get The Best Answer in the Shortest Time?
Getting variable names and values is easily done with AppleScript.
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/01/11 14:23
# dMod: 2019/01/11 14:23
# Appl: Keyboard Maestro
# Task: Extract Keyboard Maestro Variable Name and Value for Variable Names with a Prefix.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro_Engine, @Extract, @Variable, @Names, @Values, @Prefix
----------------------------------------------------------------
# Extract variable names and variable values.
----------------------------------------------------------------
tell application "Keyboard Maestro Engine"
tell (variables whose name starts with "STOREVAL")
set {varNameList, varValueList} to {name, value}
end tell
end tell
----------------------------------------------------------------
# Convert AppleScript List Objects into Text.
----------------------------------------------------------------
try
varNameList / 0
on error eMsg
set varNameList to removeErrorNotation(eMsg) of me
end try
try
varValueList / 0
on error eMsg
set varValueList to removeErrorNotation(eMsg) of me
end try
----------------------------------------------------------------
--ยป HANDLERS
----------------------------------------------------------------
on removeErrorNotation(errStr)
set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"Can't make ", " into type real."}}
set returnValue to text item 2 of errStr
set AppleScript's text item delimiters to oldTIDS
return returnValue
end removeErrorNotation
----------------------------------------------------------------
Now we have the issues of where to store the data and how to retrieve it.
-Chris