Background Process with Monitor Events from UIAutomation.Activities result in removing the background status

Background Process with Monitor Events from UIAutomation.Activities result in removing the background status.

That means. When I start a new Background process. All is fine. But I would like to use the Monitor Events activity now. So I need to add the package UIAutomation.Activities. But when I do this the Background Status of the project is gone.

But I really need that process as background process. For me it does not make any sense. Why is the background status gone when I simly add the Monitor Events? For me that’s an activity that is especially for background tasks.

I’m doing something wrong or is this a bug?

Hello @kwoxer

The concept of background automation is different. Background automation only allows to automate tasks that do not require any interfaces. These automations run in the background without showing any screens while allowing the user to continue with his work without any disturbance… So you cannot interact with any interfaces just like you do with normal automations. If you want to perform automation that require application interaction through interfaces, then you cannot use the background automation option. Additionally, you can run multiple background automation solutions at the same time where as, the other automations can only run one process at a time.

For example
Background automation + background automation = possible
Background automation + normal automation that require UI interaction = not possible

So if you are using background automation, you will have different properties in the project.json file. If you add the Ui Automation activities, then that feature will be removed automatically…

2 Likes

Thanks. But that does not make sense.

Anyway, how can I have a activity that is listening on a folder and is a background process? Is there any way?

You said I shall split it up. But actually it’s a whole process that runs in background independantally without any UI elements.

I’m not sure why the Monitor Events is in the UIAutomation.Activities package.

Could I extract the package from it?

Or is there any package that already extracted it?

I don’t want to block a whole server with running such an background task. I hope you got my point why I really need it running in background.

Hey @kwoxer

Yes I understand your point…

So can you tell me this…

You said you want to listen to a folder here… So I’m guessing you are trying to monitor a particular change in this folder, like new files, new folders etc. so that can trigger the execution… Am I correct?

or is it something different that you are trying to do?

Edit: if you are monitoring for particulat change like new file creations etc you can always use

Directory.GetFiles(FolderPath)

And capture the new files or folders created or modified. If checking for properties of files, you can do that too different other activities like getting the last modified date without the use of monitor activities…

Let’s say you want to trigger if a new file is created. You can use the above method and check whether new files are there. Then continue with the flow, if not stop the execution… like wise…

Indeed. I have a folder where my Flow of Power Automate is putting new files.

So using the Monitor Events is the easiest way. And it runs properly. I really would like to keep on using it. Instead of doing a workaround now with the “GetFiles” thing. I know I could also run a task every minute and watch for changes in the folder. But smarter would be the Monitor event. =/

And if I extract that activity from the package? Could that work and how is that possible? Is there some tutorial?

@kwoxer

I found these two articles for you… See whether it gives any light on an approach you can consider…

Not the perfect solution but it’s working now.

So I have my Main.xaml file and 2 WorkFlow files. Using them in the Parallel activity seem to work properly.

Thanks for support and hopefully this will be changed to be working as background process in the far future. I still don’t like that workaround tho.

1 Like

Yeah… I know… it is not the best way to handle it…

Let’s try to figure out a better way over the time to fix it… For now, I think it will be ok.

I am also looking for a better solution over this as I also have the same requirement. So if I come across anything, I will definitely reach out to you…

1 Like

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