PDA

View Full Version : Passing a variable from one module to another



billmi
07-25-2006, 12:52 PM
Is it possible to pass a variable in code that is evaluated in one module to another module?

For example to put this in an editor script...



a=50
FindModule( Switcher_Tabbed ) : {
AutoToPosition(a)
DSKFade()
}


That's not working for me.

Trying


a=50
FindModule( Switcher_Tabbed ) : {
MessageBox(a)
AutoToPosition(a)
DSKFade()
}


Delivers "a" in the message box

I assumed at first that it was an issue of variable scope, but it's not.
I tried:


a=50
FindModule( Switcher_Tabbed ) : {
MessageBox(:a)
AutoToPosition(:a)
DSKFade()
}


This yeilds - VT Script Error: The expression on the left side of the : operator does not evaluate to a context.


Is there a way to pass a variable when controlling one module from another?

billmi
07-28-2006, 03:16 PM
And barring a straighforward variable pass, is there a way to either concantenate code variables, or to re-cast string variables into code variables?

Something like this:



a=50
front="FindModule( Switcher_Tabbed ) : {AutoToPosition("
back=") DSKFade() }"

fadetoa = front + a + back

castcode(fadetoa)

execute(fadetoa)



The idea being that fadetoa would be re-defined each time the code needed to be executed with a new value for a.

John Perkins
08-02-2006, 02:21 PM
I'm still not sure if this will help, I was told you couldn't pass variables. I'd still like to look for a workaround though.

Did you look at these?


SetLocalVariable(Name,Value)
Value = GetLocalVariable(Name)
RemoveLocalVariable(Name)
RemoveAllLocalVariables()
bool LocalVariableExists(Name)

Good luck,

SBowie
08-03-2006, 10:07 AM
I've no knowledge of VT-Script, but sometimes pass variables between scripts by writing a config entry or ascii text file. If there's a way to read/write an entry in a config file using VT-Script, maybe that would work?

ssdcinc
08-03-2006, 06:34 PM
I've no knowledge of VT-Script, but sometimes pass variables between scripts by writing a config entry or ascii text file. If there's a way to read/write an entry in a config file using VT-Script, maybe that would work?

... or a cookie!!