robotgo

package module
v0.92.1-patched Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

README

Robotgo

Build Status CircleCI Status Build Status Appveyor Go Report Card GoDoc GitHub release

Golang Desktop Automation. Control the mouse, keyboard, bitmap, read the screen, Window Handle and global event listener.

RobotGo supports Mac, Windows, and Linux(X11).

Chinese Simplified

Contents

Docs

Binding:

Robotn, binding JavaScript and other, support more language.

Requirements:

Now, Please make sure Golang, GCC is installed correctly before installing RobotGo.

ALL:
Golang

GCC
For Mac OS X:
Xcode Command Line Tools
For Windows:
MinGW-w64 (Use recommended) or other GCC
For everything else:
GCC, libpng

X11 with the XTest extension (also known as the Xtst library)

Event:

xcb, xkb, libxkbcommon
Ubuntu:
sudo apt install gcc libc6-dev

sudo apt install libx11-dev xorg-dev libxtst-dev libpng++-dev

sudo apt install xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev
sudo apt install libxkbcommon-dev

sudo apt install xsel xclip
Fedora:
sudo dnf install libxkbcommon-devel libXtst-devel libxkbcommon-x11-devel xorg-x11-xkb-utils-devel

sudo dnf install libpng-devel

sudo dnf install xsel xclip

Installation:

go get github.com/go-vgo/robotgo

It's that easy!

png.h: No such file or directory? Please see issues/47.

Update:

go get -u github.com/go-vgo/robotgo

Note go1.10.x C file compilation cache problem, golang #24355. go mod vendor problem, golang #26366.

Examples:

Mouse
package main

import (
	"github.com/go-vgo/robotgo"
)

func main() {
  robotgo.ScrollMouse(10, "up")
  robotgo.MouseClick("left", true)
  robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0)
}
Keyboard
package main

import (
  "fmt"

  "github.com/go-vgo/robotgo"
)

func main() {
  robotgo.TypeStr("Hello World")
  robotgo.TypeStr("だんしゃり", 1.0)
  // robotgo.TypeString("テストする")

  robotgo.TypeStr("Hi galaxy. こんにちは世界.")
  robotgo.Sleep(1)

  // ustr := uint32(robotgo.CharCodeAt("Test", 0))
  // robotgo.UnicodeType(ustr)

  robotgo.KeyTap("enter")
  // robotgo.TypeString("en")
  robotgo.KeyTap("i", "alt", "command")

  arr := []string{"alt", "command"}
  robotgo.KeyTap("i", arr)

  robotgo.WriteAll("Test")
  text, err := robotgo.ReadAll()
  if err == nil {
    fmt.Println(text)
  }
}
Screen
package main

import (
	"fmt"

	"github.com/go-vgo/robotgo"
)

func main() {
  x, y := robotgo.GetMousePos()
  fmt.Println("pos: ", x, y)

  color := robotgo.GetPixelColor(100, 200)
  fmt.Println("color---- ", color)
}
Bitmap
package main

import (
	"fmt"

	"github.com/go-vgo/robotgo"
)

func main() {
  bitmap := robotgo.CaptureScreen(10, 20, 30, 40)
  // use `defer robotgo.FreeBitmap(bit)` to free the bitmap
  defer robotgo.FreeBitmap(bitmap)

  fmt.Println("...", bitmap)

  fx, fy := robotgo.FindBitmap(bitmap)
  fmt.Println("FindBitmap------ ", fx, fy)

  robotgo.SaveBitmap(bitmap, "test.png")
}
Event
package main

import (
  "fmt"

  "github.com/go-vgo/robotgo"
  hook "github.com/robotn/gohook"
)

func main() {
  add()
  low()
  event()
}

func add() {
  fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
  robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
    fmt.Println("ctrl-shift-q")
    robotgo.EventEnd()
  })

  fmt.Println("--- Please press w---")
  robotgo.EventHook(hook.KeyDown, []string{"w"}, func(e hook.Event) {
    fmt.Println("w")
  })

  s := robotgo.EventStart()
  <-robotgo.EventProcess(s)
}

func low() {
	EvChan := hook.Start()
	defer hook.End()

	for ev := range EvChan {
		fmt.Println("hook: ", ev)
	}
}

