Step 2. Create a Script to Generate the Report and Print it

You will need to create a script to open the Microsoft Excel spreadsheet for your report, generate the report and print it.

  1. Expand the Basic Control Engine folder in the CIMPLICITY Workbench left pane.

  2. Double-click Scripts.

The CIMPLICITY Program Editor opens.

  1. Create the script to run the report and print it.

You can use the sample script below as a template.

  1. Compile the script and create an executable.

image\Note.gif Note: The following script opens the SQLALARM.xls spreadsheet, generates a report, and prints it. You can use it as a template for creating your own scripts:

Sub Main ()


'  This section sets REPORT_TRIGGER back to 0 so that the script doesn't continue to run.

'  This is not needed if the report is triggered directly from a CimView screen or by a

'  TIMED event in the Database Logger or Event Manager.



  PT.value = 0



'  The code from this point on is for printing.

'  This example uses one of the existing Excel spreadsheets for extracting and printing

'  the data from the cimplog.mdb alarm database.

'  You will need to customize this code so that it prints what you need. It is also

'  possible in some applications to run a specific macro from the command line.

'  You can then use the SHELL command.


  Dim Excel As Object

Set Excel = CreateObject ("Excel.Application") 


'      Open the workbook for alarm reporting "C:\CIMPICITY\REPORT\SQLALARM.XLS"



'      Run the macro to get the data

  Excel.application.Run "SQLALARM.XLS!GenerateReport"


'      Print the data




'      Quit without saving the data

  Excel.application.workbooks("SQLALARM.XLS").saved = TRUE


End Sub

More information


Automatic report printing configuration steps.