Global variables and referencing them

I am having trouble with getting a call to work the way I want it to. I can get the results I want with Script2.example1, but the overhead of the if and else if statement is more than I can tolerate in my code. Script2.example2 would work if I were not trying to reference a global variable, but as soon as I try to add the global variable into the equation SenseTalk will not accept the code.
<pre>
Script1 (intended to be a master script):
Global SUT1
Global SUT2
Global Workstation1
Global Wordstation2
Put (Name: SUT1, Value: 5) into Workstation1
Put (Name: SUT2, Value: 10) into Workstation2
Script2.example1
Sctipt2.example2

Script2:
To handle example1
Put connectioninfo().name into CurrentWS
If CurrentWS = ?Workstation1?
Put global Workstation1.Value into VariableX
Else if CurrentWS=?Workstation2?
Put global Workstation2.Value into VariableX
End if
End example1

To handle example2
Put global connectioninfo().name?s Value into VariableX
End example2
</pre>

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    You'll need to use the "do" command which takes a syntactically correct SenseTalk string and executes it. Your example2 handler can become:
    To example2
    	do "Put global" && (connectioninfo().name).value && "into VariableX" 
    End example2
    
Sign In or Register to comment.