Is there a way to run an (external) proces in sync from UI?

Linux person here, Exploring the options of UIPath (obviously on Windows), I tried to “outsource” some tasks (in a sequence) to one or more scripts. I need to be sure however that the script is done before the sequence continues, but found (to my surprise) no option to run the script in sync, which makes it impossible to use in the sequence.
One option came into my mind, to poll for the existence of the process, to continue if not, but scripts run under their interpretor’s (process) name on Windows.
So my question: Is there a way to run an (external) proces in sync from UIPath?

1 Like

Ok, found at least one way to work around

If we make the script create a trigger file, clean it up on finishing, we can have UIPath poll for existence of the trigger file, continue if the trigger file is removed, for example:

import os
import time

# trigger file
tempfile_path = "C:/Users/Jacob/Desktop/busy"
# make sure remains from possibly broken previous runs are removed
try:
    os.remove(tempfile_path)
except FileNotFoundError:
    pass
# create trigger file
open(tempfile_path, "wt").write("")
# do a lot of stuff here
time.sleep(20)
# clean up, remove trigger file, UIPath will continue
os.remove(tempfile_path)

…and in UIPath, we set:

No need to say we probably need to set a timeout for the loop to break after x seconds, but this is the idea.

2 Likes