Start Process Actitiy with Synchronously Option

Hello UiPath Developer Team,

here a tiny suggestion for your Start Process Activity:
This activity executes applications or opens documents asynchronously. After the process is started, the automation workflow continues without waiting for a possible result of the process. My suggestion is to add a checkbox to decide if this activity is asynchronously or synchronously and to add an int32 field for a time out.

At the moment I use this Invoke Code as workaround:

//-Begin----------------------------------------------------------------
//-
//- Launches a specific application or file synchronlously
//-
//- Arguments:
//- string FileName = The full path and name of the application to
//-                   execute or file to be opened
//- string Arguments = The parameters that can be passed to the
//-                    application at startup
//- string WorkingDirectory = Path of the current working directory
//- int32 TimeOut = System.Threading.Timeout.Infinite (-1) or
//-                 milliseconds to wait for the process to exit
//-
//----------------------------------------------------------------------

string currentWorkingDirectory = Environment.CurrentDirectory;
if(!string.IsNullOrWhiteSpace(WorkingDirectory)) {
  Environment.CurrentDirectory = @WorkingDirectory;
}

ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = @FileName;
processStartInfo.Arguments = @Arguments;
processStartInfo.UseShellExecute = true;

Process process = Process.Start(processStartInfo);
if(process.WaitForExit(TimeOut) == false) {
  //-Optional to avoid endless processes--------------------------------
  //process.Kill();
};

Environment.CurrentDirectory = currentWorkingDirectory;

//-End------------------------------------------------------------------

It uses exactly the same interface as the Start Process activity with an additional time out parameter.

Thanks for your support and best regards
Stefan

1 Like

Thanks @StefanSchnell . Makes sense, I’ll take it into the backlog.

2 Likes

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