Find Suppliers#

Let's consider an example of a robot that demonstrates the automation of supplier search.

The robot project consists of 4 diagrams and 7 files in xlsx, txt, and docx formats.

Thus, to describe step by step, this robot works as follows:

  1. It checks the email and upon receiving a letter (the template of which is specified in the file “WorkBodyEmail.txt”) makes a request to search for a product in Yandex.
  2. It goes through the links from the search results and collects emails.
  3. It filters the links using data from the file “BlockEmails.xlsx”.
  4. It sends emails to the specified email addresses, taking the subject line from the file “RequestSubjectEmail.txt” and the body of the email from the file “RequestBodyEmail.txt”; two files are attached to the emails: the first is the application from the file “RequestWordTemplate.docx”, and the second is the company details from the file “CompanyDetails.xlsx”.

The main diagram of the project looks like this (for convenience, the blocks of the diagram are numbered):

  1. Block “Start” (this block is the beginning of any diagram).
  2. Block “Process” allows creating scenarios consisting of multiple diagrams. The execution of the scenario will continue from the “Start” block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the “End” block in the external diagram is reached. For the “Process” block, the property “Diagram Name” is specified (the name of the diagram file where the scenario will continue).
  1. Block “Pause” suspends the execution of the scenario for a specified time. In this case, for 10 seconds.
  1. Block “Get Emails via POP3” allows retrieving emails using the POP3 protocol. The following properties are specified for this block:
  • Server (server);
  • Login (login required for server authorization);
  • Password (password required for server authorization);
  • Timeout (timeout for server response in seconds);
  • SSL (if the flag is set, a secure connection is used);
  • Number of emails (the number of the latest emails to be retrieved from the server).
  1. Block “Log” allows outputting arbitrary messages and/or variable values to the log during the execution of the robot's scenario. The property “Value” is specified for this block. A text constant is indicated in quotes, and the variable name starts with the symbol $. That is, this block logs an error message.
  1. Block “For Each (List)” iterates over all elements in the specified list, assigning the current element to the variable specified in the “Element” property during each iteration of the loop, and then the execution of the scenario continues towards the Element exit of this block (to the so-called “loop body”). After iterating through all elements of the list, the execution of the scenario continues towards the lower exit of the block. Don’t forget to connect the exit of the last block in the loop body to the entrance of this block. For this block, one property is specified: “List” (the list whose elements need to be iterated over in the loop).

