Categorygithub.com/christopher-dg/robotscript
modulepackage
0.0.0-20180609190755-cafa7712325c
Repository: https://github.com/christopher-dg/robotscript.git
Documentation: pkg.go.dev

# README

RobotScript

Build Status

RobotScript is a scriptable, cross-platform desktop automation tool.

Installation

Statically linked binaries will be available for download here once the project is functional. In the meantime, feel free to build it yourself.

Usage

robotscript script.yml

Script Reference

Script files are written in YAML format. The commands are fairly self-explanatory/self-documenting. Here is a comprehensive example:

commands:
  - mouse:                 # command: moves the mouse cursor
      x: 200               # required: integer: x pixel
      y: 200               # required: integer: y pixel
      relative: false      # optional: boolean: moves cursor relative to original position
      smooth: true         # optional: boolean: moves cursor smoothly instead of instantly
  - click:                 # command: clicks a mouse button
      button: left         # required: string: mouse button (left, right, or center)
  - keypress:              # command: presses a key
      key: c               # required: string: key to be pressed (case insensitive)
      mods:                # optional: list<string>: modifier keys
        - shift            # note: this must be a list, even if there's only one
  - sleep:                 # command: does nothing for some time
      seconds: 1           # required: integer: seconds to wait
  - type:                  # command: types some text
      text: hello, world   # required: string: text to be typed
  - exec:                  # command: executes a program
      program: stat        # required: string: program to run
      args: /tmp/fakefile  # optional: string: command line arguments (not a list)

For a key naming reference, see here.

Acknowledgements

The following open source libraries have made my life much easier:

# Packages

No description provided by the author

# Functions

NewCommand creates a new command from an options map.
NewExecCommand creates a new ExecCommand from an options map.
NewKeyPressCommand creates a new KeyPressCommand from an options map.
NewMouseClickCommand creates a new MouseClickCommand from an options map.
NewMouseMoveCommand creates a new MouseMoveCommand from an options map.
NewScript parses the YAML file at filename into a new Script.
NewSleepCommand creates a new SleepCommand from an options map.
NewTypeCommand creates a new TypeCommand from an options map.

# Structs

ExecCommand executes a system command.
KeyPressCommand presses a key.
MouseClickCommand clicks the mouse.
MouseMoveCommand moves the mouse.
Script is a sequence of commands to execute.
SleepCommand does nothing for some amount of time.
TypeCommand types some text.

# Interfaces

Command defines the Execute function which any command must implement.