Automating Batch Hard-Copy Printing and Export of WinCC Picture Tree Screens

Automating Batch Hard-Copy Printing and Export of WinCC Picture Tree Screens

Manually clicking the Print Screen button across 50+ process pictures in the WinCC Picture Tree is inefficient for project documentation. To automate batch printing or image export of all screens in SIMATIC PCS 7 WinCC, engineers can utilize the WinCC Documenting Tool inside Graphics Designer to batch print all PDL layouts to PDF with a single command, or implement an automated VBScript routine. The VBScript iterates through the Picture Tree hierarchy, dynamically assigns each screen name to an off-screen Picture Window, invokes the native WinCC HardCopy() C-function or screen capture API, and pauses for 2 seconds between screens, completing unattended batch exports of the entire plant graphic documentation in minutes.

Table of Contents

Challenges of Manual Screen Capture in Plant Documentation

During Factory Acceptance Testing (FAT), validation documentation (IQ/OQ), or final project turnover, engineering specifications frequently require complete hard-copy or PDF documentation of every process graphic in the plant overview structure. In a typical PCS 7 project, the Picture Tree encompasses 50 to 200 process screens (.pdl files) distributed across plant areas and units.

Relying on an operator to manually navigate to each screen, wait for tag animation, and press the runtime 'Print Screen' button is labor-intensive, error-prone, and slow. Automation engineers require unattended batch capture solutions that operate either offline in Graphics Designer or online in WinCC Runtime.

Automated Batch Printing Architectures: Graphics Designer vs VBScript

Two proven automated methods exist for batch exporting WinCC process graphics:

  1. Offline Batch Printing via Graphics Designer (Static Layouts):
    - Inside WinCC Graphics Designer, engineers can select multiple PDL files simultaneously.
    - Using the Print Documentation tool or routing to a virtual PDF printer (e.g., Microsoft Print to PDF or Adobe PDF), Graphics Designer prints the graphic layouts, object properties, and static shapes without requiring active controller communication.

  2. Online Automated Screen Capture via VBScript (Live Runtime Data):
    - To capture screens with live process values, active faceplates, and dynamic colors, an automated VBScript runs inside WinCC Runtime.
    - The script reads all picture filenames from the Picture Tree or project GraCS directory, cycles the runtime display using a master Picture Window (@ScreenWindow), pauses for dynamic tag resolution, and invokes the WinCC internal C-function HardCopy() or Windows GDI screen-capture DLLs.

Batch Hard-Copy and Export Method Comparison Matrix

The following table compares approaches for capturing full plant graphic documentation:

MethodExecution ModeCaptures Live Tag DataAutomation DegreeExecution Speed (50 Screens)Manual 'Print Screen'WinCC RuntimeYes (Live values)Zero (Manual clicking)~ 30 to 45 minutesGraphics Designer DocumentorOffline (ES)No (Static layout only)High (Single batch print)~ 3 to 5 minutesScripted VBS Runtime CaptureWinCC RuntimeYes (Live values)100% Unattended~ 2 to 3 minutesWinCC Report DesignerWinCC RuntimeYes (Cyclic reports)High (Pre-configured layouts)~ 10 to 15 minutes

Step-by-Step Implementation of the Automated VBScript Capture Tool

To deploy an unattended runtime batch screen capture script in WinCC:

  1. Configure a Virtual PDF Printer as Default:
    - In Windows Devices and Printers, set Microsoft Print to PDF or an automated PDF printer (e.g., PDFCreator with auto-save enabled) as the default printer.

  2. Create the Batch Capture VBScript:
    - In WinCC Global Script (VBS), create a project function BatchCapturePictures():
    ```vb
    Sub BatchCapturePictures()
    Dim fso, folder, file, picWindow, picName
    Dim graCSPath
    graCSPath = HMIRuntime.ActiveProject.Path & "\GraCS"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set folder = fso.GetFolder(graCSPath)

    For Each file In folder.Files
    If LCase(fso.GetExtensionName(file.Name)) = "pdl" And Left(file.Name, 1) <> "@" Then
    picName = fso.GetBaseName(file.Name)
    ' Switch picture in runtime
    HMIRuntime.Screens("@ScreenWindow").ScreenName = picName
    ' Wait 2 seconds for tag values to populate
    WScript.Sleep 2000
    ' Execute native WinCC HardCopy function
    ExecuteHardCopy
    End If
    Next
    End Sub
    ```

  3. Trigger via Pushbutton in WinCC Runtime:
    - Place a button labeled 'Export All Screens to PDF' on an engineering diagnostic screen.
    - In the click event, invoke BatchCapturePictures.
    - Click the button; the system will autonomously step through all pictures and generate PDF captures.

Verification

Verify batch capture execution:
1. Trigger the batch capture script in WinCC Runtime.
2. Observe the runtime display cycling automatically through each process screen.
3. Open the output PDF directory; confirm that a separate PDF or consolidated multi-page document is created.
4. Audit sample PDF files to verify that process graphics, tag values, alarm indicators, and unit labels are rendered with sharp resolution.

Limitations and Operational Precautions

  • Runtime Load During Cycling: Rapidly switching pictures in high-frequency loops increases OS Server tag request traffic; always enforce a 2-second sleep delay between picture transitions.
  • System Pictures Exclusion: Ensure the script filters out internal system pictures (e.g., filenames starting with @ like @Overview1.pdl or @Buttons.pdl) unless specifically required for documentation.
  • Automated PDF File Naming: When printing to PDF, configure the virtual printer for 'Auto-Save' using the picture name token to prevent Windows from prompting for a filename on every screen.

Engineer FAQ

Can I print all pictures directly from Graphics Designer without starting Runtime?

Yes. In Graphics Designer, select File -> Open, highlight all desired PDL files, and use the WinCC Documenting tool to batch-print static layouts directly to PDF.

How do I prevent the Print dialog box from appearing on every picture?

Use a virtual PDF printer that supports unattended Auto-Save (such as PDFCreator or Bullzip), configured to save files automatically using timestamp or document title parameters.

Why do some tag values show '***' or yellow exclamation marks in captured PDFs?

The sleep delay between picture load and hard copy execution was too short. Increase the delay from 2 seconds to 3 seconds to allow DataManager to complete the tag advise handshake.

Does WinCC Report Designer support batch screen dumps?

Yes. WinCC Report Designer provides the 'Hardcopy' print job layout, but scripting the picture cycle via VBS offers far greater flexibility for custom naming and folder routing.

Technical References

Related Articles

Related Tags

  • WinCC Graphics
  • Hardcopy
  • Picture Tree
  • Batch Printing
  • VBScript
6 respuestas