Skip to content

vcaesar/robotgo-pro

Repository files navigation

Robotgo Pro

Build Status Go Report Card GoDoc GitHub release npm PyPI

Multi languages Desktop Automation, auto test and AI Computer Use.
Control the mouse, keyboard, bitmap, read the screen, Window Handle and global event listener.

RobotGo-Pro supports Mac, Windows, and Linux (X11 now). Also supports Javasprint, Python, Lua and others.

This software package is a commercial product and requires a license code to operate, create an account. The use of this software package is governed by the end-user license agreement (EULA) available at: EULA.

Go to AtomAI create an account, then setting conf.toml (Input your email and pwd to the conf.toml, one path with main.js.) to generate the licenses.
You can Login to try Python, Javascript, Lua and others lite version, and you need buy the robotgo-pro version in the AtomAI.

Contents

Requirements:

ALL:

GCC and Used language

For Mac OS X:

Xcode Command Line Tools;
And Privacy setting, add Screen Recording and Accessibility under:
System Settings > Privacy & Security > Accessibility, Screen & System Audio Recording.

xcode-select --install

For Windows:

llvm-mingw

winget install MartinStorsjo.LLVM-MinGW.UCRT

Or MinGW-w64

winget install BrechtSanders.WinLibs.POSIX.UCRT

Or others GCC;

For everything else:

Wayland (Developing 70% and testing):

Not supported now, developing in the progress (100% in version2).

X11:

GCC
X11 with the XTest extension (the Xtst library)

"Clipboard": xsel xclip

"Bitmap": libpng (Just used by the "bitmap".)

"Event-Gohook": xcb, xkb, libxkbcommon (Just used by the "hook".)
Ubuntu:
# gcc
sudo apt install gcc libc6-dev

# x11
sudo apt install libx11-dev xorg-dev libxtst-dev

# Clipboard
sudo apt install xsel xclip

# Bitmap
sudo apt install libpng++-dev

# GoHook
sudo apt install xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev libxkbcommon-dev
Fedora:
# x11
sudo dnf install libXtst-devel

# Clipboard
sudo dnf install xsel xclip

# Bitmap
sudo dnf install libpng-devel

# GoHook
sudo dnf install libxkbcommon-devel libxkbcommon-x11-devel xorg-x11-xkb-utils-devel

Installation:

JS, PY, Lua and others

git clone https://github.com/vcaesar/robotgo-pro

Create an account, input your email and password to the conf.toml, then run it.

Javasprint (Not now):

npm install robotgo  // robotgo-pro

Lite version:

npm install robotgo-lite

Python (Not now):

# pip install uv
# uv pip install cffi (The ctypes will be default)
uv pip install robotgo

# uv pip install robotgo-lite

Examples:

Javasprint Python Lua

JavaScript

var robotgo = require("robotgo");

robotgo.Scroll(10, "up");
robotgo.Click("left", true);
robotgo.MoveSmooth(100, 200); // speed: 1.0, 100.0

// node main.js
// sudo node main.js // only linux

Python

import sys
sys.path.append("..")

import robotgo

robotgo.Scroll(10, 10)
robotgo.Click("left", true)
robotgo.MoveSmooth(100, 200)

# uv run main.py

Lua

package.path = "../?.lua;"..package.path
local robotgo = require("robotgo")

-- Move mouse
robotgo.Move(100, 100)

-- Get screen size
local width, height = robotgo.GetScreenSize()
print(width, height)

-- Click
robotgo.Click("left")

-- luajit main.lua
var robotgo = require("robotgo");

robotgo.Type("test テスト");
robotgo.Type("galaxy. こんにちは世界.");
robotgo.Sleep(1);

robotgo.KeyTap("enter");

robotgo.WriteAll("Test");
var text = robotgo.ReadAll();
console.log(text);
var robotgo = require("robotgo");

var pos = robotgo.Location();
console.log("pos: ", pos);
var color = robotgo.GetPixelColor(100, 200);
console.log("color is: ", color);
var robotgo = require("robotgo");

var bitmap = robotgo.CaptureScreen(10, 20, 30, 40);
console.log("...", bitmap);

var pos = robotgo.FindBitmap(bitmap);
console.log("FindBitmap: ", pos);

robotgo.SaveBitmap(bitmap, "test.png");
// use `robotgo.FreeBitmap(bit)` to free the bitmap
robotgo.FreeBitmap(bitmap);

Design in the progress;

Design in the progress;

var robotgo = require("robotgo");

var keve = robotgo.AddEvent("k");
if (keve) {
  console.log("you press: ", "k");
}

var s = robotgo.AddEvents("q", "ctrl");
if (s) {
  console.log("you press: ", "mouse left button");
}
var robotgo = require("robotgo");

var fpid = robotgo.FindIds("Google");
console.log("pids... ", fpid);

if (fpid.length > 0) {
  robotgo.ActivePid(fpid[0]);

  robotgo.Kill(fpid[0]);
}

robotgo.ActiveName("chrome");

var isExist = robotgo.PidExists(100);
if (isExist) {
  console.log("pid exists is", isExist);

  robotgo.kill(100);
}

var abool = robotgo.Alert("test", "robotgo");
if (abool == 0) {
  console.log("ok: ", "ok");
}

var title = robotgo.GetTitle();
console.log("title: ", title);

Plans

  • Wayland support
  • More Window Handle