Important! To reset the loop, you need to go not to the loop itself, but to the block above it.

  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, two values are specified in the properties that need to be assigned to two variables, respectively.
  1. Block “Encode in Base64” allows encoding a string in Base64. For this block, one property is specified: “Text” (input string).
  1. Block “Check for Element in List” searches the list and determines whether the sought element is present in the list or not. The following properties are specified for this block:
  • List (the list in which the presence of the sought element needs to be checked);
  • Element (the element whose presence needs to be checked);
  • Check Type (select the type of check).
  1. Block “Add Element to List” adds the specified element to the end of the list. The following properties are specified for this block:
  • List (the list to which the new element needs to be added);
  • Element (the variable that needs to be added to the list).
  1. Block “Split Text” splits a string into substrings based on the specified delimiter character. The following properties are specified for this block:
  • Text (input string);
  • New Line (if the flag is set, splitting will occur by new line);
  • Remove Empty Substrings (if the flag is set, empty lines will be removed from the result);
  • Trim (if the flag is set, each line in the result will be trimmed).
  1. Block “Condition” checks the specified condition for truth, after which the execution of the scenario continues towards the “Yes” exit (if the condition is met) or towards the “No” exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of variable $Result is greater than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $listbody[0] == "SherpaRPA". That is, the body of the email must contain the code word "SherpaRPA".

  1. Block “Log” allows outputting arbitrary messages and/or variable values to the log during the execution of the robot's scenario. The property “Value” is specified for this block. A text constant is indicated in quotes, and the variable name starts with the symbol $. That is, this block logs the message “The email does not contain the code word SherpaRPA”.
  1. Block “Loop” allows repeating a chain of actions (blocks) several times while counting the number of iterations of the loop, recording the current count in a special variable (specified in the property “Loop”), which can then be used in other blocks. Upon first entering the block, the value of the variable from the property “Loop” is set to “Initial Value” (in this case, it is equal to 1), and then the execution of the scenario continues towards the “Loop” exit of this block (to the so-called “loop body”). As soon as the execution of the scenario reaches this block again, the value of the “Loop” variable will increase by the “Step” value (in this case, it is 1), and the transition to the “Loop” exit will occur again. As soon as the value of the “Loop” variable becomes greater than or equal to the “Final Value” (in this case, it is set to the variable $listbody.Count - 1), the execution of the scenario will continue towards the lower exit of the block. Don’t forget to connect the exit of the last block in the loop body to the entrance of this block or any of the preceding blocks.
  1. Block “Process” allows creating scenarios consisting of multiple diagrams. The execution of the scenario will continue from the “Start” block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the “End” block in the external diagram is reached. For the “Process” block, the property “Diagram Name” is specified (the name of the diagram file where the scenario will continue).
  1. Block “Process” allows creating scenarios consisting of multiple diagrams. The execution of the scenario will continue from the “Start” block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the “End” block in the external diagram is reached. For the “Process” block, the property “Diagram Name” is specified (the name of the diagram file where the scenario will continue).
  1. Block “Condition” checks the specified condition for truth, after which the execution of the scenario continues towards the “Yes” exit (if the condition is met) or towards the “No” exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of variable $Result is greater than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $listbody[$Index] == "Order:". That is, the body of the email must contain "Order:".

  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, one value is specified in the properties that need to be assigned to one variable, respectively.
  1. Block “Condition” checks the specified condition for truth, after which the execution of the scenario continues towards the “Yes” exit (if the condition is met) or towards the “No” exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of variable $Result is greater than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $listbody[$Index] == "Manager:". That is, the body of the email must contain "Manager:".

  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, one value is specified in the properties that need to be assigned to one variable, respectively.
  1. Block “Condition” checks the specified condition for truth, after which the execution of the scenario continues towards the “Yes” exit (if the condition is met) or towards the “No” exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of variable $Result is greater than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $listbody[$Index] == "Product:". That is, the body of the email must contain "Product:".

  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, one value is specified in the properties that need to be assigned to one variable, respectively.
  1. Block “Condition” checks the specified condition for truth, after which the execution of the scenario continues towards the “Yes” exit (if the condition is met) or towards the “No” exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of variable $Result is greater than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $listbody[$Index] == "Quantity:". That is, the body of the email must contain "Quantity:".

  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, one value is specified in the properties that need to be assigned to one variable, respectively.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”.

In this case the condition is $listbody[$Index] == "Address:": the email body must contain "Address:".

  1. Block “Assign Value to Variable” assigns new values to one or more variables. Here, one value is assigned to one variable.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”.

In this case the condition is $listbody[$Index] == "From company:": the email body must contain "From company:".

  1. Block “Assign Value to Variable” assigns new values to one or more variables. Here, one value is assigned to one variable.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”.

In this case the condition is $listbody[$Index] == "Product description:": the email body must contain that marker.

  1. Block “Assign Value to Variable” assigns new values to one or more variables. Here, one value is assigned to one variable.
  1. Block “Execute Expression” runs one or more PowerShell-compatible expressions.

Diagram “ProcessCreateWord”

  1. Block “Start” begins the diagram.
  2. Block “Open Document” opens a Word document. Set these properties:
  • Use COM: when selected, use the installed Microsoft Word application;
  • File path: the path to the Word document to open.
  1. Block “Replace All Variables in Text (Word)” replaces %variable% placeholders throughout the open Word document. Set these properties:
  • Word reference: the variable referring to the Word process. Its name must match the “Word reference” property of the earlier “Create Document” or “Open Document” block.
  • Document reference: the variable referring to the open Word document. Its name must match the “Document reference” property of the earlier “Create Document” or “Open Document” block.
  1. Block “New file”
  1. Block “Save Document” saves the Word document. Set these properties:
  • Word reference: the variable referring to the Word process. Its name must match the “Word reference” property of the earlier “Create Document” or “Open Document” block.
  • Document reference: the variable referring to the open Word document. Its name must match the “Document reference” property of the earlier “Create Document” or “Open Document” block.
  • File path: where to save the Word document.

