Start robot/process from Python script + Add arguments as parameters

Hi @PythonDev85,

Ah ok, now I understand your request. So lets break it down. This is surely possible. The os module in python is all you need.

What you must have in the host system running your python script

At a minimum a UiPath robot license (since 21.10 UiRobot.exe does not run headless/airgapped anymore, it has to be connected to the orchestrator and a license must be allocated)

General syntax : Hey UiRobot.exe, execute a nuget file with input arguments and use a specific entrypoint

C:\Users\%USER%\AppData\Local\Programs\UiPath\Studio\UiRobot.exe  execute --file "C:\Users\%USER%\Documents\UiPath\_Nugets\YourUiPATHPROJECT.1.0.3.nupkg"  --input "{'in_InputDataFolder':'C:\\Users\\%USER%\\Documents\\UiPath\\InputData'}" --entry "YOURENTRYPOINT.xaml"

In python it could be

def RunningUiPathProject(arg1):
    """
    You can design this function as you please with any number of arguments going into the cmd_str variable
    """
    import subprocess
    cmd_str = "C:\Users\%USER%\AppData\Local\Programs\UiPath\Studio\UiRobot.exe  execute --file 'C:\Users\%USER%\Documents\UiPath\_Nugets\YourUiPATHPROJECT.1.0.3.nupkg'  --input '{'in_InputDataFolder':ARG1} --entry 'YOURENTRYPOINT.xaml'".Replace("ARG1",arg1)
    subprocess.run(cmd_str) 

The one thing I have not tested is the use of Quotes in cmd_str. Quotes are always a pain, at the worst case save the cmd_str variable in a text file and read it and then manipulate it, much like a template string.

I took the new UiRobot.exe syntax from : Benchmarking Extract Transform Load (ETL) pipelines in UiPath - News / Vote on Tutorials - UiPath Community Forum

C:\Users\%USER%\AppData\Local\Programs\UiPath\Studio\UiRobot.exe execute --file "C:\Users\%USER%\Documents\UiPath\_Nugets\BenchmarkingETLApproachesinUiPath.1.0.3.nupkg" --input "{'in_InputDataFolder':'C:\\Users\\%USER%\\Documents\\UiPath\\InputData'}" --entry "FilterBenchmarker.xaml"

2 Likes