Script Applications
Most of the applications that you see listed in the Application Manager of a fresh VTScada installation are script applications. These are utilities that programmers use for examining, testing, and debugging their code.
Script applications do not have access to the user-interface tools of a standard application such as the Tag Browser, tag types, libraries, and the features of the display manager. Those come only with the VTScada Library layer. All standard applications are built on top of a layer that was created with the language described in this manual.
Script applications can be created by using the Advanced option of the Add New Application wizard in the VAM and setting the type to Script Application. You might create one when you might need a stand-alone utility without the features of a standard application. They are also very useful when learning the VTScada scripting language.
When working in a script application, it is common to write some or all of the code in the file AppRoot.SRC. Note that you would never do this in a standard application where AppRoot is used only to declare constants and modules. In a new script application, AppRoot will look like the following:
{============================ System ===============================} {===================================================================} ( System { Provides access to system library functions }; Layer { Provides access to the application layer }; ) [ Graphics Module { Contains user graphics }; WinTitle = "User Application" { Window title }; RunningOnVIC { TRUE if this is a VIC session }; ] Init [ If 1 Main; [ RunningOnVIC = IsVICSession(); ] ] Main [ Window( 0, 0 { Upper left corner }, 800, 600 { View area }, 800, 600 { Virtual area }, Graphics() { Start user graphics }, {65432109876543210} 0b00010000000110011, Concat(WinTitle, RunningOnVIC ? " - %S" : ""), 0, 1); ] < {======================= System\Graphics ===========================} { This module handles all of the graphics for the application } {===================================================================} Graphics Main [ ] { End of System\Graphics } >
The primary module of this application has one state, Main. This calls the Window function, which displays a window on the screen having the properties defined in the function call.
One submodule is defined: Graphics. The Window function in the primary module calls this submodule. Any graphics code that you write in the Graphics submodule will be displayed in the window.