func event() {
  ok := robotgo.AddEvents("q", "ctrl", "shift")
  if ok {
    fmt.Println("add events...")
  }

  keve := robotgo.AddEvent("k")
  if keve {
    fmt.Println("you press... ", "k")
  }

  mleft := robotgo.AddEvent("mleft")
  if mleft {
    fmt.Println("you press... ", "mouse left button")
  }
}
Window
package main

import (
	"fmt"

	"github.com/go-vgo/robotgo"
)

func main() {
  fpid, err := robotgo.FindIds("Google")
  if err == nil {
    fmt.Println("pids... ", fpid)

    if len(fpid) > 0 {
      robotgo.ActivePID(fpid[0])

      robotgo.Kill(fpid[0])
    }
  }

  robotgo.ActiveName("chrome")

  isExist, err := robotgo.PidExists(100)
  if err == nil && isExist {
    fmt.Println("pid exists is", isExist)

    robotgo.Kill(100)
  }

  abool := robotgo.ShowAlert("test", "robotgo")
  if abool {
 	  fmt.Println("ok@@@ ", "ok")
  }

  title := robotgo.GetTitle()
  fmt.Println("title@@@ ", title)
}

CrossCompiling

Windows64 to win32
SET CGO_ENABLED=1
SET GOARCH=386
go build main.go
Other to windows
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -x ./
// CC=mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\bin\gcc.exe
// CXX=mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\bin\g++.exe

Some discussions and questions, please see issues/228, issues/143.

Authors

Plans

  • Update Find an image on screen, read pixels from an image
  • Update Window Handle
  • Try support Android, maybe support 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.

Documentation

Overview

Package robotgo Go native cross-platform system automation.

Please make sure Golang, GCC is installed correctly before installing RobotGo;

See Requirements:

https://github.com/go-vgo/robotgo#requirements

Installation:

go get -u github.com/go-vgo/robotgo

Index

Constants

View Source
const (
	// Version get the robotgo version
	Version = "v0.91.0.1089, MT. Rainier!"
)

Variables

View Source
var Keycode = uMap{
	"`": 41,
	"1": 2,
	"2": 3,
	"3": 4,
	"4": 5,
	"5": 6,
	"6": 7,
	"7": 8,
	"8": 9,
	"9": 10,
	"0": 11,
	"-": 12,
	"+": 13,

	"q":  16,
	"w":  17,
	"e":  18,
	"r":  19,
	"t":  20,
	"y":  21,
	"u":  22,
	"i":  23,
	"o":  24,
	"p":  25,
	"[":  26,
	"]":  27,
	"\\": 43,

	"a": 30,
	"s": 31,
	"d": 32,
	"f": 33,
	"g": 34,
	"h": 35,
	"j": 36,
	"k": 37,
	"l": 38,
	";": 39,
	"'": 40,

	"z": 44,
	"x": 45,
	"c": 46,
	"v": 47,
	"b": 48,
	"n": 49,
	"m": 50,
	",": 51,
	".": 52,
	"/": 53,

	"f1":  59,
	"f2":  60,
	"f3":  61,
	"f4":  62,
	"f5":  63,
	"f6":  64,
	"f7":  65,
	"f8":  66,
	"f9":  67,
	"f10": 68,
	"f11": 69,
	"f12": 70,

	"esc":     1,
	"delete":  14,
	"tab":     15,
	"ctrl":    29,
	"control": 29,
	"alt":     56,
	"space":   57,
	"shift":   42,
	"rshift":  54,
	"enter":   28,

	"cmd":     3675,
	"command": 3675,
	"rcmd":    3676,
	"ralt":    3640,

	"up":    57416,
	"down":  57424,
	"left":  57419,
	"right": 57421,
}

Keycode robotgo hook key's code map

View Source
var MouseMap = uMap{
	"left":       1,
	"right":      2,
	"center":     3,
	"wheelDown":  4,
	"wheelUp":    5,
	"wheelLeft":  6,
	"wheelRight": 7,
}

MouseMap robotgo hook mouse's code map

Functions

func ActiveName

func ActiveName(name string) error

ActiveName active window by name

func ActivePID

func ActivePID(pid int32, args ...int) error

ActivePID active the window by PID,

If args[0] > 0 on the Windows platform via a window handle to active, If args[0] > 0 on the unix platform via a xid to active

func ActivePIDC

func ActivePIDC(pid int32, args ...int) error

ActivePIDC active the window by PID, If args[0] > 0 on the unix platform via a xid to active

func AddEvent

func AddEvent(key string) bool

AddEvent add event listener,

