How can I retrieve the name of the current process from within the process itself

How can I retrieve the name of the current process from within a xaml?

We are trying to centralize the location of screenshot taken by the RE-Framework. So within the TakeScreenshot.xaml, we need to retrieve the process name so that the screenshots can be dropped into a folder named after the process itself.

Hey @dbiswas check out this post: Get UiPath Robot environment name, and Process name at runtime at the Robot client - #3 by cursive

1 Like

Hi all, I’ve found a solution that I like a little better. You can use the command Process.GetCurrentProcess.MainWindowTitle

So long as your project name matches the name of the folder that it’s contained in (I sort of like that it encourages making these match).

This method also has the added advantage of providing the name of the Orchestrator environment that the job was run in. Unfortunately, I can’t find any other way to get the version, though, so if you need that the other method will be the way to go.


Follow up: Just wanted to note that we’ve recently started using the new “Background Processes” and this method doesn’t work for them.

1 Like

Be careful with MainWindowTitle. Depending upon what the automation is doing, the title can change. I just ran into an issue where the title changed to “Connection: servername” because I was connected to a mainframe.


We just updated to Studio Version 2022.4.3 and found that the name found now appends the Environment name from Orchestrator. So previously we got “Some_Process” and now it returns “Some_Process_Production” where Production is the name of our Environment. Yes, this is only for processes that do NOT run in the background. We’ve had to hard code those as I can’t find a way to get it dynamically.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.