You would use:
use scripting additions
set myVar to system attribute "KMVAR_myVar"
which is faster than getvariable, BUT
is "broken" for reading international variables.
This
will come out as mojibake: 👻
The scripting page in the manual says this:
"Variables can be accessed from shell scripts via the environment variables in the form $KMVAR_Variable_Name where KMVAR_ is prefixed, and spaces are converted to underscores. AppleScripts can also access the environment variables using the system attribute command, but note that system attribute is not safe for international characters. "
A discussion with the developer can be found here.