parameters for the string type, the keyboard corresponding key parameters,

mouse arguments: mleft, center, mright, wheelDown, wheelUp, wheelLeft, wheelRight.

Use "robotgo.AddEvents()" or "gohook" add asynchronous event listener

func AddEvents

func AddEvents(key string, arr ...string) bool

AddEvents add global event hook

robotgo.AddEvents("q") robotgo.AddEvents("q", "ctrl") robotgo.AddEvents("q", "ctrl", "shift")

func AddMouse

func AddMouse(btn string, x ...int16) bool

AddMouse add mouse event hook

mouse arguments: left, center, right, wheelDown, wheelUp, wheelLeft, wheelRight.

robotgo.AddMouse("left") robotgo.AddMouse("left", 100, 100)

func AddMousePos

func AddMousePos(x, y int16) bool

AddMousePos add listen mouse event pos hook

func BitmapClick

func BitmapClick(bitmap C.MMBitmapRef, args ...interface{})

BitmapClick find the bitmap and click

func BitmapFromStr

func BitmapFromStr(str string) C.MMBitmapRef

BitmapFromStr bitmap from string

func BitmapStr

func BitmapStr(str string) C.MMBitmapRef

BitmapStr bitmap from string

func CaptureScreen

func CaptureScreen(args ...int) C.MMBitmapRef

CaptureScreen capture the screen return bitmap(c struct), use `defer robotgo.FreeBitmap(bitmap)` to free the bitmap

robotgo.CaptureScreen(x, y, w, h int)

func CharCodeAt

func CharCodeAt(s string, n int) rune

CharCodeAt char code at utf-8

func CheckMouse

func CheckMouse(btn string) C.MMMouseButton

CheckMouse check the mouse button

func Click

func Click(args ...interface{})

Click click the mouse

robotgo.Click(button string, double bool)

func CloseWindow

func CloseWindow(args ...int32)

CloseWindow close the window

func Convert

func Convert(opath, spath string, args ...int)

Convert convert the bitmap

robotgo.Convert(opath, spath string, type int)

func CopyBitPB

func CopyBitPB(bitmap C.MMBitmapRef) bool

CopyBitPB copy bitmap to pasteboard

func CopyBitpb

func CopyBitpb(bitmap C.MMBitmapRef) bool

CopyBitpb copy bitmap to pasteboard, Wno-deprecated

func CountBitmap

func CountBitmap(bitmap, sbit C.MMBitmapRef, args ...float32) int

CountBitmap count of the bitmap

func CountColor

func CountColor(color CHex, args ...interface{}) int

CountColor count bitmap color

func CountColorCS

func CountColorCS(color CHex, x, y, w, h int, args ...float64) int

CountColorCS count bitmap color by CaptureScreen

func DecodeImg

func DecodeImg(path string) (image.Image, string, error)

DecodeImg decode the image to image.Image and return

func DeepCopyBit

func DeepCopyBit(bitmap C.MMBitmapRef) C.MMBitmapRef

DeepCopyBit deep copy bitmap

func Drag

func Drag(x, y int, args ...string)

Drag drag the mouse

func DragMouse

func DragMouse(x, y int, args ...string)

DragMouse drag the mouse

func DragSmooth

func DragSmooth(x, y int, args ...interface{})

DragSmooth drag the mouse smooth

func End

func End()

End removes global event hook

func EventEnd

func EventEnd()

EventEnd removes global event hook

func EventHook

func EventHook(when uint8, keysPressed []string, callback func(hook.Event))

EventHook register gohook event

func EventProcess

func EventProcess(events chan hook.Event) chan bool

EventProcess return go hook process

func EventStart

func EventStart() chan hook.Event

EventStart start global event hook return event channel

func FindBitmap

func FindBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int)

FindBitmap find the bitmap's pos

	robotgo.FindBitmap(bitmap, subbitamp C.MMBitmapRef, tolerance float64)

 |tolerance| should be in the range 0.0f - 1.0f, denoting how closely the
 colors in the bitmaps need to match, with 0 being exact and 1 being any.

This method only automatically free the internal bitmap, use `defer robotgo.FreeBitmap(bit)` to free the bitmap

func FindCBitmap

func FindCBitmap(bmp CBitmap, args ...interface{}) (int, int)

FindCBitmap find bitmap's pos by CBitmap

func FindColor

func FindColor(color CHex, args ...interface{}) (int, int)

