You will need to create a script to open the Microsoft Excel spreadsheet for your report, generate the report and print it.
Expand the Basic Control Engine folder in the CIMPLICITY Workbench left pane.
Double-click Scripts.
The CIMPLICITY Program Editor opens.
Create the script to run the report and print it.
You can use the sample script below as a template.
Compile the script and create an executable.
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.
'
Dim PT As New point
PT.id ="\\PROJECT\REPORT_TRIGGER"
PT.value = 0
PT.set
'----------------------------------------------------------------------------------------
' 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
Excel.application.workbooks.open "C:\CIMPICITY\REPORT\SQLALARM.XLS"
Excel.application.workbooks("SQLALARM.XLS").activate
'
' Run the macro to get the data
Excel.application.Run "SQLALARM.XLS!GenerateReport"
'
' Print the data
Excel.application.workbooks("SQLALARM.XLS").worksheets("Data").activate
Excel.application.workbooks("SQLALARM.XLS").activesheet.printout
'
' Quit without saving the data
Excel.application.workbooks("SQLALARM.XLS").saved = TRUE
Excel.application.quit
End Sub
Automatic report printing configuration steps. |