Start Process activity, how to best wait for completion

Hi All,

I’m trying to automate some processes that requiring calling .bat files and .exe files sequentially. when the UIPath process runs it launches them all sequentially, but does not wait so they all end up running in parallel.

I hate using delay as the execution time may vary. I have tried Wait Element vanish with some success, but sometimes this works on my laptop while testing, but not on the un-attended robot where it needs to execute. Is there a best practice for running console type apps and waiting for completion before moving on in UiPath?

Thanks

Hi,

How about Trigger Scope and Process End Trigger as the following?

It will wait until specific process terminate.

Regards,

1 Like

I don’t seem to have Trigger Scope. I’m running 2020.10.4 Enterprise.

image

Hi,

Which version of UiPath.System activities package do you use?

Regards,

Updating UiPath.System got me the Trigger Scope activity and it works, but it does not seem to be reliable. Some jobs run super quick if there happens to be nothing to do at this moment. If the jobs run quick it actually can end before the Trigger Scope starts. Even for long running jobs on test it works fine, but on the un-attended robot I saw once it race ahead before the previous step finished, but then I couldn’t replicate it. I’m not sure I can trust this. I can of course build it into one big .bat file, but that can be cryptic to the rest of the team who are not developers. Showing the steps in UiPath helps visualize the flow. I need to reliably run sequential jobs one after the other, execution times could be less than 1 second or 5+ minutes.

Hey @rogerfries

Two dimensions in your question…

  1. Why Wait Element Vanish not working during un-attended mode?
    Check Robot resolution in the orchestrator before triggering the process inside remote machine. Normal resolution is 1920 * 1080.

  2. Alternate for delay
    You can try using do-while loop, add element exit inside the loop. And make element exist = true in the condition so as sooner element disappears loop will end.

Br,
Goutham

Goutham,

Thanks for your comments.

Why Wait Element Vanish not working during un-attended mode?
Imust wait because the download from system A before I can transform it with a python program and that transformation must be complete before the upload to system B can start. These tasks must be done one at a time in order.

The resolution comment seemed promising, but I checked and it is 1920x1080 as is in orchestrator and the machine I have Studio on.

I even tested with the studio on the robot and works fine while testing, but once published it ignores the Wait Element Vanish. Nothing seems to work reliably! I have pushed 24 versions that all test good. I’ve wasted too much time on this. I’ll create a single .bat file and use a worst case estimate delay to reserve the time so the next job doesn’t kill it. The do loop idea, just seems to be another way to do the same thing.

I do like this product, but you just get stuck for hours on tiny sticking points and the process working in test is no indication it will work in the production un-attended robot.

Thanks for trying

Couple of things that might help:

  1. Use “invoke power shell” activity to call your bat file or exe. It should wait for completion before moving on.

  2. “wait element vanish” should be executed only after that element has appeared. Add a few seconds delay before that. Depending on timing, it’s possible that the console window took longer to come up and uipath assumed element already vanished.

Hi,

Another solution:

We can use Process.Start method and HasExited as the following. Can you try this?

img20210501-1

Regards,

Winner winner chicken diner!

PowerShell worked, but you must use the -Wait property or it still races on. This is a beautiful one block solution Thanks! I bet the Start-Process is exactly what UiPath is using for it’s start Process activity, but they don’t expose the -Wait property.

Invoke Power Shell:
“Start-Process -FilePath C:\MyPath\MyBatchFile.bat -Wait”

You also must tick the IsScript checkbox.

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