FindColor find bitmap color

robotgo.FindColor(color CHex, bitmap C.MMBitmapRef, tolerance float)

func FindColorCS

func FindColorCS(color CHex, x, y, w, h int, args ...float64) (int, int)

FindColorCS findcolor by CaptureScreen

func FindEveryBitmap

func FindEveryBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int)

FindEveryBitmap find the every bitmap

func FindIds

func FindIds(name string) ([]int32, error)

FindIds finds the all processes named with a subset of "name" (case insensitive), return matched IDs.

func FindName

func FindName(pid int32) (string, error)

FindName find the process name by the process id

func FindNames

func FindNames() ([]string, error)

FindNames find the all process name

func FindPath

func FindPath(pid int32) (string, error)

FindPath find the process path by the process pid

func FindPic

func FindPic(path string, args ...interface{}) (int, int)

FindPic finding the image by path

robotgo.FindPic(path string, subbitamp C.MMBitmapRef, tolerance float64)

This method only automatically free the internal bitmap, use `defer robotgo.FreeBitmap(bit)` to free the bitmap

func FreeBitmap

func FreeBitmap(bitmap C.MMBitmapRef)

FreeBitmap free and dealloc bitmap

func GetActive

func GetActive() C.MData

GetActive get the active window

func GetBHandle

func GetBHandle() int

GetBHandle get the window handle, Wno-deprecated

func GetBounds

func GetBounds(pid int32, args ...int) (int, int, int, int)

GetBounds get the window bounds

func GetColor

func GetColor(bitmap C.MMBitmapRef, x, y int) C.MMRGBHex

GetColor get bitmap color

func GetColors

func GetColors(bitmap C.MMBitmapRef, x, y int) string

GetColors get bitmap color retrun string

func GetHandPid

func GetHandPid(pid int32, args ...int32) C.MData

GetHandPid get handle mdata by pid

func GetHandle

func GetHandle() int

GetHandle get the window handle

func GetImgSize

func GetImgSize(imgPath string) (int, int)

GetImgSize get the image size

func GetMouseColor

func GetMouseColor() string

GetMouseColor get the mouse pos's color

func GetMousePos

func GetMousePos() (int, int)

GetMousePos get mouse's portion

func GetPID

func GetPID() int32

GetPID get the process id

func GetPixelColor

func GetPixelColor(x, y int) string

GetPixelColor get pixel color return string

func GetPortion

func GetPortion(bit C.MMBitmapRef, x, y, w, h int) C.MMBitmapRef

GetPortion get bitmap portion

func GetPxColor

func GetPxColor(x, y int) C.MMRGBHex

GetPxColor get pixel color return C.MMRGBHex

func GetScaleSize

func GetScaleSize() (int, int)

GetScaleSize get the screen scale size

func GetScreenSize

func GetScreenSize() (int, int)

GetScreenSize get the screen size

func GetText

func GetText(imgPath string, args ...string) (string, error)

GetText get the image text by tesseract ocr

robotgo.GetText(imgPath, lang string)

func GetTitle

func GetTitle(args ...int32) string

GetTitle get the window title

func GetVersion

func GetVersion() string

GetVersion get the robotgo version

func GetXDisplayName

func GetXDisplayName() string

GetXDisplayName get XDisplay name (Linux)

func GetXId

func GetXId(xu *xgbutil.XUtil, pid int32) (xproto.Window, error)

GetXId get the xid return window and error

func GetXidFromPid

func GetXidFromPid(xu *xgbutil.XUtil, pid int32) (xproto.Window, error)

GetXidFromPid get the xide from pid

func GoString

func GoString(char *C.char) string

GoString teans C.char to string

func HexToRgb

func HexToRgb(hex uint32) *C.uint8_t

HexToRgb trans hex to rgb

func Is64Bit

func Is64Bit() bool

Is64Bit determine whether the sys is 64bit

func IsValid

func IsValid() bool

IsValid valid the window

func KeyTap

func KeyTap(tapKey string, args ...interface{}) string

KeyTap tap the keyboard code;

See keys:

https://github.com/go-vgo/robotgo/blob/master/docs/keys.md

func KeyToggle

func KeyToggle(key string, args ...string) string

KeyToggle toggle the keyboard

See keys:

https://github.com/go-vgo/robotgo/blob/master/docs/keys.md

func Kill

func Kill(pid int32) error

Kill kill the process by PID

