Scheduling Robot

This question comes up a lot. There is several ways you can run a robot at an interval.
NodeRED
The primary way you do that is using NodeRED. NodeRED has several modules for scheduling new messages, I normally go for node-red-contrib-cron and lookup the syntax at crontab.guru
Scheduling1

External application
You can schedule jobs from an external application, or using Microsoft task scheduler and then execute a workflow using command line parameters to the robot. You have 2 options for invoking the robot from command line, you can use the openrpa.exe file directly or you can use PowerShell to get even more control over the execution
command line
openrpa.exe now accepts a number of key value pairs for running workflows from command line.
you can use - or / for defining the key, but it is optional
workflowid can either be the id for the workflow or the relative path ( project \ filename )
for instance

OpenRPA.exe /WorkflowID 5e451402478059b6448ec23f
OpenRPA.exe /workflowid project1\add_to_notepad.xaml

if the workflow takes arguments you can also send those from command line, for instance add_to_notepad takes a parameter with the name text, that it adds to notepad

OpenRPA.exe /workflowid "dev\add_to_notepad.xaml" -text "Hi mom"

You can grab the id or relative path by right clicking the workflow in Open project tab in the robot
Scheduling2

PowerShell
Using the PowerShell module you can also run openrpa and openflow workflow. You can pipe an object or hash table to the command to fill out workflow arguments and Invoke-OpenRPA will per default with for the workflow to complete and return an object with all out arguments. This allows for for much better control since you can now parse the result.

Invoke-OpenRPA -Filename 'SDEMO\AddRobotTag.xaml'
# or with arguements
@{"text"= "Hi mom"} | Invoke-OpenRPA -Filename 'SDEMO\AddRobotTag.xaml'

Long running workflow
You can create a workflow that never ends.
A State Machine or even a simple DoWhile with a sleep, is a perfectly acceptable way to , “wake up” once in a while and check if it’s time to run the workflow using Invoke OpenRPA activity

1 Like