1 Star 0 Fork 8

魏大伟 / robotgo

forked from vz / robotgo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
doc.md 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
veni0 提交于 2016-10-20 19:57 . Update doc

#Methods:

##Keyboard Keys SetKeyboardDelay KeyTap KeyToggle TypeString TypeStringDelayed ##Mouse SetMouseDelay MoveMouse MoveMouseSmooth MouseClick MouseToggle DragMouse GetMousePos ScrollMouse ##Screen GetPixelColor GetScreenSize CaptureScreen GetXDisplayName(Linux) SetXDisplayName(Linux) ##Bitmap This is a work in progress.

FindBitmap
OpenBitmap
SaveBitmap
TostringBitmap

##Keyboard ###.SetKeyboardDelay(ms)

Sets the delay in milliseconds to sleep after a keyboard event. This is 10ms by default.

####Arguments:

ms - Time to sleep in milliseconds.

###.KeyTap(key, modifier)

Press a single key.

####Arguments:

key - See keys.
modifier (optional, string or array) - Accepts alt, command (win), control, and shift.

###.KeyToggle(key, down, modifier)

Hold down or release a key.

####Arguments:

key - See keys.
down - Accepts 'down' or 'up'.
modifier (optional, string or array) - Accepts alt, command (mac), control, and shift.

###.TypeString(string)

####Arguments:

string - The string to send.

###.TypeStringDelayed(string, cpm)

####Arguments:

string - The string to send.
cpm - Characters per minute.

##Mouse ###.SetMouseDelay(ms)

Sets the delay in milliseconds to sleep after a mouse event. This is 10ms by default.

####Arguments:

ms - Time to sleep in milliseconds.

###.MoveMouse(x, y)

Moves mouse to x, y instantly, with the mouse button up.

####Arguments:

x,y

####Examples:

//Move the mouse to 100, 100 on the screen. 
robotgo.MoveMouse(100, 100);

###.MoveMouseSmooth(x, y)

Moves mouse to x, y human like, with the mouse button up.

####Arguments:

x,y

###.MouseClick(button, double)

Clicks the mouse.

####Arguments:

button (optional) - Accepts left, right, or middle. Defaults to left.
double (optional) - Set to true to perform a double click. Defaults to false.

####Examples:

    robogo.MouseClick();

###.mouseToggle(down, button)

Toggles mouse button.

####Arguments:

down (optional) - Accepts down or up. Defaults to down.
button (optional) - Accepts left, right, or middle. Defaults to left.

####Examples:

robot.MouseToggle("down");

###.DragMouse(x, y)

Moves mouse to x, y instantly, with the mouse button held down.

####Arguments:

x,y

####Examples:

//Mouse down at 0, 0 and then drag to 100, 100 and release. 
robotgo.MoveMouse(0, 0);
robotgo.MouseToggle("down");
robotgo.DragMouse(100, 100);
robotgo.MouseToggle("up");

###.GetMousePos()

Gets the mouse coordinates.

####Return:

Returns an object with keys x and y.

####Examples:

x,y := robotgo.GetMousePos();
fmt.Println("pos:", x, y)

###.ScrollMouse(magnitude, direction)

Scrolls the mouse either up or down.

####Arguments:

magnitude - The amount to scroll.
direction - Accepts down or up.

####Examples:

robotgo.ScrollMouse(50, "up");

robotgo.ScrollMouse(50, "down");

##Screen ###.GetPixelColor(x, y)

Gets the pixel color at x, y. This function is perfect for getting a pixel or two, but if you'll be reading large portions of the screen use screen.capture.

####Arguments:

x,y

####Return:

Returns the hex color code of the pixel at x, y.

###.GetScreenSize()

Gets the screen width and height.

####Return:

Returns an object with .width and .height.

###.CaptureScreen //ScreenCapture

Gets part or all of the screen.

####Arguments:

x (optional)
y (optional)
height (optional)
width (optional)
If no arguments are provided, screencapture will get the full screen.

####Return:

Returns a bitmap object.

##Bitmap

This is a work in progress.

###.FindBitmap

find bitmap.

####Arguments:

bitmap

####Return:

Returns a position x and y

###.OpenBitmap

open bitmap .

####Arguments:

bitmap image path 

####Return:

Returns a bitmap

###.SaveBitmap

save a image with bitmap.

####Arguments:

bitmap,
path,
imagetype(int) 

####Return:

Returns a imgage

###.TostringBitmap

 bitmap to string .

####Arguments:

bitmap 

####Return:

Returns a sting bitmap        
1
https://gitee.com/davidmr/robotgo.git
git@gitee.com:davidmr/robotgo.git
davidmr
robotgo
robotgo
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891