TIA WinCC RT Advanced Status von .exe abfrage

CASE_OF

Level-1
Beiträge
3
Reaktionspunkte
1
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo,

Hardware: IPC477E
OS + Software: Windows 10 , WinCC RT Advanced V16

Folgendes Problem: Ich starte eine Anwendung (minimiert) über ein VBScript. Jetzt würde ich gerne jede Minute den Status abfragen, ob das Programm denn weiterhin in Windows 10 ausgeführt wird.

In VBScript gibt es ja eine Funktion dafür, jedoch wird diese nicht in WinCC unterstützt.

If IsProcessRunning("notepad.exe") Then
Msgbox "notepad process is running"
Else
Msgbox "notepad process is not running"
End If

Was gebe es denn noch für Möglichkeiten den Satus abzufragen?

Gruß und Danke im Voraus
 
Habe es mittels WMI geschafft, funktioniert ohne Probleme, hier als Beispiel die Software HMIOptionPlusRuntime.
Evtl hilft es ja dem ein oder anderen :)

Code:
'----------HMIOptionPlusRuntime----------
' Using WMI (Windows Management Instrumentation) Tasks: Processes
'HmiOptionPlusRuntime.exe


Dim strComputer, strProcess, isProcessRunning, strProcessName, objWMIService, strWMIQuery
 
strComputer = "." ' local computer
strProcess = "HmiOptionPlusRuntime.exe"
 
' Function to check if HmiOptionPlusRuntime is running
strWMIQuery = "Select * from Win32_Process Where Name='HmiOptionPlusRuntime.exe'"
   
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
            & strComputer & "\root\cimv2")
 
' Determine if Process is Running
If objWMIService.ExecQuery(strWMIQuery).Count > 0 Then
    SmartTags("Option+ RuntimeOK") = True
       
Else
    SmartTags("Option+ RuntimeOK") = False
    ShowSystemAlarm("HMIOptionPlus NOT running")
    'Need to verify if admin rights are necessary on HMI
    'StartProgram "C:\Program Files\Siemens\HMI Option+ IPC 1.1", ProgramParam, hmiShowMinimized, hmiNo
 
Zurück
Oben