How to invoke UiPath xaml in UiPath Debug mode file from PowerShell script?

How can I call a UiPath workflow from Powershell and run the UiPath workflow in Debug mode?

In other words, I want to run the script as though I click the UiPath Debug command, while using the exact parameters passed from the Powershell script. Any UiPath workflow breakpoints should suspend the workflow and show the UiPath Debug Gui to permit debugging.

My current Powershell script uses the sample syntax:

param ([string] $Title = “c:\public\myFile.txt”)
$robotPath = $env:UIPATH_USER_SERVICE_PATH -Replace “UiPath.Service.UserHost.exe”, “UiRobot.exe”
&$robotPath execute --process MyUiPathWorkflow --input “{‘Title’ : ‘$Title’}”

To illustrate this question, I want to:

  • Call the UiPath workflow from Powershell
  • Set a UiPath breakpoint in the UiPath workflow
  • View the value of the argument: Title
  • There could be multiple arguments that are passed into the workflow.

Note: I do NOT want to use message boxes or log entries to see the variable’s values. This is because I may want to do other things (in the immediate window) while the UiPath script is paused, and before I publish the workflow.

@grosner Instead of calling UiPath Workflow from Powershell, you can call Powershell from UiPath. Use the below docs and videos

Video1

Video2

Doc1

@ushu thanks. Can you kindly explain how calling Powershell, from UiPath, enables debugging the UIPath Script (that the Powershell script is calling)?

UiPath->Powershell->call to UiPath workflow I want to debug.

1 Like

Hey @grosner

Looks interesting need. If you can explain the scenario as well will be great info.

And regarding the solution for this, I see few workarounds let me check and confirm.

Thanks
#nK

Hi @grosner,

This part might be the most challenging to achieve as the UiRobot.exe will ignore any existing breakpoints in your code.

I do believe the Studio exe has specially methods which the UiRobot.exe does not. Especially with debug operations.

UiRobot.exe works great with assistant and external triggers say from PowerShell or CMD and can run process.

Let’s see if someone else has a workable solution for debugging when using UiRobot.exe

Hey @grosner

Here you go…

$wshell = New-Object -ComObject wscript.shell;

$wshell.Run("<Project main file(as in json) path>")

#using static delay as of now
Start-Sleep -s 60

#activate UiPath studio
$wshell.AppActivate('<Project Name as in json> - UiPath Studio')

Start-Sleep -s 3

#Send hotkey F6 for debug
$wshell.SendKeys('{F6}')

The static delay can be replaced with dynamic process check if that is launched

Hope this helps.

Thanks
#nK

Thank you. Use your approach, how can I pass in a some arguments? In other words, I do not want to use the default arguments in the workflow. Instead, I want to set them in the Powershell script and pass them to the workflow. If this is possible, can you provide a sample?

1 Like

Maybe you can instead of using workflow argumets read parameters from a config file?
Cheers

1 Like

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