If a set a Variable of the path to my "Scripts" folder it is not recognized by the KM Action. But pasting the actual path works. Why? I tested by "Displaying" the path (using variable) and pasting the display result into the "Execute AppleScript" action and it worked. That tells me the Path Variable is correct. I run numerous scripts in this way and would much prefer to maintain the path in one place.
I, too, like to centralise my workflows by creating dictionaries of paths that I use commonly. To reference them in an AppleScript, you cannot simply use the % notation, as the script fields are one of the few text fields in Keyboard Maestro that does not process tokens.
For your particular situation as shown in your screenshot, you can do something like this:
tell application "Keybaord Maestro Engine" to set dndScriptsFolder to the value of variable "DND_Scripts"
set AIFile to dndScriptsFolder & "/Scale_Divider.jsx"
tell application "Adobe Illustrator"
activate
do javascript file AIFile
end tell
(This is assuming that Adobe Illustrator's AppleScript commands are happy with posix paths, i.e. paths that use a slash to delimit directories. If not, you have to coerce the posix path stored in AIFile to an alias object first:
set AIFile to POSIX file (dndScriptsFolder & "/Scale_Divider.jsx") as alias
Sorry I cannot test this for you, but I don't have Adobe Illustrator).
Briefly, another way to get the KM variable across to AppleScript is to use the process tokens command, which allows you to use the string you formulated in your present script:
tell application "Keyboard Maestro Engine" to set AIFile to process tokens "%Variable%DND_Scripts%/Scale_Divider.jsx"
As I use dictionaries a lot over variables in Keyboard Maestro, this is often the method I choose where necessary.