Changes in the script userDriver.ctl

This section uses step-by-step examples to show the changes that you need to make in the script userDriver.ctl. The script itself contains first some information in English and then the actual script in which you should add the code.

You must copy this script into the project directory and modify it there. Any future changes must also be made in the project directory.

To add the driver names and driver types

  1. Copy the script <wincc_oa_path>/api/SampleDriver/userDrivers.ctl or <wincc_oa_path>/api/TcpDrv/userDrivers.ctl into the directory <proj_path>/scripts/userDrivers.ctl

  2. Open the script <proj_path>/scripts/userDrivers.ctl

  3. In the following section "fill the makeDynString with the new driver data" specify under "names" in "dds[1]=makeDynString()" the name that you want to be displayed for the driver in the combo box of the panel for selecting the peripheral address (see _address config):

    // names
    dds[1]=makeDynString(<names>);

    This text will be displayed in the driver type selection combo box in // address.pnl. Example:

    dds[1]=makeDynString("Test driver 1","Test driver 2");
  4. So enter in dds[1] your driver, or two drivers as given in the following example:

    dds[1]=makeDynString("New driver 1", "New driver 2")
  5. Move further down the script to "types" and enter the driver type, as shown in the example, which will also be used in the panel name ("address_"+typename+".pnl):

    // types
    dds[2]=makeDynString("newdrv1", "newdrv2");

    This text identifies the driver type. The panel name must have the name "address_"+typename+".pnl" and must be in panels/para. Example:

    // dds[2]=makeDynString("tstdrv1","tstdrv2");
  6. Move further down the script to "driver" and enter _drv_ident for the name of the _address attribute, as given in the example:

    // drivers
    dds[3]=makeDynString("NEW_DRIVER_1", "NEW_DRIVER_2");

    This text will be set in _address.._drv_ident. Example:

    // dds[3]=makeDynString("TESTDRIVER1","TESTDRIVER2");
  7. Save the script including your changes.

Now go to the next chapter Copying the template panel.