New in the Community? Get started here

Schneider Electric Exchange Community

Discuss and solve problems in energy management and automation. Join conversations and share insights on products and solutions. Co-innovate and collaborate with a global network of peers.

Register Now
Geo SCADA Expert Forum
Make the most of your remote operations with end-to-end solutions with Process Automation’s SCADA and Telemetry Solutions. With the challenges that remote sites present, reliable communications for remote operation, monitoring & management are vital in enhancing productivity and ensuring profitability.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Sisko

[Imported] Anyone know how to pass a varialbe to a ST program from a Script

>>Message imported from previous forum - Category:ClearSCADA Software<<
User: florian, originally posted: 2018-10-24 19:57:45 Id:195
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.

--------------

**_geoffpatton:_**
**_In my Templates I have a Internal Point that I want Everyone to be able to write to._**
**_Everyone of course does not have Control Rights in my database._**

**_I made a ST program that is configured so that anyone with Read access can Execute it. The ST program can Write the value of the Internal Point using a VAR_INPUT. Since this Variable is not set in the program it prompts the user to enter what the value should be. However I do not like the default prompt._**

**_I want to use a VBScript Form to prompt the user. They enter the value in the form then Press OK._**
**_Then the VBScript does an Execute Method on the ST program passing the value to the parameter._**

**_I cannot get that to work. I have used ST programs to pass a variable to another ST program with the Execute Method so I know that a ST program will accept it. From VBScript I can successfully Execute an ST but I cannot figure out how to pass my value with the Execute._**

**_I am thinking that the obj.Interface.Execute is just lacking the ability to pass variables, but I figured I would ask here before giving up._**

**_Also using security settings is not practical because there are hundreds of instances that would have to have the Security on the Internal Point individually set._**

--------------------------

**_geoffpatton:_**
**_gave it another Go and figured out how to pass the variable, and execute the ST program. However setting a Variable in a ST program looks to be a Control and the Execution Permission does not apply. So Everyone still cannot do what I want._**

**_In a way Adam Woodland is to thank, as I was reading something else he posted, not really related, and realized that I probably needed to use SetVariable with the Execute. I was trying to do it like when an ST executed another ST and you pass the variable with the Execute._**

**_My first try with SetVariable still did not work until I figured out that since it is not one interface call the value was not being saved. So the final piece was editing the ST program and change from using INPUT_VAR to RETAIN VAR_**

**_And since the scripting documentation falls short for things like this, here is the test script_**

**_Function Exec_ST()_**
**_Dim obj_**
**_Set obj = Server.FindObject(Server.GetOPCValue(".ST.FullName"))_**
**_obj.Interface,SetVariable "Variable_Name", Value_**
**_obj.Interface.Execute_**
**_End Function_**

-------------------------

bevanweiss:
Umm...
So set the security within the template to exactly what you want, and then disable the property override on the SecurityACLs for that point.

Blamm... every instance will now have the security that was defined on the Template itself.

I'm sure I've got examples of using Script to pass in VAR_INPUT variables to ST Logic. Just not on my computer here.
Make sure that you're following the Schema for this however, as I don't believe that you can just pass in the number of arguments that you want to, I think the schema defines a fixed Execute call (with like 8 or 16 arguments from memory).

------------------

**_geoffpatton:_**
**_Ah thanks Bevan,_**
**_I have rarely needed to have anything not using inherited security and when I have it has been on one off items. I did not know that security override for SecurityACLs existed, and it did not click when I was looking at the property overrides because I was thinking Security and not Access Control List. Makes complete sense that you can override the list._**

**_Sometimes I get in my own way_**

--------------

AWoodland:
The SetVariable and GetVariable aren't really suitable for this, you should be able to pass in the VAR_INPUT variables using the Execute method in scripting, i.e.

Object.Interface.Execute "Geoff", "Bevan", 0, False

For when the ST is:

VAR_INPUT
User1 : STRING;
User2 : STRING;
SomeNum : DINT;
SomeBool : BOOL;

END_VAR;

---------------

**_geoffpatton:_**
**_I don't know what I actually did before, but when I thought I tried that it did not work. All I can think of is maybe I put a , after the Execute. Like this Tag.Interface.Execute, 1.2_**

**_I abandoned ST anyway now that I understand the ACL override thanks to Bevan. I decided, if I did not really need them, it was a good idea to not add hundreds of ST object to the database._**