Welcome to the Pytobot Documentation!

What is Pytobot?

Automate repetitive tasks, such as opening programs, typing, clicking, copying & pasting, and more. Pytobot is easy to use, requires no programming knowledge, and has a built-in recorder!

Installation:

  1. Download and install Pytobot from /downloads or clone the GitHub repository and run pip install -r requirements.txt

Syntax:

Mouse Commands:

  • MouseClickLeft(500, 1000) # Left mouse click at screen coordinates (x, y)
  • MouseClickRight(500, 1000) # Right mouse click at screen coordinates (x, y)
  • MouseMove(500, 1000) # Move the mouse to screen coordinates (x, y)
  • MouseDoubleClickLeft(500, 500) # Double left click
  • MouseScroll(5) # Mouse scroll 5 digits up (positive) or down (negative)
  • MouseClickLeftHold # Click and hold the left mouse button
  • MouseClickLeftRelease # Click and release the left mouse button
  • MouseClickDragLeft(500, 1000 -> 600, 1100) # Click and drag the left mouse button to screen coordinates (x, y)

Keyboard Commands:

  • KeyboardEnter # Press the Enter key
  • KeyboardTab # Press the Tab key
  • KeyboardSpace # Press the Space key
  • KeyboardBackspace # Press the Backspace key
  • KeyboardDelete # Press the Delete key
  • KeyboardArrowUp # Press the up arrow key
  • KeyboardArrowDown # Press the down arrow key
  • KeyboardArrowLeft # Press the left arrow key
  • KeyboardArrowRight # Press the right arrow key
  • KeyboardWrite("word or phrase") # Type the specified word or phrase
  • KeyboardCtrlHold # Hold down the Ctrl key
  • KeyboardCtrlRelease # Release the Ctrl key
  • KeyboardCmd # Press the CMD key (e.g., for switching apps)

Copy and Paste Functions:

  • Copy # Copy (same as Ctrl+C)
  • Paste("name") # Paste the quoted text
  • Paste # Paste (same as Ctrl+V) by default the clipboard
  • Cut # Cut (same as Ctrl+X)
  • SelectAllAndCopy # Select all and copy (same as Ctrl+A and Ctrl+C)

Program Functions:

  • ProgramOpen("notepad") # Open a program (e.g., - - Notepad) Some programs may have different names than displayed in the taskbar e.g. Affinity Designer is Designer
  • ProgramClose("notepad") # Close a program
  • ProgramActivate("notepad") # Activate a program
  • ProgramMinimize("notepad") # Minimize a program
  • ProgramMaximize("notepad") # Maximize a program
  • ProgramBringToFront("notepad") # Bring a program to the front
  • ExecutePytobotScript("sample.txt") # Execute another Pytobot script

Other Functions:

  • Wait(5) # Wait for 5 seconds
  • TakeScreenshot # Take a screenshot and save it in Pictures\Screenshots
  • ClickOnImage("C:\path\to\image.png") # Click on an image on the screen e.g. an image of a button that you want to click on

Variables:

  • SetVariable(YourVariable = "value") # Set a variable
  • SetVariable(YourVariable = Clipboard()) # Set a variable from the clipboard

Comparison Operators:

  • == # Equal to
  • != # Not equal to
  • > # Greater than
  • < # Less than
  • >= # Greater than or equal to
  • <= # Less than or equal to

Comments:

  • # # Single-line comment

Stopping the Pytobot execution:

  • You can stop Pytobot by pressing the ESC key.

Shortcuts:

  • Pytobot has to be in the foreground to detect shortcuts.
  • ALT Left and 1 Prints click and mouse coordinates

Sample Script:

#Sample Comment
KeyboardCmd
KeyboardWrite("edge")
KeyboardEnter
KeyboardWrite("Tell me a fun fact")
KeyboardEnter