Loads a batch file into a text box | Runtime Script | WinCC Unified

Gratis

Creado con el generador IA de HMIx

Este recurso se ha creado con IA en ai.hmix.tech. Describe lo que necesitas y genera tus propios controles HMI en minutos — gratis.

WinCC Unified Runtime Script

When the button is pressed, it reads the file batch.txt from the device running the Runtime. It shows the text in Txt_Batch and reports progress in Batch_Status.

Minimum version: WinCC Unified V20 and later.

What starts it and where it goes

When the button Btn_LoadBatch is tapped.

In the event OnTapped of the object Btn_LoadBatch.

How it works

  • Names the file to read. Sets the path of batch.txt on the device that runs the Runtime.
  • Turns a failure into words. Defines a helper that describes a failure in plain text, for a Runtime error code or a script error.
  • Tells the operator it is loading. Writes "Loading..." to Batch_Status.
  • Asks the device to read the file. Starts reading the file; the rest carries on and the answer comes later.
  • Shows the text and reports success. Puts the text in Txt_Batch, notes the number of characters in the trace and writes "Batch loaded" to Batch_Status.
  • Reports a failed read. Notes the failure in the trace and writes the reason to Batch_Status.

Values you adapt

  • Batch file path: Full path of the file on the device that runs the Runtime. (in the script: C:\Users\Public\batch.txt)
  • Status tag: HMI tag that shows the loading state. (in the script: Batch_Status)
  • Text box: Screen object that shows the file text. (in the script: Txt_Batch)

Minimum version

Minimum version: WinCC Unified V20. It runs on WinCC Unified V20 and every later version; older versions were not checked. Its folders are those of a PC with Windows.

  • GetDetailedErrorDescription: From V20 (Siemens' object model; older versions not checked)
  • Tag.Write: From V16 (Siemens' V16 system manual)
  • FileSystem.ReadFile: From V16 (Siemens' V16 system manual)
  • ScreenItems.Item: From V16 (Siemens' V16 system manual)
  • Trace: From V16 (Siemens' V16 system manual)

In the package

  • The script, with a header that says where it goes and which values to adapt.
  • Its documentation as PDF and as an editable ODT: purpose, example, the TIA Portal steps, the script part by part.
  • A README with the same in one page.

⚠️ AI-Generated: This script was written with AI and checked against Siemens' documentation, not on a device. Test it on your own HMI before using it in production.

Compartir este recurso:
Versión:v2
Última actualización:4 dic 2026
Publicado:4 dic 2026
Diseño:SIEMENS - SIMATIC
Etiquetas:

Reseñas del producto (0)

Preguntas y respuestas (0)

También te puede interesar

Gratis