Each and every variable in a script needs to be declared somewhere. This is done using the
var statement.
eg:
code:
var MyVar = "Hello World";
If you declare a variable inside a function, it is a local variable. The variable will only exist as long as the function runs. When the function ends, the variable will not exist anymore.
eg:
code:
function DoSomething() {
var MyLocalVar = "Hello World"
}
If you declare a variable in the main scope of the script, thus outside any functions, it is a global variable. The variable will exist as long as the script is running and thus can be used from anywhere in the script, including from inside funtcions...
eg:
code:
var MyGlobalVar = "Hello World"
function DoSomething() {
//blahblah
}
Short answer: declare WndProfileInformation as a global variable.