Important! Leave the file path empty to save to the current file. Otherwise enter a new path; an existing file will be overwritten. Supported formats: .docx and .pdf.

  1. Block “Close Document” closes the Word document. Set the Word and Document reference variables used when it was opened.
  • Word reference: the variable referring to the Word process. Its name must match the “Word reference” property of the earlier “Create Document” or “Open Document” block.
  • Document reference: the variable referring to the open Word document. Its name must match the “Document reference” property of the earlier “Create Document” or “Open Document” block.
  1. Block “End” completes the scenario or returns from a subprocess diagram to the main process.

Diagram “ProcessGetEmails”

  1. Block “Start” begins the diagram.
  2. Block “Log” writes messages or variable values to the Robot log. In the “Value” property, text constants are in quotation marks and variable names start with $. Here it logs “Search:” and the requested product name.
  1. Block “Execute Expression” runs one or more PowerShell-compatible expressions.
  1. Block “Yandex Search” returns links from a Yandex search. Set these properties:
  • Query: the query to send to Yandex;
  • Maximum pages: the maximum number of result pages from which to collect links;
  • Timeout: the response timeout in milliseconds, after which the operation is cancelled.
  1. Block “Log” logs an error message. In the “Value” property, text constants are in quotation marks and variable names start with $.
  1. Block “Recognize CAPTCHA” automatically recognizes CAPTCHA challenges.
  1. Block “For Each (List)” iterates over the selected list. On each pass, the current item is assigned to the variable named in the “Item” property and execution follows the “Item” output into the loop body. Once all items have been processed, execution follows the lower output. Connect the output of the last block in the loop body back to this block. The “List” property selects the list to iterate.

Important! To restart the loop, return to the block before the loop rather than directly to the loop block.

  1. Block “Log” writes the product URL to the Robot log. In the “Value” property, text constants are in quotation marks and variable names start with $.
  1. Block “Execute GET Request” sends an HTTP GET request and returns the page source. Set these properties:
  • URL: the web page to request;
  • Encoding: the web page encoding;
  • UserAgent: the User-Agent to use when requesting the page;
  • TLS 12: when selected, use TLS 1.2 for the connection.
  1. Block “Get Substring List by Regular Expression” extracts matching substrings from text. Set these properties:
  • Text: the input string;
  • Pattern: the regular expression used for matching;
  • Timeout: the maximum operation time in seconds.
  1. Block “For Each (List)” iterates over the selected list. On each pass, the current item is assigned to the variable named in the “Item” property and execution follows the “Item” output into the loop body. Once all items have been processed, execution follows the lower output. Connect the output of the last block in the loop body back to this block. The “List” property selects the list to iterate.

Important! To restart the loop, return to the block before the loop rather than directly to the loop block.

  1. Block “Remove Duplicates from List” removes repeated items. Its “List” property selects the list that should retain only unique items.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”.

Here the condition is $ListEmails.Count >= 5: the email list must contain at least five items.

  1. Block “Check Value Exists” checks whether a value exists in the whole table or in a selected column. Set these properties:
  • Table: the data table to search;
  • Value: the value to check;
  • Column: the column number to search, starting at 0;
  • Check type: the type of check to perform.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”. Here the condition checks $Result: whether a result was obtained.

  1. Block “Execute Expression” runs one or more PowerShell-compatible expressions.
  1. Block “Log” logs “Number of emails found:” and the count. In the “Value” property, text constants are in quotation marks and variable names start with $.
  1. Block “For Each (List)” iterates over the selected list. On each pass, the current item is assigned to the variable named in the “Item” property and execution follows the “Item” output into the loop body. Once all items have been processed, execution follows the lower output. Connect the output of the last block in the loop body back to this block. The “List” property selects the list to iterate.

