Explore Courses Blog Tutorials Interview Questions
0 votes
in RPA by (12.7k points)

First I use a "Get processes" activity which assigns its result to a variable called currentProcessesCollection which is of type Collection

Next, I want to check this condition in and If activity currentProcessesCollection.Contains("OUTLOOK")

I'm getting 'string' cannot be converted to type System.Diagnostics.Process'

I'm kind of flummoxed by this and wondering if anyone knows some other way to do this. I was kind of hoping that writing out the problem would help, it didn't. Thanks for any help in advance. I need to find out if the outlook is running.

1 Answer

0 votes
by (29.5k points)

The command currentProcessCollection contains a collection of Process objects. Similarly, 'Contains' needs another Process object in order to compare them, then you need to provide the string object "OUTLOOK.EXE".

If you wish to search whether at least one process by name exists,  you can try using a code like the following:

processCollection.Where(Function(x) x.ProcessName = "Scan").Count > 0

Browse Categories