Running UI path task through command line from a .net process

uiautomation
robot
cmd

#1

Hi,

I am facing issue in running UI path task through command line from a .net process. Below is what I do :

string command = "C/UiPath/UiRobot.exe" +"/file:"+"Main.xaml";
Process process = new Process();
process.EnableRaisingEvents = true;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.Arguments = "/C " + command;
process.StartInfo = startInfo;
process.Start(); 

Above code can run UI path task of all types except when UI path task involves an activity which uses image to look up element on screen. For example below is sample task which clicks on windows logo on screen
uipathissue

In case of above task the .net code does not run task reliably. It runs the task sometimes and sometimes it throws below error

UiPath.Core.ElementOperationException: Timeout reached. ---> System.
Runtime.InteropServices.COMException: Timeout reached.
   at UiPath.UiNodeClass.Click(Int32 dx, Int32 dy, UiClickType clickType, UiMous
eButton mouseBtn, UiInputMethod inputMethod)
   at UiPath.Core.UiElement.Click(Int32 offsetX, Int32 offsetY, ClickType clickT
ype, MouseButton mouseButton, InputMethod inputMethod, Position mousePlacement)
   --- End of inner exception stack trace ---
   at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext
faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
   at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultC
ontext faultContext, Exception propagatedException, ActivityInstance propagatedF
rom)
   at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(Activ
ityExecutor executor, BookmarkManager bookmarkManager) 

It works all the time for all other tasks which does not involves any element looking on screen by using its internal OCR engine. Not sure what the issue is. Would be appreciative if any one can help me on this.

I am using UiPath community edition version 2017.1.6522.

Thanks