Important! To restart the loop, return to the block before the loop rather than directly to the loop block.

  1. Block “Send Email” sends an email. Set these properties:
  • Server: the mail server;
  • Login: the username for server authentication;
  • Password: the password for server authentication;
  • SSL: use an encrypted connection when selected;
  • Sender email: the address from which the email is sent;
  • Recipient email: the recipient address;
  • Subject: the email subject;
  • Email body: the message content;
  • HTML markup: send the body as an HTML page when selected;
  • Timeout: the server response timeout in seconds.
  1. Block “Log” logs a message that the email was sent. In the “Value” property, text constants are in quotation marks and variable names start with $.
  1. Block “Replace All Variables in Text” replaces all %variable% placeholders in the input text. Its “Text” property specifies the input string.
  1. Block “Replace All Variables in Text” replaces all %variable% placeholders in the input text. Its “Text” property specifies the input string.
  1. Block “Assign Value to Variable” assigns new values to one or more variables. Here, one value is assigned to one variable.
  1. Block “Find Row” searches a data table for the first row matching a value. Set these properties:
  • Table: the data table to search;
  • Search value: the value to find in the table;
  • Column: the column number or name to search; numbering starts at 0.
  1. Block “Condition” checks a condition and follows the “Yes” output if true or the “No” output if false.

Write the condition as a variable compared with a value using ==, >, or <.

For example, $a == “Hello” follows the “Yes” output when $a equals “Hello”; otherwise it follows “No”.

$Result > 5 follows “Yes” when $Result is greater than 5; otherwise it follows “No”. Here the condition is $RowOrganization == $null: the “Organization” row must be null.

  1. Block “Add Element to List” adds the specified element to the end of the list. The following properties are specified for this block:
  • List (the list to which the new element needs to be added);
  • Element (the variable that needs to be added to the list).
  1. Block “Add Element to List” adds the specified element to the end of the list. The following properties are specified for this block:
  • List (the list to which the new element needs to be added);
  • Element (the variable that needs to be added to the list).
  1. Block “Send Email” allows sending an email using the POP3 protocol. The following properties are specified for this block:
  • Server (server);
  • Password (password required for server authorization);
  • SSL (if the flag is set, a secure connection is used);
  • Sender Email (the email from which the letter will be sent);
  • Recipient Email (the email address of the recipient to whom the letter needs to be sent);
  • Email Subject (the subject of the email);
  • Email Text (the content of the email);
  • HTML Markup (if the flag is set, the content of the email will be sent as an HTML page and may contain tags);
  • Attachments (path to the file / List of file paths / Dictionary with files that will be attached to the email (key - name, value - path to the file));
  • Timeout (timeout for server response in seconds).
  1. Block “Execute Expression” starts the execution of one or more expressions in a language compatible with PowerShell.
  1. Block “Assign Value to Variable” sets new values for one or more variables. In this case, one value is specified in the properties that need to be assigned to one variable, respectively.
  1. Block “Get File Path” allows you to find out the full path to a file. The following properties are specified for this block:
  • Folder Path (the path to the folder where the required file is located);
  • File Name (the name of the file).
  1. and 33. Blocks “End” (these blocks complete the execution of the scenario or return the subprocess diagram to the main process).

Diagram “ProcessSetting”

  1. Block “Start” (this block is the beginning of any diagram).
  2. Block “Get File Path” allows you to find out the full path to a file. For this block, one property is specified: “File Name”.
  1. Block “Get File Path” allows you to find out the full path to a file. For this block, one property is specified: “File Name”.
  1. Block “Read File” allows reading the contents of a text file into a variable. The following properties are specified for this block:
  • File Name (the name of the text file whose contents need to be read);
  • Encoding (the encoding of the file).
  1. Block “Get File Path” allows you to find out the full path to a file. For this block, one property is specified: “File Name”.
  1. Block “Read File” allows reading the contents of a text file into a variable. The following properties are specified for this block:
  • File Name (the name of the text file whose contents need to be read);
  • Encoding (the encoding of the file).
  1. Block “Get File Path” allows you to find out the full path to a file. For this block, one property is specified: “File Name”.
  1. Block “Load Data Table” allows loading a “Data Table” from an Excel document. The following properties are specified for this block:
  • File Path (the data table into which data from the Excel document will be loaded);
  • Sheet (the ordinal number of the sheet from which data needs to be read into the Data Table).
  1. Block “Get File Path” allows you to find out the full path to a file. For this block, one property is specified: “File Name”.
  1. Block “Load Data Table” allows loading a “Data Table” from an Excel document. The following properties are specified for this block:
  • File Path (the data table into which data from the Excel document will be loaded);
  • Sheet (the ordinal number of the sheet from which data needs to be read into the Data Table).
  1. Block “End” (this block completes the execution of the scenario or returns the subprocess diagram to the main process).