Finding Script Usage in WinCC V7.4 Projects Cross-Reference Guide

David Krause12 min read
SiemensTutorial / How-toWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Finding Script Usage in WinCC V7.4 Projects: Cross-Reference Guide

When maintaining or refactoring a Siemens WinCC V7.4 or V7.4.1 SCADA project, engineers routinely need to answer a single question: where is this script used? Unlike the TIA Portal, which provides a unified "Cross-references" view across PLC, HMI, and script objects, WinCC V7.4 distributes its scripting engine across several editors and runtime databases. Locating every call site of a VBScript or ANSI-C procedure therefore requires combining Report Designer output, project tree inspection, and runtime diagnostics. This guide consolidates the official Siemens methods into a single workflow for engineering teams, integrators, and commissioning engineers.

Scope: This document applies to WinCC V7.4 and V7.4.1 with the WinCC Scripting option installed. It does not cover WinCC Professional (TIA Portal) or WinCC Unified, which use a different cross-reference engine.

1. WinCC V7.4 Scripting Architecture Overview

WinCC V7.4 supports two parallel scripting technologies, each with its own project tree node, editor, and runtime container:

Technology Project Tree Node Editor Runtime Engine
VBScript (VBS) Global Script → VBS VBScript Editor VBScript runtime (cscript host)
ANSI-C Global Script → C C Editor (with IntelliSense) WinCC C-Runtime (GSC Runtime)

A complete cross-reference search must inspect both branches, because a single HMI event can call a project function in either language. Scripts can be attached to:

  • Graphics Designer object events (mouse click, value change, dialog open/close)
  • Tag management actions (on change, on limit violation)
  • Scheduler / Time-triggered actions (cyclic, daily, weekly)
  • Alarm logging acknowledgment and message procedures
  • Tag Logging scripts (open/close archive, calculation)
  • User archive callbacks
  • Report Designer print jobs (VBS only)
  • Global Script actions invoked from C or VBS via HMIRuntime or PDLRT APIs

Reference: WinCC V7.4 Scripting: VBS, ANSI-C, VBA (Entry ID 109736230).

2. Prerequisites for Cross-Referencing Scripts

Before running the procedures below, verify the following on the engineering station:

  1. WinCC V7.4 or V7.4.1 installed, including the "WinCC Scripting" option (added during install or via Setup → Modify).
  2. Project opened in WinCC Explorer with write access to the project directory.
  3. Report Designer installed (default with WinCC). The Report Designer appears under "Graphics Designer" siblings in the WinCC Explorer navigation tree.
  4. For ANSI-C cross-references, the C Editor must be openable. Confirm by double-clicking "Global Script → C" in the project tree.
  5. Local administrator rights on the engineering station; Report Designer writes a temporary PDF into the project folder.
If the project was migrated from WinCC V7.0/V7.1/V7.2/V7.3, run the migration report first. Inconsistent project state can cause Report Designer to skip documents. Open WinCC Explorer → Tools → Project Migration Status.

3. Report Designer Project Documentation (Recommended Method)

The Report Designer is the only built-in tool that produces a comprehensive, machine-readable inventory of all WinCC objects, including scripts. For script discovery specifically, two of the supplied layout templates are essential.

3.1 Available Documentation Layouts for Scripts

Open the Report Designer (right-click "Report Designer" in the WinCC Explorer tree → Open). The following system layouts directly enumerate scripts and their call sites:

Layout Name Scope Output Content
@Documentation Global Script Actions Both VBS and C All scheduled/triggered actions, including cycle time, trigger tag, and the function called.
@internal Global Script Project-function Both VBS and C All project functions (header, parameters, return type, internal calls).
@Documentation Pictures Graphics Designer Lists events configured on every object of every picture, with the script type (VBS/C) and function name.
@Documentation Tag Connections Tag Management Tag events firing scripts (on change, on limit).
@Documentation Alarms Alarm Logging Message procedures calling scripts.
@Documentation Report Report Designer Print jobs (VBS) attached to a schedule or button.

3.2 Generating the PDF

  1. In WinCC Explorer, right-click Report Designer → Open.
  2. In the navigation tree, expand Layouts → System Layouts. The two script layouts appear as @Documentation Global Script Actions and @internal Global Script Project-function.
  3. Open the Print Job tree, right-click the print job you intend to bind (typically @Report Viewer for on-screen display), and select Properties.
  4. Set the Layout field to the desired documentation layout.
  5. Trigger the print job manually (right-click → Print Preview) or call it from a temporary button to produce a PDF in \<Project>\<Computer>\PrintJobs.
Output path: The generated PDF is stored in the project runtime folder. Typical default: C:\Program Files (x86)\Siemens\Automation\WinCC\WinCCProjects\<ProjectName>\<ComputerName>\PrintJobs\. The file name matches the print job name with a timestamp.

3.3 Interpreting the Cross-Reference Output

For @Documentation Global Script Actions, each row contains:

  • Action name (e.g., Aktion_1)
  • Trigger type (cyclic / tag trigger / time-of-day / event)
  • Cycle / trigger tag
  • Function called (e.g., MyProjectFunction(arg1))
  • Script language (VBS or C)

For @internal Global Script Project-function, each row contains:

  • Function name
  • Parameters and return type
  • Body excerpt (first 200-400 characters; full source is not in the PDF)
  • Internal references (calls to other project functions)

Use both layouts together: the actions report tells you what fires the script, the project-function report tells you what the script does and which other functions it calls.

4. Manual Inspection in the Graphics Designer

When you need a quick answer for a single picture (e.g., "what does StartScreen.pdl call?"), the Graphics Designer provides immediate, visual feedback.

  1. Open the target picture in Graphics Designer.
  2. Right-click any object → Properties → tab Events.
  3. Each event row shows the configured action. An event with a configured script displays the script language (VBS / C) and the function name in column "Action name".
  4. Hover the action; the tooltip shows the full function name including parameters.
  5. To navigate to the function definition, right-click the action and select Go to (only available in VBS editor for project functions).
In WinCC V7.4, the Graphics Designer does not offer a "find usage" command on a script name. You must search each picture manually or use the grep workflow in Section 6.

5. Global Script Editor Self-Search

Both Global Script editors include a built-in Find References (or similar) feature, but its scope is limited to the active project and the same scripting language.

5.1 VBScript Editor

  1. Open Global Script → VBS in WinCC Explorer.
  2. Open the project function or standard module.
  3. Position the cursor on the function or procedure name.
  4. Press F12 (Go to Definition) to jump to the declaration; press Shift+F12 to see local references within the same module.
  5. Use the toolbar icon "Find All References" (binoculars) to enumerate references in the current file. Note: this only scans the active VBS module, not the entire project.

5.2 ANSI-C Editor

  1. Open Global Script → C in WinCC Explorer.
  2. Open the function header.
  3. Right-click the function name → Find All References. The C editor searches all *.c and *.h files in the project.
  4. Results appear in a list at the bottom of the editor. Double-click a result to jump to the call site.

The C editor's "Find All References" is more powerful than the VBS equivalent because the C compiler maintains a symbol table across all source files. The VBS editor's reference search is lexical and limited to the open module.

6. File-System Search (Last Resort / Comprehensive)

Because the project is a folder of text files, you can use OS-level search tools to find any string in seconds. This is the most complete method and the one used by veteran WinCC integrators.

6.1 Project Folder Layout

Default project root: C:\Program Files (x86)\Siemens\Automation\WinCC\WinCCProjects\<Project>\

Subfolder Content Search Hint
GraCS\ Graphics Designer picture files (*.pdl) Search for the function name in *.pdl (XML-like format)
Library\ Project library (master pictures, symbols, scripts) Search for the function name in *.pdl, *.c, *.pas
PAS\ Global Script VBS source files (*.pas, *.bas) Search for procedure name
GSC\ Global Script C source files (*.c, *.h) Search for function name
TTL\ Tag Logging archive configurations Search for script references in *.cdf
ALG\ Alarm Logging configuration Search for script references in *.scf

6.2 PowerShell Example

Use the following PowerShell one-liner to enumerate every picture that references a VBS function named MyFunction:

Get-ChildItem "C:\Program Files (x86)\Siemens\Automation\WinCC\WinCCProjects\<Project>\GraCS\*.pdl" -Recurse | Select-String -Pattern "MyFunction" | Select-Object Path, LineNumber, Line | Format-Table -AutoSize

6.3 Limitations

  • PDL files are binary in WinCC V7.2 and later for compiled pictures; the source XML is regenerated only on save. Search only *.pdl if the project was opened and saved at least once in V7.3+.
  • Function names are case-sensitive in C, case-insensitive in VBS. Match your search accordingly.
  • Dynamic calls via HMIRuntime.Screens("Screen_1").ScreenItems(...) cannot be resolved statically. Use runtime logging instead (Section 7).

7. Runtime Diagnostics (GSC Diagnostics Window)

For applications that build function names at runtime, static analysis misses call sites. Use the WinCC GSC diagnostics tool to log every script invocation at runtime.

  1. On the WinCC runtime computer, open WinCC Explorer.
  2. Select menu Tools → Global Script Diagnostics (sometimes labelled "GSC Diagnostics").
  3. In the diagnostics window, enable Trace Active and Trace Function Calls.
  4. Start runtime and exercise the screens. Every C function call appears in the trace with timestamp, calling script, and arguments.
  5. Export the trace to *.txt for offline analysis.

The GSC Diagnostics window corresponds to the ANSI-C runtime only. For VBS, enable VBS Debug Mode via Computer → Properties → Graphics Runtime → VBS Debug; calls are logged to WinCC_VBS.log in the project directory.

8. Script Discovery Workflow (End-to-End)

