Create .py file

Create a new template robot with Visual Studio Code.

You do not have to start from scratch. The Visual Studio Code extension provides templates to help you get started.

Robocorp Visual Studio commands

  • Press Shift-Command-P (macOS) or Ctrl+Shift+P (Windows / Linux) to open the Command Palette.
  • Select Robocorp: Create Robot.
  • Select Python - Minimal.
  • Choose either Use workspace folder or Use child folder in workspace (Check out which option works better for you)

Open the tasks.py file inside the created robot directory

from robocorp.tasks import task @task def minimal_task(): message = "Hello" message = message + " World!"
  • This is the standard python template.

Run the template robot

  • Open the Command Palette.
  • Select Robocorp: Run Robot (or navigate to the task you want to run by clicking the Robocorp icon in the Activity Bar on the left).

View the robot log

When run, the robot should log a greeting.

Visual Studio Code - Log path

  • Command-Click (macOS) or Ctrl+Click (Windows / Linux) the path to the log file in the debug console. This opens the log as a HTML file. You can install the open in browser extension and press Option-B (macOS) or Alt+B (Windows / Linux) to open the HTML file in your default browser.

You can leave the log tab open in your browser and return to it whenever you want to check the log. Just remember to refresh the page to see the changes!

Update the robot description

A good description goes a long way in communicating the purpose and the task of your robot.

  • Describe your robot using docstrings for the @task function.
@task def minimal_task(): """ Orders robots from RobotSpareBin Industries Inc. Saves the order HTML receipt as a PDF file. Saves the screenshot of the ordered robot. Embeds the screenshot of the robot to the PDF receipt. Creates ZIP archive of the receipts and the images. """

Update the name of the task

A well-named task summarizes the thing that the robot is supposed to complete.

@task def order_robots_from_RobotSpareBin():

You are now set with the basics. Now on to the next chapter in building the functions for your robot.