func MaxWindow

func MaxWindow(pid int32, args ...interface{})

MaxWindow set the window max

func MicroSleep

func MicroSleep(tm float64)

MicroSleep time C.microsleep(tm)

func MilliSleep

func MilliSleep(tm int)

MilliSleep sleep tm milli second

func MinWindow

func MinWindow(pid int32, args ...interface{})

MinWindow set the window min

func MouseClick

func MouseClick(args ...interface{})

MouseClick click the mouse

robotgo.MouseClick(button string, double bool)

func MouseToggle

func MouseToggle(togKey string, args ...interface{}) int

MouseToggle toggle the mouse

func Move

func Move(x, y int)

Move move the mouse

func MoveArgs

func MoveArgs(x, y int) (int, int)

MoveArgs move mose relative args

func MoveClick

func MoveClick(x, y int, args ...interface{})

MoveClick move and click the mouse

robotgo.MoveClick(x, y int, button string, double bool)

func MoveMouse

func MoveMouse(x, y int)

MoveMouse move the mouse

func MoveMouseSmooth

func MoveMouseSmooth(x, y int, args ...interface{}) bool

MoveMouseSmooth move the mouse smooth, moves mouse to x, y human like, with the mouse button up.

func MoveRelative

func MoveRelative(x, y int)

MoveRelative move mose relative

func MoveSmooth

func MoveSmooth(x, y int, args ...interface{}) bool

MoveSmooth move the mouse smooth, moves mouse to x, y human like, with the mouse button up.

robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)

func MoveSmoothRelative

func MoveSmoothRelative(x, y int, args ...interface{})

MoveSmoothRelative move mose smooth relative

func MovesClick

func MovesClick(x, y int, args ...interface{})

MovesClick move smooth and click the mouse

func Mul

func Mul(x int) int

Mul mul the scale

func OpenBitmap

func OpenBitmap(gpath string, args ...int) C.MMBitmapRef

OpenBitmap open the bitmap return C.MMBitmapRef

robotgo.OpenBitmap(path string, type int)

func OpenImg

func OpenImg(path string) ([]byte, error)

OpenImg open the image return []byte

func PadHex

func PadHex(hex C.MMRGBHex) string

PadHex trans C.MMRGBHex to string

func PasteStr

func PasteStr(str string) string

PasteStr paste a string, support UTF-8

func PidExists

func PidExists(pid int32) (bool, error)

PidExists determine whether the process exists

func Pids

func Pids() ([]int32, error)

Pids get the all process id

func PointInBounds

func PointInBounds(bitmap C.MMBitmapRef, x, y int) bool

PointInBounds bitmap point in bounds

func ReadAll

func ReadAll() (string, error)

ReadAll read string from clipboard

func ReadBitmap

func ReadBitmap(bitmap C.MMBitmapRef) bool

ReadBitmap returns false and sets error if |bitmap| is NULL

func RgbToHex

func RgbToHex(r, g, b uint8) C.uint32_t

RgbToHex trans rgb to hex

func SaveBitmap

func SaveBitmap(bitmap C.MMBitmapRef, gpath string, args ...int) string

SaveBitmap save the bitmap to image

robotgo.SaveBimap(bitmap C.MMBitmapRef, path string, type int)

func SaveCapture

func SaveCapture(spath string, args ...int)

SaveCapture capture screen and save

func SaveImg

func SaveImg(b []byte, path string) error

SaveImg save the image by []byte

func SavePng

func SavePng(img image.Image, path string) error

SavePng save the image by image.Image

func Scale

func Scale() int

Scale get the screen scale

func ScaleX

func ScaleX() int

ScaleX get primary display horizontal DPI scale factor

func ScaleY

func ScaleY() int

ScaleY get primary display vertical DPI scale factor

func Scaled

func Scaled(x int) int

Scaled x * sys-scale

func Scroll

func Scroll(x, y int, args ...int)

Scroll scroll the mouse with x, y

robotgo.Scroll(x, y, msDelay int)

func ScrollMouse

func ScrollMouse(x int, direction string)

ScrollMouse scroll the mouse

func SetActive

func SetActive(win C.MData)

SetActive set the window active

func SetDelay

func SetDelay(d ...int)

SetDelay set the key and mouse delay

func SetHandle

func SetHandle(hwnd int)

SetHandle set the window handle

func SetHandlePid

func SetHandlePid(pid int32, args ...int32)

