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
- func ActiveName(name string) error
- func ActivePID(pid int32, args ...int) error
- func ActivePIDC(pid int32, args ...int)
- func BitmapClick(bitmap C.MMBitmapRef, args ...interface{})
- func BitmapStr(str string) C.MMBitmapRef
- func CaptureScreen(args ...int) C.MMBitmapRef
- func CharCodeAt(s string, n int) rune
- func CheckMouse(btn string) C.MMMouseButton
- func Click(args ...interface{})
- func CloseWindow(args ...int32)
- func Convert(opath, spath string, args ...int)
- func CopyBitPB(bitmap C.MMBitmapRef) bool
- func CopyBitpb(bitmap C.MMBitmapRef) bool
- func CountBitmap(bitmap, sbit C.MMBitmapRef, args ...float32) int
- func CountColor(color CHex, args ...interface{}) int
- func CountColorCS(color CHex, x, y, w, h int, args ...float64) int
- func DecodeImg(path string) (image.Image, string, error)
- func DeepCopyBit(bitmap C.MMBitmapRef) C.MMBitmapRef
- func Drag(x, y int, args ...string)
- func DragMouse(x, y int, args ...string)
- func FindBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int)
- func FindCBitmap(bmp CBitmap, args ...interface{}) (int, int)
- func FindColor(color CHex, args ...interface{}) (int, int)
- func FindColorCS(color CHex, x, y, w, h int, args ...float64) (int, int)
- func FindEveryBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int)
- func FindIds(name string) ([]int32, error)
- func FindName(pid int32) (string, error)
- func FindNames() ([]string, error)
- func FindPic(path string, args ...interface{}) (int, int)
- func FreeBitmap(bitmap C.MMBitmapRef)
- func GetActive() C.MData
- func GetBHandle() int
- func GetBounds(pid int32, args ...int) (int, int, int, int)
- func GetColor(bitmap C.MMBitmapRef, x, y int) C.MMRGBHex
- func GetColors(bitmap C.MMBitmapRef, x, y int) string
- func GetHandPid(pid int32, args ...int32) C.MData
- func GetHandle() int
- func GetImgSize(imgPath string) (int, int)
- func GetMousePos() (int, int)
- func GetPID() int32
- func GetPixelColor(x, y int) string
- func GetPortion(bit C.MMBitmapRef, x, y, w, h int) C.MMBitmapRef
- func GetPxColor(x, y int) C.MMRGBHex
- func GetScaleSize() (int, int)
- func GetScreenSize() (int, int)
- func GetText(imgPath string, args ...string) (string, error)
- func GetTitle(args ...int32) string
- func GetVersion() string
- func GetXDisplayName() string
- func GetXId(xu *xgbutil.XUtil, pid int32) (xproto.Window, error)
- func GetXidFromPid(xu *xgbutil.XUtil, pid int32) (xproto.Window, error)
- func GoString(char *C.char) string
- func HexToRgb(hex uint32) *C.uint8_t
- func IsValid() bool
- func KeyTap(tapKey string, args ...interface{}) string
- func KeyToggle(args ...string) string
- func Kill(pid int32) error
- func MaxWindow(pid int32, args ...interface{})
- func MicroSleep(tm float64)
- func MilliSleep(tm int)
- func MinWindow(pid int32, args ...interface{})
- func MouseClick(args ...interface{})
- func MouseToggle(togKey string, args ...interface{})
- func Move(x, y int)
- func MoveClick(x, y int, args ...interface{})
- func MoveMouse(x, y int)
- func MoveMouseSmooth(x, y int, args ...interface{}) bool
- func MoveSmooth(x, y int, args ...interface{}) bool
- func MovesClick(x, y int, args ...interface{})
- func OpenBitmap(gpath string, args ...int) C.MMBitmapRef
- func OpenImg(path string) []byte
- func PadHex(hex C.MMRGBHex) string
- func PasteStr(str string)
- func PidExists(pid int32) (bool, error)
- func Pids() ([]int32, error)
- func PointInBounds(bitmap C.MMBitmapRef, x, y int) bool
- func ReadAll() (string, error)
- func ReadBitmap(bitmap C.MMBitmapRef) bool
- func RgbToHex(r, g, b uint8) C.uint32_t
- func SaveBitmap(bitmap C.MMBitmapRef, gpath string, args ...int) string
- func SaveCapture(spath string, args ...int)
- func Scale() int
- func ScaleX() int
- func ScaleY() int
- func Scroll(x, y int, args ...int)
- func ScrollMouse(x int, direction string)
- func SetActive(win C.MData)
- func SetHandle(hwnd int)
- func SetHandlePid(pid int32, args ...int32)
- func SetKeyDelay(delay int)
- func SetKeyboardDelay(delay int)
- func SetMouseDelay(delay int)
- func SetXDisplayName(name string) string
- func ShowAlert(title, msg string, args ...string) int
- func Sleep(tm int)
- func ToCBitmap(bit Bitmap) C.MMBitmapRef
- func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef
- func ToMMRGBHex(hex CHex) C.MMRGBHex
- func TocharBitmap(bit C.MMBitmapRef) *C.char
- func TostringBitmap(bit C.MMBitmapRef) string
- func Try(fun func(), handler func(interface{}))
- func TypeStr(str string, args ...float64)
- func TypeStrDelay(str string, delay int)
- func TypeString(str string)
- func TypeStringDelayed(str string, delay int)
- func U32ToHex(hex C.uint32_t) C.MMRGBHex
- func U8ToHex(hex *C.uint8_t) C.MMRGBHex
- func UnicodeType(str uint32)
- func WriteAll(text string)
- type Bitmap
- type CBitmap
- type CHex
- type MPoint
- type Map
- type Nps
Constants ¶
const ( // Version get the robotgo version Version string = "v0.70.0.790, Mount Olympus: Mytikas!" )
Variables ¶
This section is empty.
Functions ¶
func ActivePID ¶
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 ¶
ActivePIDC active the window by PID, If args[0] > 0 on the unix platform via a xid to active
func BitmapClick ¶
func BitmapClick(bitmap C.MMBitmapRef, args ...interface{})
BitmapClick find the bitmap and click
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 Click ¶
func Click(args ...interface{})
Click click the mouse
robotgo.Click(button string, double bool)
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 ¶
CountColor count bitmap color
func CountColorCS ¶
CountColorCS count bitmap color by CaptureScreen
func DeepCopyBit ¶
func DeepCopyBit(bitmap C.MMBitmapRef) C.MMBitmapRef
DeepCopyBit deep copy bitmap
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 ¶
FindCBitmap find bitmap's pos by CBitmap
func FindColor ¶
FindColor find bitmap color
robotgo.FindColor(color CHex, bitmap C.MMBitmapRef, tolerance float)
func FindColorCS ¶
FindColorCS findcolor by CaptureScreen
func FindEveryBitmap ¶
func FindEveryBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int)
FindEveryBitmap find the every bitmap
func FindIds ¶
FindIds finds the all processes named with a subset of "name" (case insensitive), return matched IDs.
func FindPic ¶
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 GetColors ¶
func GetColors(bitmap C.MMBitmapRef, x, y int) string
GetColors get bitmap color retrun string
func GetHandPid ¶
GetHandPid get handle mdata by pid
func GetPixelColor ¶
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 GetXidFromPid ¶
GetXidFromPid get the xide from pid
func KeyTap ¶
KeyTap tap the keyboard code;
See keys:
https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
func KeyToggle ¶
KeyToggle toggle the keyboard
See keys:
https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
func MouseClick ¶
func MouseClick(args ...interface{})
MouseClick click the mouse
robotgo.MouseClick(button string, double bool)
func MouseToggle ¶
func MouseToggle(togKey string, args ...interface{})
MouseToggle toggle the mouse
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 MoveMouseSmooth ¶
MoveMouseSmooth move the mouse smooth, moves mouse to x, y human like, with the mouse button up.
func MoveSmooth ¶
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 MovesClick ¶
func MovesClick(x, y int, args ...interface{})
MovesClick move smooth and click the mouse
func OpenBitmap ¶
func OpenBitmap(gpath string, args ...int) C.MMBitmapRef
OpenBitmap open the bitmap return C.MMBitmapRef
robotgo.OpenBitmap(path string, type int)
func PointInBounds ¶
func PointInBounds(bitmap C.MMBitmapRef, x, y int) bool
PointInBounds bitmap point in bounds
func ReadBitmap ¶
func ReadBitmap(bitmap C.MMBitmapRef) bool
ReadBitmap returns false and sets error if |bitmap| is NULL
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 SetHandlePid ¶
SetHandlePid set the window handle by pid
func SetKeyboardDelay ¶
func SetKeyboardDelay(delay int)
SetKeyboardDelay set keyboard delay, Wno-deprecated
func ToMMBitmapRef ¶
func ToMMBitmapRef(bit CBitmap) C.MMBitmapRef
ToMMBitmapRef trans CBitmap to C.MMBitmapRef
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 TypeStr ¶
TypeStr send a string, support UTF-8
robotgo.TypeStr(string: The string to send, float64: microsleep time)
func TypeString ¶
func TypeString(str string)
TypeString send a string, support unicode TypeStr(string: The string to send)
func TypeStringDelayed ¶
TypeStringDelayed type string delayed, Wno-deprecated
Types ¶
type Bitmap ¶
type Bitmap struct { ImageBuffer *uint8 Width int Height int Bytewidth int BitsPerPixel uint8 BytesPerPixel uint8 }
Bitmap is Bitmap struct
func GoCaptureScreen ¶
GoCaptureScreen capture the screen and return bitmap(go struct)
Directories ¶
Path | Synopsis |
---|---|
Package clipboard read/write on clipboard
|
Package clipboard read/write on clipboard |