View Single Post
  #2  
Old 03-12-2004, 11:28 AM
Sotorin Sotorin is online now
Registered User
 
Join Date: 05-07-2003
Posts: 7
This script doesn't work

I just placed this simple script into Project Tab in Script Editor page. One global variable and two procedures (one sets global variable and the other one reads it)

--- BEGIN ---

Dim var

Sub SetVar()
var = "My Name"
End Sub

Sub GetVar()
MsgBox "Value is: " & var
End Sub

--- END ---

Now, I insert two new Script steps; first step calls SetVar procedure and the second one calls GetVar.
When a MsgBox pops up it is unfortunately w/out var set to "My Name" ... it only reads "Value is:"

Why?

PS. The only way this works the way I want is when I globally set var to some value like this:

Dim var
var = "My Name"

Sub GetVar()
MsgBox "Value is: " & var
End Sub

But this defeats the purpose. Does exactly what I was affraid off .. variables go out of scope.

Last edited by Sotorin; 03-12-2004 at 11:30 AM.
Reply With Quote