C# Script

This action allows running custom C# code within the robot's virtualized environment.

Properties

Input

Click on Generate Code Starter to generate the "Hello world!" code.

Validate your code using the "Validate Code" button.

If your code is correct, a pop-up message will inform you that "Source code is valid".

If your code is NOT correct, another pop-up message will appear, informing the code is not correct and offering suggestions.

In the case below, on line 20, " is expected to close the string "este numarul total de mesaje

The error is registered also in the Error List section.

Same situation if the ; is missing on line 19.

  • Method Name: default value MainMethod

Misc

  • Display Name: action display name in your implementation project

  • Wait Before: number milliseconds robot to wait before executing the action.

  • Wait After: number milliseconds robot to wait until moving to the next action.

  • Abort on Error: True/False

  • Retry Times: Specifies the number of times to retry an action if it doesn't end successfully. Default value 0 (no retry); Use -1 if you want to retry indefinitely.

Use Case

Potential Use Cases

  • Parse a .csv file for master data synchronization between 2 different systems

  • Call information from multiple sources in order to build an automation algorithm

Examples of Using C# Code

Example

In this example, the robot will generate two files and a directory in the project folder.

Watch the robot in action:

You can see how C# Script activity is used in an example that incorporates multiple activities. You can check and download the example from here:

The article doesn't fully answer your question, or you want to find out more? Ask your question in the comments, on our community forum, or contact our support team or your account manager. Whatever works for you, your question will find its answer soon!

Last updated