Forum Discussion
Ryan_Moran
11 years agoValued Contributor
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:
UNIT2:
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';
}
Related Content
Recent Discussions
- 12 hours ago