SetHandlePid set the window handle by pid

func SetKeyDelay

func SetKeyDelay(delay int)

SetKeyDelay set keyboard delay

func SetKeyboardDelay

func SetKeyboardDelay(delay int)

SetKeyboardDelay set keyboard delay, Wno-deprecated, this function will be removed in version v1.0.0

func SetMouseDelay

func SetMouseDelay(delay int)

SetMouseDelay set mouse delay

func SetXDisplayName

func SetXDisplayName(name string) string

SetXDisplayName set XDisplay name (Linux)

func ShowAlert

func ShowAlert(title, msg string, args ...string) bool

ShowAlert show a alert window

func Sleep

func Sleep(tm int)

Sleep time.Sleep tm second

func Start

func Start() chan hook.Event

Start start global event hook return event channel

func StopEvent

func StopEvent()

StopEvent stop event listener

func SysScale

func SysScale() float64

SysScale get the sys scale

func ToBitmapBytes

func ToBitmapBytes(bit C.MMBitmapRef) []byte

ToBitmapBytes saves Bitmap to bitmap format in bytes

func ToCBitmap

func ToCBitmap(bit Bitmap) C.MMBitmapRef

ToCBitmap trans Bitmap to C.MMBitmapRef

func ToImage

func ToImage(bit C.MMBitmapRef) image.Image

ToImage convert C.MMBitmapRef to standard image.Image

func ToMMBitmapRef

func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef

ToMMBitmapRef trans CBitmap to C.MMBitmapRef

func ToMMRGBHex

func ToMMRGBHex(hex CHex) C.MMRGBHex

ToMMRGBHex trans CHex to C.MMRGBHex

func TocharBitmap

func TocharBitmap(bit C.MMBitmapRef) *C.char

TocharBitmap tostring bitmap to C.char

func TostringBitmap

func TostringBitmap(bit C.MMBitmapRef) string

TostringBitmap tostring bitmap to string

func Try

func Try(fun func(), handler func(interface{}))

Try handler(err)

func TypeStr

func TypeStr(str string, args ...float64)

TypeStr send a string, support UTF-8

robotgo.TypeStr(string: The string to send, float64: microsleep time, x11)

func TypeStrDelay

func TypeStrDelay(str string, delay int)

TypeStrDelay type string delayed

func TypeString

func TypeString(str string, delay ...int)

TypeString send a string, support unicode TypeStr(string: The string to send), Wno-deprecated

func TypeStringDelayed

func TypeStringDelayed(str string, delay int)

TypeStringDelayed type string delayed, Wno-deprecated

func U32ToHex

func U32ToHex(hex C.uint32_t) C.MMRGBHex

U32ToHex trans C.uint32_t to C.MMRGBHex

func U8ToHex

func U8ToHex(hex *C.uint8_t) C.MMRGBHex

U8ToHex teans *C.uint8_t to C.MMRGBHex

func UnicodeType

func UnicodeType(str uint32)

UnicodeType tap uint32 unicode

func WriteAll

func WriteAll(text string) error

WriteAll write string to clipboard

Types

type Bitmap

type Bitmap struct {
	ImgBuf        *uint8
	Width, Height int

	Bytewidth     int
	BitsPixel     uint8
	BytesPerPixel uint8
}

Bitmap is Bitmap struct

func GoCaptureScreen

func GoCaptureScreen(args ...int) Bitmap

GoCaptureScreen capture the screen and return bitmap(go struct)

func ToBitmap

func ToBitmap(bit C.MMBitmapRef) Bitmap

ToBitmap trans C.MMBitmapRef to Bitmap

type CBitmap

type CBitmap C.MMBitmapRef

CBitmap define CBitmap as C.MMBitmapRef type

type CHex

type CHex C.MMRGBHex

CHex define CHex as c rgb Hex type (C.MMRGBHex)

func UintToHex

func UintToHex(u uint32) CHex

UintToHex trans uint32 to robotgo.CHex

type MPoint

type MPoint struct {
	// contains filtered or unexported fields
}

MPoint is MPoint struct

type Map

type Map map[string]interface{}

Map a map[string]interface{}

type Nps

type Nps struct {
	Pid  int32
	Name string
}

Nps process struct

func Process

func Process() ([]Nps, error)

Process get the all process struct

Directories

Path Synopsis
Package clipboard read/write on clipboard
Package clipboard read/write on clipboard
key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL