Structure of the ScriptWizard

This chapter introduces the basic structure of the ScriptWizard. In this chapter the main parts of the Wizard are described while for detailed information the links to additional chapters are listed. This chapter also contains explanations concerning elements to which functions and animations of the ScriptWizard refer.

Figure 1. ScriptWizard overview

Structure

The structure of the ScriptWizard is divided into the following two parts:

  1. An overview of the existing functions and their contents.

  2. The configuration possibilities to create new functions and to extend existing functions

Overview - Function

In overview of functions you can change the functions within a panel or a graphical object and edit their contents.

Figure 2. Overview - functions

Overview - Choose Function list

The choose function list shows all the functions which are declared in an object or in a panel. When a specific function is selected, all the included functional elements( functions, animations, etc.) are shown in the corresponding overview.

Figure 3. Choose function list

Example

In the figure above the function "Initialize" is selected. This function contains two variable declarations (My Variable and MyTargetVariable)

New functional elements and animations are always added to the currently selected function!

Overview - Animations / Functions

The overview of the functional elements contains all the function elements, which already exist in the function. They can be exported if a function is called. Here it refers to functions, animations or conditions.

The figure below shows, for example, two existing functional elements MyVariable and MyTargetVariable, which are to be defined.

Figure 4. Overview function contents

Add function

Add a user defined function by clicking on the push button "add function" . For more information concerning creating user defined functions please refer to userdefined functions

Edit function

There are two way to edit a functional element in the overview. You may either click on the push button "edit function" or double click on the functional element itself.

Move function upwards / move function downwards

Click on the push button "move function upwards" , the selected functional element moves upwards; Click on the push button "move function downwards" , the selected functional element moves downwards. In this way you can change the order of the list.

The declaration of variables does not follow the defined order in the list. A variable is always declared at the beginning of the function independent of its actual position in the overview.

Delete function

Click on the push button "delete function" and the selected function element in the overview will be deleted.

Available Configuration Possibilities

The ScriptWizard provides a variety of functionalities as shown in the figure below.

Figure 5. Overview - Options

If the ScriptWizard is not opened in a panel by clicking on the push button "open property Wizard" next to the event "Initialize" (Init), only a reduced subset of functions is available. In such a case the function "Connect" and the function "Click for faceplates" are not available.

Figure 6. Overview - Options (opened NOT in the event "Initialize")

Connect

The function "Connect" in the menu tab in the ScriptWizard allows an automated reaction to value changes in the panel. These connects are mapped onto a variable, which allows creating a certain behavior (color change, moving of the position, rotation, etc.) For more information about the menu tab "connect" please refer to: Data point connection.

Animations

In the menu tab "Animations" you may find all the functions related to animation which can be used by the ScriptWizard to modify graphical objects visually. The animations cover such functions as activating and deactivating graphical objects, rotating or moving graphical objects. For the detailed list with all the available animations please refer to Animations.

Figure 7. Animations

Functions

In the menu tab "Functions" you may find all the function blocks which can be used by ScriptWizard to create new functions. These function blocks include variable declaration, statement for calculation and conditions / if-statement. For a detailed list with all the available function blocks please refer to Functions.

Figure 8. Functions

$-Parameter for input constants

In order to flexibly apply different data points to the panel created by ScriptWizard, corresponding variables can be edited by means of the function dollar-parameter. A variable can be directly defined in the menu tab "dollar-parameter" and be used later by other functions and animations in ScriptWizard. For additional information about the menu tab "dollar-parameter" please refer to: dollar-Parameter (ScriptWizard).

Clickframe for Faceplates *

To create faceplates using the ScriptWizard simply place the click frame for the object using drag and drip. The click frame contains the basic configuration for display of the status, the mode and alarms. The click frame also offers the possibility to open a faceplate. This is especially useful when used to create simply symbols.

Figure 9. Click frame for faceplates
  • * = This function "Clickframe for faceplates" is only available, if you open it in the Initialize event.

  • It is to consider, that the reference point of the panel must be located in the upper left corner of the object, otherwise the objects will not be displayed correctly inside the faceplate. Can be set using the property sheet.

Dialog - Save Changes

If changes were made to the configuration of functions or animations that have not been saved using the "Apply" button, following dialog will appear when pressing the "OK" button inside the ScriptWizard panel:

Figure 10. Dialog - Save Changes

This dialog allows it to apply the changes (press "Yes"), to discard the changes (press "No") or to go back and verify the changes (press "Cancel").

Subpanels of the ScriptWizard

The text below describes several panels which are used by the ScriptWizard in different contexts.

User-defined functions

In order to allow a better subdivision of functional elements and animations and in order to be able to react to certain conditions inside the program sequence, the ScriptWizard allows the creation of user-defined functions.

The user-defined functions are displayed in the function overview and can be filled with related contents (animations and functional elements). To add the user defined functions click on the push button "Add function" in ScriptWizard.

Figure 11. Overview - User-defined functions

Add function

The user-defined function provides several options available for configuring functions as you wish. To add a new function click on the push button "add function" . The figure below shows the define function interface.

Figure 12. Create a new user defined function

Function

Name a function or define a parameter in the function text box.

The name of each function must be clear and unique, it can only be used once!

Parameter

A parameter is a value passed on to a function. When calling the function a value needs to be assigned to this parameter.

A parameter consists of the following elements:

  • Name. The name is required in order to address a parameter.

  • Type. The type indicates the kind of the parameter and how the parameter should be correspondingly edited.

  • Description. The description shows additional information and notes and can be written later (optional).

The following options are available to the parameters:

=> add a new parameter

=> move the selected parameter upwards

=> move the selected parameter downwards

=> delete the selected parameter

Description

The description shows additional explanations, notes and possible warnings. It is optional.

Storage

The storage location defines where a user-defined function is stored. Per default the storage location is “panel”. The function is then stored in the source code of the panel. As a result, the function can only be used in the panel where it has been defined while other panels cannot use this function.

If you want to save a function in your own library, the function needs to be stored in the folder "<WinCC_OA_Proj>\libs\Scriptwizard\" . Other panels also have access to those functions saved in this folder, enabling other panels to use the functions in your library.

The "ScriptWizard" folder can only be stored in the folder "<WinCC_OA_Proj>\libs\".

Edit function

Click on the push button "edit function" to edit a user defined function. Editing a user defined function is similar to the creation of a new user defined function (see above).

The function name can not be edited!

Delete function

To delete a function firstly select the function you would like to delete, then click on the push button "delete function" .

Conditions

A panel with the only purpose of creating conditions exists in the ScriptWizard. This panel allows the creation of logical conditions in a very simple way. All available variables, dollar-parameters and logical operators are listed in this panel. Conditions can be created from the list with a few clicks of the mouse.

For more information concerning the usage of the panel please refer to Enabling or Disabling a Graphical Object, Setting a Graphical Object Visible or Invisible

Complex conditions can be entered manually. However, only the syntax of the input is verified, while incorrect variable names or incorrect conditions are not!

Figure 13. An example panel to create a rule

Example

When the value of MyVariable bigger than 20 is, or when the value of MyTargetVariable is not equal to 0, condition "(MyVariable>20)||(MyTargetVariable!=0)" is TRUE.

The Or ( "||" ) statement combines two conditions into one single condition statement, for example "(MyVariable>20)||(MyTargetVariable!=0)" .The result of the Or statement is TRUE if at least one of the two conditions is TRUE.