<< Click to Display Table of Contents >>

Navigation:  Using the program > Scripts >

Script syntax

The program has the built-in scripting engine. The syntax of this script language is compatible with BasicScript or VBScript, but the list of supported functions is fully different. The program folder contains the "ScriptSamples" folder with some examples.


Please note, the program will stop all operation for the current block while executing a script. Avoid scripts with a long execution time.


The script list of function includes some special functions:


function GetValue(Name: string): Varinat


This function returns an OPC tag value from any visualization block.


Name - the name of the opc tag. If the name begins with the "@" character the program searches for a block by a caption. For example:


' this command searches the block with the "Var" OPC tag on the "opcserver.OPC.1" server

v = GetValue("opcserver.OPC.1.var")


' this command searches the block with the "Var" OPC tag on any OPC server (simple syntax)

v = GetValue("var")


' this command searches by the "MyBlock" caption

v = GetValue("@MyBlock")


function SetValue(Name: string; Value: variant)


This function set an OPC tag value in any visualization block.


Name - the same as GetValue.

Value - the new value.


function GetParam(BlockName, ParamName: string): Varinat


This function returns a visualization block parameter.


BlockName - the same as GetValue

ParamName - parameter ID.


ind.visible - true/false, the block visibility state

ind.win.transparent - true/false, transparency

ind.win.backcolor.use - true/false, use a background color

ind.win.backcolor - integer number, a background color value

ind.win.left - integer number, the X position of the top left corner

ind.win.top - integer number, the Y position of the top left corner

ind.win.width - integer number, the horizontal size of the block

ind.win.height - integer number, the vertical size of the block

ind.win.align - integer number, 0 - none, 1 - left, 2 - right, 3 - top, 4 - bottom, 5 - window.

ind.win.indent - integer number, the margin


ind.border.show - true/false, show the block border

ind.border.color - integer number, a border color value

ind.border.width - integer number, a border width

ind.border.transparent - true/false, transparency

ind.border.backcolor.use - see above

ind.border.backcolor - see above


ind.caption.show - true/false, show the block caption

ind.caption.text  - text, caption text

ind.caption.align - integer number, 0 - left, 1 - center, 2 - right.

ind.caption.border.color - integer number, the border color for the caption

ind.caption.border.square - true/false, a square border of the caption

ind.caption.border.round - true/false, a round border of the caption

ind.caption.border.size - integer number, the border size

ind.caption.transparent - see above

ind.caption.backcolor.use - see above

ind.caption.backcolor - integer number, the background color






































function SetParam(BlockName, ParamName: string; Value: variant)


This function set an OPC tag value in any visualization block.


BlockName - the same as GetParam.

ParamName - the same as GetParam.

Value - the new value.


The program saves the changed value if user wants to save the configuration.


procedure ShowPage(Page: string)


The program opens the specified page. If "Page" is a number the program shows the page with the specified index (zero based). Otherwise the program searches a page with the specified caption.


function ExecuteFile(FileName, Parameters, WorkingDir: string; Options: integer): integer


Executes the specified file.


FileName - pass the fully qualified file name


Parameters - string that specifies the parameters to be passed to the application


WorkingDir - specifies the default (working) directory for the action. If this value is empty, the current working directory is used.




0 - Hides the window and activates another window.


3 - Maximizes the specified window.

6 - Minimizes the specified window and activates the next top-level window in the z-order.

9 - Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.

5 - Activates the window and displays it in its current size and position.

10 - Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.

7 - Displays the window as a minimized window. The active window remains active.

8 - Displays the window in its current state. The active window remains active.

4 - Displays a window in its most recent size and position. The active window remains active.

1 - Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


function AppendFile(FileName, Data: string): boolean


Appends text to the specified file. If the file does not exists then it will be created.


function WriteFile(FileName, Data: string): boolean


Writes text to the specified file. If the file already exists then it will be overwritten.


function ReadFile(FileName: string): string


Reads all text from the specified file.



GetValue/SetValue demo


' Case operator demo

dim val1, val2, name1, name2


name1 = "ThisBlockOpcTagName"

name2 = "AnotherBlockOpcTagName"


val1 = GetValue(name1)

select case val1

 case 1: val2 = "new value 1"

 case 2..10: val2 = "new value 2"

 case else: val2 = "new value 3"

end select


SetValue(name2, val2)


File execution demo


dim val1, name1

dim working_dir = ""

dim parameters = ""



name1 = "ThisBlockOpcTagName"

val1 = GetValue(name1)


if val1 > 100 then

 ExecuteFile("C:\alert.bat", parameters, working_dir, 0)

end if



Log file demo


dim val1, name1, s


name1 = "ThisBlockOpcTagName"

val1 = GetValue(name1)


if val1 > 100 then

 s = "Value is too high"

 AppendFile("C:\Logs\log.txt", s) ' create or append to a text file

end if



More demos


You may find more demos and examples in the "ScriptSamples" folder in the program folder.