Skip to content

Latest commit

 

History

History
225 lines (163 loc) · 5.66 KB

README_zh.md

File metadata and controls

225 lines (163 loc) · 5.66 KB

Robotn

Build Status CircleCI Status Appveyor Go Report Card GoDoc GitHub release Join the chat at https://gitter.im/go-vgo/robotgo

Golang 跨平台自动化系统, binding 其他编程语言; 控制键盘鼠标位图和读取屏幕,窗口句柄以及全局事件监听

Robotn 支持 Mac, Windows, and Linux(X11). Robot 支持 go, javascript, python 和其他编程语言.

提 Issues 请到 Github, 便于统一管理和即时更新

Contents

Docs

Requirements:

环境要求:

Now, 这里没有 prebuild binary 版本, 在安装 RobotGo 之前, 请确保 Golang、GCC 被正确安装

Robotgo Requirements

Install robotn

npm install robotn

or

sudo cnpm install robotn
npm --registry=http://r.cnpmjs.org install robotn

Also, you can Build from source code. The python's pip install, and the prebuilt binaries will be added in the future.

var robot = require('robotn');

robot.scroll(10, 10);
robot.mouseClick("left", true);
robot.moveSmooth(100, 200, 1.0, 100.0);

python

import robot

robot.scroll(10, 10)
robot.mouseClick("left", true)
robot.moveSmooth(100, 200, 1.0, 100.0)
var robot = require('robotn');

robot.typeStr("测试")
robot.typeStr("山达尔星新星军团, galaxy. こんにちは世界.")
robot.sleep(1)

robot.keyTap("enter")

robot.writeAll("Test")
var text = robot.readAll()
console.log(text)
var robot = require('robotn');

var pos = robot.getMousePos()
console.log("pos: ", pos)
var color = robot.getPixelColor(100, 200)
console.log("color---- ", color)
var robot = require('robotn');

var bitmap = robot.captureScreen(10, 20, 30, 40)
console.log("...", bitmap)

var pos = robot.findBitmap(bitmap)
console.log("FindBitmap------ ", pos)

robot.saveBitmap(bitmap, "test.png")
// use `robot.freeBitmap(bit)` to free the bitmap
robot.freeBitmap(bitmap)
var robot = require('robotn');

var keve = robot.addEvent("k");
if (keve) {
  console.log("you press... ", "k");
}

var s = robot.addEvents("q", "ctrl");
if (s) {
  console.log("you press... ", "mouse left button");
}
var robot = require('robotn');

var fpid = robot.findIds("Google")
console.log("pids... ", fpid)

if (fpid.length > 0) {
  robot.activePID(fpid[0])

  robot.kill(fpid[0])
}

robot.activeName("chrome")

var isExist = robot.pidExists(100)
if (isExist) {
  console.log("pid exists is", isExist)

  robot.kill(100)
}

var abool = robot.showAlert("test", "robotgo")
if (abool == 0) {
  console.log("ok@@@ ", "ok")
}

var title = robot.getTitle()
console.log("title@@@ ", title)

Build from source code:

Install robotgo

go get -u github.com/go-vgo/robotgo
git clone https://github.com/vcaesar/robotn
go get -v github.com/vcaesar/gocs

Building

cd robotn
gocs -n robotgo

node:

Install npm modules
npm install

python

pip install cffi

Authors

Plans

  • 更新 Find an image on screen, read pixels from an image
  • 更新 Window Handle
  • 尝试支持 Android, 也许支持 IOS

Contributors

License

Robotgo is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT.