I successfully used a tab scoped variable to pass data from a scriptcommand back into a script button now.
Thanks for pointing out the difference to the global variable stack, that's quite important to know about.
So with lister/tab scoped variables working like this, the situation is more friendly and offers new tricks! Thank you! o)
I also had some tests whether environment variables not only work, but how they compare to when using DO internals.
I didn't found much difference, setting an env-variable only takes about 3-10 milliseconds here, I expected longer delays.
For anybody in need to deal with env-variables, this is a little wrapper to easify general usage. It defaults to "Process" scope, but can be overriden for each method-call, it also picks up a global shell object, to not instantiate a new copy unecessarily.
///////////////////////////////////////////////////////////////////////////////
function EnvMagic(scope){ //v0.1
this.scope = scope || "Process";
try{this.shell=shell} catch(e){this.shell=new ActiveXObject("WScript.Shell")};
this.env = this.shell.Environment(this.scope);
///////////////////////////////////////////////////////////////////////////
this.Set = function (varname, value, scope){
var env = scope?this.shell.Environment(scope):this.env;
env(varname) = value;
return value;
}
///////////////////////////////////////////////////////////////////////////
this.Get = function (varname, scope){
var env = scope?this.shell.Environment(scope):this.env;
return env(varname);
}
///////////////////////////////////////////////////////////////////////////
this.Remove = function (varname, scope){
var env = scope?this.shell.Environment(scope):this.env;
return env.Remove(varname);
}
///////////////////////////////////////////////////////////////////////////
this.Expand = function (varString){
return this.shell.ExpandEnvironmentStrings(varString);
}
}
While playing with Shell.Environment, I noticed that the devs decided to use the same syntax and style you guys "invented".
Assigning values to method calls is still odd to me (visually), but does not seem to be specific to DO anymore. o))