You must declare the variable outside the function for it to be a "global" variable, and also have the USEUNIT <scriptnamewithglobalvariable> added to scripts that need to acccess the global variable. Additionally you can use
project variables.
JScript Example:UNIT1:
//USEUNIT UNIT2
function main(){
wshell.popup(myGlobalVariable);
myGlobalVariable = 'test2';
secondary();
wshell.popup(myGlobalVariable);
}
UNIT2:
wshell = new ActiveXObject('WScript.Shell');
myGlobalVariable = 'test1';
function secondary(){
wshell.popup(myGlobalVariable);
myGlobalVariable = 'test3';
}