Support Forums
How to Write Scripts Within an Active VTScada Application

I've been really curious about writing scripts within an active VTScada application, but I'm not entirely sure how to go about doing so. I tried creating a new script tag, but I really do not know how to configure the tag. I tried creating calculation tags where I can bring up the function editor and even looked at the available options that function selection provides. I recently came across a YT video on Developer Tips and Tricks where a slide talks about case script statement in steady state and wanted to try out the example giving in the slide, but CASE function was not an option available through the function selection. I come across a lot of cool things using VTScada and seeing what others do with VTScada. I really want to learn how to do it as well.

I've been really curious about writing scripts within an active VTScada application, but I'm not entirely sure how to go about doing so. I tried creating a new script tag, but I really do not know how to configure the tag. I tried creating calculation tags where I can bring up the function editor and even looked at the available options that function selection provides. I recently came across a YT video on Developer Tips and Tricks where a slide talks about case script statement in steady state and wanted to try out the example giving in the slide, but CASE function was not an option available through the function selection. I come across a lot of cool things using VTScada and seeing what others do with VTScada. I really want to learn how to do it as well.

Electronics/Electrical Technician
Hilliard Fletcher Wastewater Treatment Plant

edited 1 day ago at 7:07 pm

Hey Joseph,

I'd suggest you start at the help files here:

https://www.vtscada.com/help/Content/Scripting/API/S_Welcome.htm?tocpath=Scripting%7C_____0

For your First Custom Script, writing a custom function for VTScada would be a great place to start and experiment.

Also, please note that the source debugger is a powerful debugging tool and you can get an introduction to that here:

https://www.youtube.com/watch?v=WizPfwUrGlQ&t=2462s

Hey Joseph, I'd suggest you start at the help files here: https://www.vtscada.com/help/Content/Scripting/API/S_Welcome.htm?tocpath=Scripting%7C_____0 For your First Custom Script, writing a custom function for VTScada would be a great place to start and experiment. Also, please note that the source debugger is a powerful debugging tool and you can get an introduction to that here: https://www.youtube.com/watch?v=WizPfwUrGlQ&t=2462s

Trihedral Engineering Ltd.

@ArghDave
I appreciate your response, and I've started overlooking what you provided. I did come across one part of the help file under Try it...Hello World where it mentions not to experiment within a production application. Does that mean if you have an active running application to not experiment on? I was trying out a few things through the tag browser specifically learning more about how to write expressions through the function editor. I cycled through the available options via the function selection and I have learned a few things, but maybe I find myself confused from writing scripts to writing expressions through an active VTScada application. I then saw that there is a script tag and I tried learning about it, but really don't fully grasp how to use that particular type of tag. The reason I submitted this question was I was recently playing around with Google Gemini by asking AI to create a VTScada function expression that triggers a good morning to the user at a specific time. In my mind, I'm thinking how cool would it be to have your SCADA application greet you in the morning when you clock in. I suppose you could think of it as a Jarvis smile

6931912f4cc8d

@ArghDave I appreciate your response, and I've started overlooking what you provided. I did come across one part of the help file under Try it...Hello World where it mentions not to experiment within a production application. Does that mean if you have an active running application to not experiment on? I was trying out a few things through the tag browser specifically learning more about how to write expressions through the function editor. I cycled through the available options via the function selection and I have learned a few things, but maybe I find myself confused from writing scripts to writing expressions through an active VTScada application. I then saw that there is a script tag and I tried learning about it, but really don't fully grasp how to use that particular type of tag. The reason I submitted this question was I was recently playing around with Google Gemini by asking AI to create a VTScada function expression that triggers a good morning to the user at a specific time. In my mind, I'm thinking how cool would it be to have your SCADA application greet you in the morning when you clock in. I suppose you could think of it as a Jarvis :) ![6931912f4cc8d](serve/attachment&path=6931912f4cc8d)

Electronics/Electrical Technician
Hilliard Fletcher Wastewater Treatment Plant

The Script tag basically runs a built script when a discrete value changes. It's really not use that often and most custom scripts do not use that tag at all. Most scripts are either on a page or are a type of module which gets identified.

When we talk about custom scripts, we are typically not talking about custom expressions, typically, custom modules or scripts which are written outside of VTScada and imported into the application. It would often be a separate .src file which is referenced and imported or custom page script which requires editing a page's .src file.

As for custom scripts and running applications, creating expressions using the expression builder is a fairly safe thing to do, even in a running application. If you are writing and testing custom code modules which get imported into VTScada. That should be tested and developed on a machine which is not a functional application server. VTScadaLIGHT on another machine is a great place to learn some custom script.

If you'd like to start with expressions: you can check out the following - https://www.vtscada.com/help/Content/Scripting/Expressions/ExpressionExamples.htm

The Script tag basically runs a built script when a discrete value changes. It's really not use that often and most custom scripts do not use that tag at all. Most scripts are either on a page or are a type of module which gets identified. When we talk about custom scripts, we are typically not talking about custom expressions, typically, custom modules or scripts which are written outside of VTScada and imported into the application. It would often be a separate .src file which is referenced and imported or custom page script which requires editing a page's .src file. As for custom scripts and running applications, creating expressions using the expression builder is a fairly safe thing to do, even in a running application. If you are writing and testing custom code modules which get imported into VTScada. That should be tested and developed on a machine which is not a functional application server. VTScadaLIGHT on another machine is a great place to learn some custom script. If you'd like to start with expressions: you can check out the following - https://www.vtscada.com/help/Content/Scripting/Expressions/ExpressionExamples.htm

Trihedral Engineering Ltd.

Gemini's suggested Trigger tag is a good way to show a message at a certain time. You can set the trigger to have the value of TRUE over a period of time and then set a text box's opacity to the value of the trigger tag. As a note, it's always a good idea to wrap a expression in a PickValid() to give a default result in the case that the value is INVALID (NULL).

If you look at a text box opacity and select to link it to a tag or create an expression, you would just need to put the trigger tag in there. If you link it to a tag, don't worry about PickVald()

Gemini's suggested Trigger tag is a good way to show a message at a certain time. You can set the trigger to have the value of TRUE over a period of time and then set a text box's opacity to the value of the trigger tag. As a note, it's always a good idea to wrap a expression in a PickValid() to give a default result in the case that the value is INVALID (NULL). If you look at a text box opacity and select to link it to a tag or create an expression, you would just need to put the trigger tag in there. If you link it to a tag, don't worry about PickVald()

Trihedral Engineering Ltd.

45
4
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft