| name | wincc-rtpro-manual-vb-loop |
| description | Use when working with Siemens WinCC RT Professional upper-computer VB scripts in TIA Portal where script import is not exposed or not reliable, especially to generate manual paste files, list only the modified VB sections for the user to fill in, then verify the pasted result, RT Pro script snapshots, SQL/archive/display bindings, and HMI compile until the human-assisted import/export loop is closed. |
WinCC RT Professional Manual VB Loop
Use this skill for WinCC RT Professional PC-station projects when VB script source
cannot be imported through Openness. The operating model is human-assisted:
Codex prepares the exact changed text, the user pastes it in the TIA/WinCC
editor, then Codex verifies the result and repeats until the loop is closed.
Project Isolation
When running from D:\skills\codex\Tia, treat this project as authoritative.
- Use local helper skill first:
D:\skills\codex\Tia\skills\tia-openness-bag-pulse.
- Use local knowledge first:
D:\skills\codex\Tia\knowledge\tia_sanjiu_learning.
- Keep generated handoff files, snapshots, logs, and verification evidence under
D:\skills\codex\Tia.
- Do not use other workspaces or global same-named skills as source material
unless the user explicitly approves mixing sources.
Core Boundary
For WinCC RT Professional, do not assume TP1200 Comfort script import/export
APIs exist. In the verified local RT Pro pattern, Openness can compile the HMI
device but does not expose HmiTarget, VBScriptFolder, or TagFolder.
Default to interaction mode for all RT Professional VB source operations:
Codex generates full and body_only handoff files, the user manually fills or
pastes the body in TIA/WinCC, and Codex only reads back, verifies, and compiles.
Do not directly send Ctrl+A, Ctrl+V, Delete, typing, or keyboard-driven body
replacement into the RT Professional VB editor unless the user explicitly
authorizes that specific write action in the current turn.
Never patch these as editable source:
ScriptLib\*.bmo
ScriptAct\*.bac
Config\USEDVBSMODULES.CVB
Treat them as snapshot and hash evidence only.
Workflow
- Run the multi-monitor preflight before any UI operation.
- Identify the RT Professional device and project folder from the open TIA
Portal project or from the user's provided path.
- Read the local references in the project-local helper skill:
references/wincc-rt-professional-scripts.md
references/wincc-rtpro-data-record-vb.md when archives, data records, or
display fields are involved.
- Get current VB source from the TIA editor or a user-provided text export.
Save that source as evidence under the output root.
- Generate two manual handoff files:
*_full_*.vbs: complete script for review.
*_body_only_*.vbs: only the text between Sub Name() and End Sub.
Write paste files as UTF-8 without BOM and remove any U+FEFF character from
the body. A hidden BOM pasted after Sub ...() can make WinCC compile fail
with an empty error message.
- Report the exact modified lines or block. The user pastes only the
body_only content between the fixed skeleton lines in the RT Pro editor.
- After the user confirms the paste, copy or receive the current editor source
again and verify that the actual editor text matches the generated change.
- Compile the active RT Professional target only after confirming the target
object is active.
- If verification fails, list the smallest next manual change and loop again.
Multi-Monitor Preflight
The user's Windows workstation can have two or more monitors. Always inspect
the monitor layout and target window placement before any coordinate-based UI
operation. Do this first, even when a screenshot is visible.
Run:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\wincc-rtpro-manual-vb-loop\scripts\inspect-window-screens.ps1"
Rules:
- Record each screen's
DeviceName, Primary, Bounds, and WorkingArea.
- Negative X coordinates are normal when a secondary monitor is placed to the
left of the primary monitor.
- Locate Codex, PowerShell, TIA Portal, WinCC, and Script/VB editor windows by
process name and title.
- Determine which screen contains the center of each relevant window.
- Do not use hard-coded click coordinates from a previous run.
- If Codex and TIA/WinCC are on different screens, all clicks and screenshots
must be based on the target window rectangle, not on the active Codex window
or the primary screen.
- If the target window cannot be located or is minimized, stop and ask the user
to bring the TIA/WinCC editor window into view before attempting UI actions.
Manual Paste Rule
The TIA/WinCC editor owns the outer skeleton:
Sub DATA_Auto_CSV()
End Sub
Ask the user to delete and replace only the body between the first Sub ...()
line and the final End Sub. The body-only file must not contain any Sub
line or End Sub line.
Codex may use keyboard shortcuts such as Ctrl+A and Ctrl+C only for readback
verification after the user has pasted. Do not use Ctrl+A plus Ctrl+V as the
default edit path for RT Professional VB scripts.
Handoff Command Pattern
Use the project-local helper script from this workspace:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\tia-openness-bag-pulse\scripts\new-rtpro-vb-manual-fill-files.ps1" `
-SourcePath ".\tia_rtpro_learning\exports\DATA_Auto_CSV_original_current.vbs" `
-OutputRoot ".\tia_rtpro_learning" `
-ScriptName "DATA_Auto_CSV"
For the known DATA1 environment-field pattern, add -AddEnvironmentField.
Source Structure Verification
After the user pastes the body and provides or exposes the current editor text,
run this skill's structure checker:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\wincc-rtpro-manual-vb-loop\scripts\verify-vb-body-structure.ps1" `
-SourcePath ".\tia_rtpro_learning\manual_fill\DATA_Auto_CSV_after_paste.vbs" `
-ScriptName "DATA_Auto_CSV" `
-RequireLine @('Dim TagName(9),iLen', 'TagName(9) = "DATA1\<field name>"')
The checker must confirm:
- exactly one matching
Sub ScriptName() line
- exactly one final
End Sub after that Sub
- no nested
Sub or End Sub inside the pasted body
- all requested required lines are present
Also compare the actual pasted change with the generated handoff text. For
small edits, verify the required lines exactly. For full-body handoffs, compare
the body text after normalizing line endings and removing U+FEFF. Do not
proceed to compile if the pasted editor text differs from the generated handoff
text.
Lean Verification
Do not spend time on extra evidence by default.
- Do not wait a fixed 30 seconds after
Ctrl+B.
- Do not take screenshots merely as proof.
- Do not export RT Pro script snapshots merely as proof.
- Do not hash
.bmo or .bac artifacts merely as proof.
- Verify only: the pasted editor text matches the generated text, there is no
hidden U+FEFF, structure checks pass, and compile reports no errors.
- Use screenshots or artifact snapshots only when the user asks for them or when
a failure needs visual diagnosis.
RT Pro Verification
For snapshots, only when explicitly requested or needed to diagnose a failure:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\tia-openness-bag-pulse\scripts\export-rtpro-script-snapshot.ps1" `
-ProjectRoot "<RT Pro project folder>" `
-OutputRoot ".\tia_rtpro_learning"
For HMI compile:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\tia-openness-bag-pulse\scripts\compile-rtpro-hmi-device.ps1" `
-OutputRoot ".\tia_rtpro_learning" `
-DeviceName "HMI-5X"
Compilation is allowed, but do not use coordinate clicks to start it. In this
workspace, compile-rtpro-hmi-device.ps1 has been observed to compile the
current HMI-5X RT Professional device successfully and then leave the already
open TIA UI window closed/disappeared after the attached Openness session is
disposed. Do not use that script as the default verification path when the user
needs Portal to stay open. If the correct TIA editor/object is already active,
use the verified TIA shortcut Ctrl+B for "Compile object". Ctrl+B compiles
only the currently active object: PLC when a PLC program/block is active, RT
Professional when an RT Professional object is active, TP1200/HMI when that HMI
object is active, and nothing meaningful if no compilable object is active.
Before treating a Ctrl+B run as proof, verify that the RT Professional target
object is active from the visible editor, selected project-tree item,
status/output pane, or user confirmation. After Ctrl+B, check the compile
status/output promptly; do not use a fixed delay. Never send Alt+F4,
Ctrl+W, Ctrl+F4, or Ctrl+Shift+F4 during verification unless the user
explicitly asks to close a window or project.
For DATA1 field changes, use the project-local verifier:
powershell -NoProfile -ExecutionPolicy Bypass -File "D:\skills\codex\Tia\skills\tia-openness-bag-pulse\scripts\verify-rtpro-data-record-field.ps1" `
-ArchiveName "DATA1" `
-FieldName "<field display name>" `
-ProcessTag "<process tag name>" `
-DisplayTagPrefix "<display tag prefix>" `
-ScreenName "<screen name>"
Reporting
Always report:
- local skill path used
- local knowledge path used
- script name and target RT Pro device
- generated
full and body_only file paths
- exact modified lines or body section for the user to paste
- pasted-text match result
- structure-check result
- HMI compile result
- whether the loop is closed or what exact manual edit remains
Do not say the path is closed until the pasted source is verified and the HMI
compile returns success.