Combine the methods above into a single repeatable procedure:

  1. Start with the Report Designer: Generate @Documentation Global Script Actions and @internal Global Script Project-function. These two PDFs cover ~85% of the call graph.
  2. Open each picture referenced in the report and verify event bindings via Graphics Designer Properties → Events tab.
  3. Use the C Editor for ANSI-C functions: right-click → Find All References covers all *.c / *.h files in the project.
  4. Use PowerShell grep across the entire project folder to catch indirect references in PDL, SCF, and CDF files.
  5. For uncertain dynamic calls, run GSC Diagnostics and VBS Debug logs in runtime for 1-2 hours to confirm the true call path.
  6. Document the result in a spreadsheet: Function name | Type | Call sites | Owner | Last modified. This becomes part of the project's engineering baseline.

9. Verification: Confirming a Refactor Is Safe

After identifying all call sites, you can safely modify a script only when:

  • The Report Designer output shows zero "stale" actions pointing to the function (i.e., no action lists the old function name).
  • Graphics Designer event bindings on every referenced picture are updated to the new function signature.
  • The C Editor "Find All References" returns zero hits for the old symbol.
  • PowerShell search of the project folder returns zero hits for the old function name (excluding comments).
  • Runtime test: enable GSC Diagnostics and VBS Debug, run the system through all operator scenarios, and confirm zero "function not defined" or type mismatch errors.

10. Cross-Reference Limits in WinCC V7.4 vs TIA Portal

Engineers familiar with TIA Portal often expect a single "Cross-references" view. WinCC V7.4 has no equivalent because the script engines predate TIA's unified database. The table below summarizes the difference:

Feature TIA Portal (WinCC Unified/Comfort) WinCC V7.4
Cross-reference of script → caller Yes (compile-time symbol table) Partial (Report Designer + C Editor only)
Cross-reference of tag → script Yes Tag Management action report only
Dynamic call resolution Limited (lint warnings) Not supported (runtime logging required)
Library cross-reference Yes Not built-in (manual search required)

For new projects targeting full TIA cross-reference capability, consider WinCC Unified V18+ (TIA Portal). The classic WinCC V7.4+SPx line remains the right choice for migration of legacy installations.

11. Troubleshooting Matrix

Symptom Likely Cause Resolution
Report Designer layout list is empty WinCC Scripting option not installed Run Setup → Modify → enable "WinCC Scripting"; re-open the project.
Layout generates blank PDF Project not compiled or not opened in runtime Open the project at least once on the local computer; re-trigger the print job.
Layout missing @Documentation Global Script Actions WinCC version < V7.0 or layout manually deleted Restore default layouts by re-running Setup → Repair.
PDL file is binary, search returns nothing Picture compiled for runtime Open the picture in Graphics Designer and save once; source XML is regenerated.
C Editor "Find All References" returns zero hits for a known function Function defined in a different module not compiled in the project Add the source file to the Global Script C project tree and compile.
VBS Editor reports "function not defined" at runtime Procedure declared in a standard module not enabled in the project Open Project Properties → Global Script → VBS → enable the module checkbox.
GSC Diagnostics window blank Trace not activated before runtime start Open GSC Diagnostics, enable Trace, then start WinCC Runtime.

12. FAQ

Does WinCC V7.4 have a built-in cross-reference tool like TIA Portal?

No. WinCC V7.4 has no unified cross-reference view. You must combine the Report Designer layouts (@Documentation Global Script Actions and @internal Global Script Project-function), the C Editor "Find All References", and PowerShell folder search to reconstruct the call graph manually. See the official WinCC V7.4 Scripting manual for the available editors.

How do I find every place a specific VBS procedure is called?

Open WinCC Explorer → Report Designer → System Layouts → @internal Global Script Project-function and trigger a print to PDF. The report lists every project function and its internal references. For external references, also generate @Documentation Global Script Actions and search the \GraCS folder with PowerShell for the function name. Expect case-insensitive matches in VBS files (*.pas, *.bas).

What is the difference between VBS and C-scripts in WinCC V7.4 for cross-referencing?

ANSI-C is compiled, so the C Editor maintains a symbol table and its "Find All References" searches every *.c and *.h file in the project. VBS is interpreted and the VBS Editor's reference search is limited to the active module. For complete VBS coverage, rely on Report Designer output and folder search instead of the editor's lexical search.

Can I document the entire project to PDF in one step?

Yes. In Report Designer, create a custom print job that uses the master layout @Documentation Overview. This layout aggregates the picture, tag, alarm, and script documentation in a single PDF. Adjust the print job's page setup to A3 or A4 landscape for readability. The PDF is saved under \<Project>\<Computer>\PrintJobs with a timestamp filename.

Why does a PDL file show binary content and not searchable text?

WinCC V7.2 and later compile pictures into a binary runtime format to improve Graphics Runtime performance. The source XML is preserved only in the working project. To regenerate the source XML, open the picture in Graphics Designer and save it once. After that, the file is searchable with PowerShell Select-String.

How do I find dynamically dispatched script calls (e.g., via HMIRuntime.Screens)?

Static analysis cannot resolve these. Enable VBS Debug Mode in Computer → Properties → Graphics Runtime → VBS Debug and the GSC Diagnostics window from Tools → Global Script Diagnostics. Run the system through all operator scenarios and inspect the resulting WinCC_VBS.log and GSC trace to confirm the true call path before refactoring.

Back to blog