14-04-21 01:04 AM
Hello everyone,
Working with many RPA developers over only a few Virtual Machines(VM), there will often be 3-5 people on the same VM running the same process, e.g. "iexplore".
We all occasionally run into some calculation & decision issues on:
1. BO: Utility - General, ACTION: Process Exists, then
2. BO: Close Process Window. (this is an in-house BO that loops to close all but 1 window of an application)
I'm not allowed to mess with step two of the logic, which leaves me with step one. Is there an object/way to determine "Process Exists by User Name"? Is the only solution using VBA, and if so can anyone point me in the direction of some copy/paste magic?
14-04-21 05:11 AM
14-04-21 08:12 AM
var currentSessionId = Process.GetCurrentProcess().SessionId;
var process = Process.GetProcessesByName(processName).FirstOrDefault(p => p.SessionId == currentSessionId);
exists = process != null;