A Robin automation consists of a sequence of statements. A large amount of statements are called actions. Actions are split in the standard modules and the additional ones.
The standard modules are by default installed during the Robin installation. Additional actions can be added using extensive modules.
Every action, uses the following format.
Module.Action InputParameter1:'Value1' InputParameter2:'Value2' OutputParameter=> OutputVariable
Selecting the action from the Excel module the following command is autogenerated.
Excel.LaunchAndOpen Path: Visible:True Password:'' ReadOnly:False LoadAddInsAndMacros:False Instance=> ExcelInstance
In the beginning the Module and Action are requesting the path to the file. Then, the action allows the user to specify whether it requires a password, if it should open and be visible to the user and the oprion to load add-ins and macros along. The final section is there to set the Instance.
The majority of actions, have the exception handling rules to resolve possible cases that would cause the automation to fail. That way, the automation does not fail when such cases occur and alternative steps are performed to resolve or overcome the issue.
To enable and set the exception handling options of an action, use the terms “on error” in a new line setting the exception handling rules.
The first option when an automation fails is to make it repeat. The syntax for this is as follows.
excel.LaunchAndOpen Path: 'C:\Spreadsheet.xlsx' on error repeat 2 times wait 1 end
The error handling end is marked using an end statement.
The above action tries to open the Spreadhseet.xlsx file located under the C: drive. In case of a failed attempt, the action will wait for 1 second and then retry. This will repeat two times.
If repeating the action does not resolve the issue, there are additional steps that can be performed.
Use the “on error” term to set the default exception rules. These rules will apply for all the possible reasons the action errors out.
In the example below, in any kind of exception the variable ExceptVar will take the value “General Error”
excel.LaunchAndOpen Path: 'C:\Spreadsheet.xlsx' on error # default case set ExceptVar to 'General Error' end
Alternatively, there can be different steps to perform depending on the case of the exception.
In the example below the error handling steps are set only for the event that the document fails to open. The steps performed are that the variable ExceptVar takes the value ‘Document does not open’ and then the action is repeated.
excel.LaunchAndOpen Path: 'C:\Spreadsheet.xlsx' on error OpenDocumentError set ExceptVar to 'Document does not open' repeat action end
The error handling steps are performed from top to bottom.
Below, all the steps described above are combined.
excel.LaunchAndOpen Path: 'C:\Spreadsheet.xlsx' on error repeat 2 times wait 1 on error OpenDocumentError set ExceptVar to 'Document does not open' repeat action on error LaunchExcelError set ExceptVar to 'Excel does not launch' repeat action on error set ExceptVar to 'General Error' end
The exception handling options that can be performed are listed below:
|set Variable to||Option to set a value to a variable|
|repeat action||Option to repeat the action|
|goto labelname||Option to go to a label|
|throw error||Option to terminate the automation with an error|
|function call||Option to call a function in the automation|
Note, that in conditionals that involve additional actions, exception handling can be nested.
For example, below the condition checks if the “Calculator” process is running. However, there is a case that the running processes cannot be retrieved by the system. In that case, the exception handling rules are set for all the condition.
if (System.ProcessRunning ProcessName: 'calculator' on error repeat 1 times wait 1 end) then end