Identify if a Program is Running

Michael Williams
Michael Williams used Ask the Experts™
Can I identify whether or not an "exe" is currently running in lotusscript?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
I'm unfamiliar with lotusscripts, but it seems to have some tiring/reference to Visual Basic,
Potentially you could list processes and the make your determination,
Where are you running the check for a running process versus where the process is?
Michael WilliamsApplication Developer
Thanks for getting me thinking in the right way.

The following code will loop through all processes that are currently running.

	Dim objWMIService As Variant, colProcessList As Variant

	Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2") 
	Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process" ) 
	ForAll objProcess In colProcessList
		Print objProcess.Name
		If (objProcess.Name = "nlnotes.exe") Then
			'MsgBox "Process: " & objProcess.Name
			'MsgBox "Process ID: " & objProcess.ProcessID 
			'MsgBox "Thread Count: " & objProcess.ThreadCount 
			'MsgBox "Page File Size: " & objProcess.PageFileUsage 
			'MsgBox "Page Faults: " & objProcess.PageFaults 
			'MsgBox "Working Set Size: " & objProcess.WorkingSetSize 
		End If
	End ForAll

Open in new window

Michael WilliamsApplication Developer


Sometimes you just need a little feedback to point you in the right direction.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial