Script Code Examples

Here, you will find a set of examples of VTScada script code modules that you can add to your applications. In nearly all cases where you want to extend the features of an existing application, you will need to create a new module and declare it in the correct section of your application's AppRoot.SRC file. There are two exceptions that should be noted before starting:

  • Before writing any code, explore the features of VTScada. Many times, people have started to write code only to discover that existing features can be adapted to their needs.
  • If the goal is to add new user interface elements, add your code to the .SRC file of an existing page or custom widget.

 

Otherwise, if your goal is to extend a VTScada application by adding a new tag, driver, report, data-entry wizard, etc. then do the following:

  1. Using a text editor, create a new file in the application folder.
    The new file should be given a name that matches what you intend to call your module, and must have the extension, ".SRC".
  1. Write your VTScada code in that new file.
  2. Using a text editor, open AppRoot.SRC in the application's folder.
  3. Select the correct class group and declare your module within it as follows. (Class Declarations for Modules in AppRoot)
[ (PLUGINS) {===== Modules added to other base system modules =====}
   MyCustomReport  Module "15MinSnap.SRC";
]
  1. Use the application's Import File Changes tool in the VTScada Application Manager. When prompted, add the new file to your application.

Importing new files