Use of project variables

Navigation:  Tutorial: The Form Editor >

Use of project variables

Version 1.0.0

A project variable can be used to transfer information and data from the current Client Command to a form created by the form editor. Likewise, information and data from the created form can be transferred to the current Client Command after closing the form. In this way, the execution of the Client Command can be controlled at will.

 

First, you create a project variable (see Variables). If you then use the form editor command, you can open a dialog with the Generate code function (see Menu bar).

 

11.4 - ProjektVariablen

Generate code

 

With this dialog you can select the corresponding project variable. Select now the Load values on startup option or the Save values on close option. In this way, the values for all components are loaded from the specified value, if they exist, when you launch the form. Furthermore, the contents of all components are saved in the specified variable when you exit the form.

 

With the Load values on startup option, the following code is created in the automatically generated FormActivate () function. This means that in this example, all the edit fields are populated with information  which can be found in the variable VAR:

 

  EditDomain.Text := GetVarContent('VAR.EditDomain');

  EditBeschreibung.Text := GetVarContent('VAR.EditBeschreibung');

  EditIP.Text := GetVarContent('VAR.EditIP');

  EditMAC.Text := GetVarContent('VAR.EditMAC');

  EditOS.Text := GetVarContent('VAR.EditOS');

  EditVersion.Text := GetVarContent('VAR.EditVersion');

  EditSP.Text := GetVarContent('VAR.EditSP');

 

In the automatically generated function OkButtonClick (see details in the screenshot) the code is generated to store all edit fields in the variable VAR:

 

  SetVarContent('VAR', 

     'EditDomain=' + EscapePropertyValue(EditDomain.Text) + 

    ',EditBeschreibung=' + EscapePropertyValue(EditBeschreibung.Text) +

    ',EditIP=' + EscapePropertyValue(EditIP.Text) +

    ',EditMAC=' + EscapePropertyValue(EditMAC.Text) +

    ',EditOS=' + EscapePropertyValue(EditOS.Text) +

    ',EditVersion=' + EscapePropertyValue(EditVersion.Text) +

    ',EditSP=' + EscapePropertyValue(EditSP.Text));

 

 

The variable VAR requires a specific format to load the information and data at the start of the form. Likewise, the information is stored in a specific format. The information and data with the syntax Element.EigenschaPropery=value,[...] is loaded or saved.

 

In the Client Command you can populate the variables VAR, e.g., by means of string commands (see chapter Category strings) with information and data before the start of the form. After completing the form, the variable can be easitly queried by entering %Variable.Eigenschaft%. In order to query, the operating system of a client displayed previously in the form, simply enter the string %VAR.EditOS%.

Last change on 10.03.2014