Automated Scheduled Screenshot and Process Graphic Printing in WinCC OS Clients

Automated Scheduled Screenshot and Process Graphic Printing in WinCC OS Clients

To automatically print or capture a scheduled screenshot of a specific process graphic on a SIMATIC PCS 7 WinCC OS Client, configure a WinCC Report Designer print job linked to a cyclic background script. In WinCC Explorer -> Report Designer -> Print Jobs, configure a print job (e.g., '@Hardcopy' or a custom job using layout '@CCScreen.rpl'). In Global Script (C-Editor), create a Global Action utilizing the function RPTJobPrint("@Hardcopy") or SSMHardCopy("@Screen.pdl"), and configure a cyclic trigger (e.g., hourly, shift-end, or daily at 06:00). To avoid physical paper waste, configure the default Windows printer as a virtual PDF printer (e.g., Microsoft Print to PDF) configured to output timestamped files to a shared network archive.

Table of Contents

Executive Summary

In continuous manufacturing facilities, utility monitoring centers, and regulated pharmaceutical production, shift management and compliance protocols frequently mandate capturing daily, hourly, or shift-end records of critical supervisory screens. While operators can manually press the 'Hardcopy' button on the WinCC title bar to print the active screen, automating this process without operator intervention presents a technical challenge. Automation engineers require a dependable method to schedule screen captures, target specific process graphics, and route the output to physical printers or automated PDF document archives. This article provides the script architecture, Report Designer configuration, and printer routing necessary for hands-free screen logging.

Architecture and Fundamental Mechanics

The screen printing and reporting architecture in WinCC operates through the Report Designer subsystem and runtime C-scripts:

  1. Report Designer Architecture (Layouts vs. Print Jobs):
    - Page Layouts (*.rpl): Located under Report Designer -> Layouts. Defines the visual formatting of the page (margins, headers, footers, logo). Siemens delivers system layouts, including @CCScreen.rpl (captures the entire monitor canvas) and @CCPicture.rpl (captures a specific designated PDL graphic window).
    - Print Jobs: Located under Report Designer -> Print Jobs. A print job binds a specific layout to an output device (printer, file, or PDF) and configures print parameters (color mode, orientation, page range). The standard system print job is @Hardcopy.

  2. Script-Driven Execution Engine (RPTJobPrint):
    - WinCC provides ANSI-C runtime API functions to command the reporting engine:
    c #include "apdefap.h" BOOL RPTJobPrint(char* lpszJobName);
    - When executed, RPTJobPrint("@Hardcopy") instructs the WinCC print manager (PrtScr.exe / CCReportEngine.exe) to capture the current screen pixels, format them into the layout, and spool the document to the Windows print queue.

  3. Split Screen Manager Hardcopy Integration (SSMHardCopy):
    - In multi-monitor PCS 7 systems, the Split Screen Manager (SSM) provides specialized functions such as SSMHardCopy(ScreenName), which allows an engineer to target a specific monitor workspace (Monitor 1, 2, 3, or 4) rather than capturing all screens simultaneously.

  4. Automated Scheduling via Global Actions: A WinCC Global Action configured with a Timer Trigger (e.g., cyclic every 8 hours, or an absolute time trigger at 06:00:00) executes the printing script automatically in the background without user interaction.

Step-by-Step Implementation Procedure

Configure automated scheduled screenshot printing using the following engineering procedures:

  1. Configure the Print Job in WinCC Explorer:
    - Open WinCC Explorer on the OS Client project.
    - Expand Report Designer -> click Print Jobs.
    - Double-click the existing print job @Hardcopy (or right-click -> New Print Job to create Scheduled_Hardcopy).
    - On the General tab, select the layout file: @CCScreen.rpl (or @CCPicture.rpl).
    - On the Printer Setup tab, select the target printer (e.g., physical network printer or Microsoft Print to PDF).
    - Click OK.

  2. Create the Automated Global C-Action:
    - In WinCC Explorer, open Global Script -> C-Editor.
    - Click Actions -> right-click and select New Action.
    - Enter the C-script code:
    c #include "apdefap.h" void OnTimerAction() { // Execute the configured hardcopy print job RPTJobPrint("@Hardcopy"); }
    - Click the Trigger button (clock icon) on the toolbar.
    - Select Timer -> choose Cyclic (e.g., every 01:00:00 for hourly captures) or Aperiodic (e.g., daily at 06:00:00 and 18:00:00).
    - Save the action as Auto_Print_Screens.pas.

  3. Enable Global Script Runtime on the OS Client:
    - In WinCC Explorer, right-click the client computer name and select Properties.
    - Select the Startup tab.
    - Verify that Global Script Runtime is checked. If unchecked, the background timer action will not execute.
    - Click OK.

  4. Configure Automated PDF Export (Paperless Printing):
    - In Windows Control Panel -> Devices and Printers, set the virtual PDF printer as default, or configure automated output file naming using tools like PDFCreator or Microsoft Print to PDF configured with a static destination folder.

Verification

Verify automated print job execution and document generation:

  1. Manual Script Test: Trigger the action manually or reduce the timer interval to 1 minute for testing. Confirm that the Windows printer queue receives the document and spools successfully.

  2. Scheduled Trigger Audit: Allow the scheduled time to pass. Verify that the printer generates the document without displaying blocking user prompts on the operator screen.

  3. Image Quality Inspection: Inspect the generated printout or PDF. Confirm that process graphics, trend curves, and alarm banners render cleanly with legible timestamps and color contrast.

Limitations and Operational Precautions

If using 'Microsoft Print to PDF' natively, Windows may display a file-save dialog requesting a filename, which blocks automated background execution. To achieve true unattended PDF generation, utilize an industrial virtual PDF printer (e.g., PDFCreator Server or Bullzip PDF Printer) configured with automatic filename formatting (e.g., <Title>_<DateTime>.pdf) and auto-save directories.

Engineer FAQ

What C-script function triggers a print job in WinCC?

The function RPTJobPrint("PrintJobName") executes the specified print job programmatically.

Can I print a specific background screen instead of the currently active screen?

Yes. By using layout @CCPicture.rpl and loading the target graphic into a hidden Picture Window before invoking the print job, you can print specific screens without changing the operator's current display.

Why did my scheduled Global Action not execute?

Ensure that 'Global Script Runtime' is checked in the Computer Startup properties in WinCC Explorer, and verify that the trigger timer is active.

How can I print multi-monitor setups cleanly?

Use the Split Screen Manager function SSMHardCopy() specifying the specific monitor workspace ID to print individual displays rather than stitching all monitors into one image.

Does automated printing degrade WinCC client performance?

Screen rasterization creates a brief CPU spike. Schedule automated captures during quiet process intervals or at shift changes rather than high-frequency cyclic rates.

Technical References

Related Articles

Related Tags

  • WinCC Printing
  • Report Designer
  • RPTJobPrint
  • Hardcopy
  • Global Script
  • PDF Export
20 respuestas