Fix doc.md

This commit is contained in:
vCaesar 2017-03-15 16:25:55 +08:00
parent 6f8e16b42b
commit 3a04f0ca44

View File

@ -1,82 +1,82 @@
#Methods:
# Methods:
#####[GetVersion](#GetVersion)
##### [GetVersion](#GetVersion)
##[Keyboard](#Keyboard)
## [Keyboard](#Keyboard)
#####[Keys](https://github.com/go-vgo/robotgo/blob/master/docs/keys.md)
#####[SetKeyboardDelay](#SetKeyDelay)(Equivalent to SetKeyDelay,Wno-deprecated)
#####[SetKeyDelay](#SetKeyDelay)
#####[KeyTap](#KeyTap)
#####[KeyToggle](#KeyToggle)
#####[TypeString](#TypeString)
#####[TypeStringDelayed](#TypeStrDelay)(Equivalent to TypeStrDelay,Wno-deprecated)
#####[TypeStrDelay](#TypeStrDelay)
##### [Keys](https://github.com/go-vgo/robotgo/blob/master/docs/keys.md)
##### [SetKeyboardDelay](#SetKeyDelay)(Equivalent to SetKeyDelay,Wno-deprecated)
##### [SetKeyDelay](#SetKeyDelay)
##### [KeyTap](#KeyTap)
##### [KeyToggle](#KeyToggle)
##### [TypeString](#TypeString)
##### [TypeStringDelayed](#TypeStrDelay)(Equivalent to TypeStrDelay,Wno-deprecated)
##### [TypeStrDelay](#TypeStrDelay)
##[Mouse](#Mouse)
## [Mouse](#Mouse)
#####[SetMouseDelay](#SetMouseDelay)
#####[MoveMouse](#MoveMouse)
#####[Move](#MoveMouse)(Equivalent to MoveMouse)
#####[MoveMouseSmooth](#MoveMouseSmooth)
#####[MoveSmooth](#MoveMouseSmooth)(Equivalent to MoveMouseSmooth)
#####[MouseClick](#MouseClick)
#####[Click](#MouseClick)(Equivalent to MouseClick)
#####[MoveClick](#MoveClick)
#####[MouseToggle](#MouseToggle)
#####[DragMouse](#DragMouse)
#####[Drag](#DragMouse)(Equivalent to DragMouse)
#####[GetMousePos](#GetMousePos)
#####[ScrollMouse](#ScrollMouse)
##### [SetMouseDelay](#SetMouseDelay)
##### [MoveMouse](#MoveMouse)
##### [Move](#MoveMouse)(Equivalent to MoveMouse)
##### [MoveMouseSmooth](#MoveMouseSmooth)
##### [MoveSmooth](#MoveMouseSmooth)(Equivalent to MoveMouseSmooth)
##### [MouseClick](#MouseClick)
##### [Click](#MouseClick)(Equivalent to MouseClick)
##### [MoveClick](#MoveClick)
##### [MouseToggle](#MouseToggle)
##### [DragMouse](#DragMouse)
##### [Drag](#DragMouse)(Equivalent to DragMouse)
##### [GetMousePos](#GetMousePos)
##### [ScrollMouse](#ScrollMouse)
##[Screen](#Screen)
## [Screen](#Screen)
#####[GetPixelColor](#GetPixelColor)
#####[GetScreenSize](#GetScreenSize)
#####[CaptureScreen](#CaptureScreen)
#####[GetXDisplayName(Linux)](#GetXDisplayName)
#####[SetXDisplayName(Linux)](#SetXDisplayName)
##### [GetPixelColor](#GetPixelColor)
##### [GetScreenSize](#GetScreenSize)
##### [CaptureScreen](#CaptureScreen)
##### [GetXDisplayName(Linux)](#GetXDisplayName)
##### [SetXDisplayName(Linux)](#SetXDisplayName)
##[Bitmap](#Bitmap)
## [Bitmap](#Bitmap)
This is a work in progress.
#####[FindBitmap](#FindBitmap)
#####[OpenBitmap](#OpenBitmap)
#####[SaveBitmap](#SaveBitmap)
#####[TostringBitmap](#TostringBitmap)
#####[GetPortion](#GetPortion)
#####[Convert](#Convert)
##### [FindBitmap](#FindBitmap)
##### [OpenBitmap](#OpenBitmap)
##### [SaveBitmap](#SaveBitmap)
##### [TostringBitmap](#TostringBitmap)
##### [GetPortion](#GetPortion)
##### [Convert](#Convert)
##[Event](#Event)
## [Event](#Event)
#####[LEvent](#LEvent)(Equivalent to AddEvent,Wno-deprecated)
#####[AddEvent](#AddEvent)
#####[StopEvent](#StopEvent)
##### [LEvent](#LEvent)(Equivalent to AddEvent,Wno-deprecated)
##### [AddEvent](#AddEvent)
##### [StopEvent](#StopEvent)
##[Window](#Window)
## [Window](#Window)
This is a work in progress.
#####[ShowAlert](#ShowAlert)
#####[CloseWindow](#CloseWindow)
#####[IsValid](#IsValid)
#####[SetActive](#SetActive)
#####[GetActive](#GetActive)
#####[SetHandle](#SetHandle)
#####[GetHandle](#GetHandle)
#####[GetBHandle](#GetHandle)
#####[GetTitle](#GetTitle)
#####[GetPID](#GetPID)
##### [ShowAlert](#ShowAlert)
##### [CloseWindow](#CloseWindow)
##### [IsValid](#IsValid)
##### [SetActive](#SetActive)
##### [GetActive](#GetActive)
##### [SetHandle](#SetHandle)
##### [GetHandle](#GetHandle)
##### [GetBHandle](#GetHandle)
##### [GetTitle](#GetTitle)
##### [GetPID](#GetPID)
###<h3 id="GetVersion">.GetVersion()</h3>
### <h3 id="GetVersion">.GetVersion()</h3>
get robotgo version
##<h2 id="Keyboard">Keyboard</h2>
## <h2 id="Keyboard">Keyboard</h2>
###<h3 id="SetKeyDelay">.SetKeyDelay(ms)</h3>
### <h3 id="SetKeyDelay">.SetKeyDelay(ms)</h3>
Sets the delay in milliseconds to sleep after a keyboard event. This is 10ms by default.
####Arguments:
#### Arguments:
ms - Time to sleep in milliseconds.
@ -84,148 +84,148 @@
Press a single key.
####Arguments:
#### Arguments:
key - See [keys](https://github.com/go-vgo/robotgo/blob/master/docs/keys.md).
modifier (optional, string or array) - Accepts alt, command (win), control, and shift.
####Examples:
#### Examples:
```Go
robotgo.KeyTap("h", "command")
robotgo.KeyTap("i", "alt", "command")
arr := []string{"alt", "command"}
robotgo.KeyTap("i", arr)
robotgo.KeyTap("h", "command")
robotgo.KeyTap("i", "alt", "command")
arr := []string{"alt", "command"}
robotgo.KeyTap("i", arr)
```
###<h3 id="KeyToggle">.KeyToggle(key, down, modifier)</h3>
### <h3 id="KeyToggle">.KeyToggle(key, down, modifier)</h3>
Hold down or release a key.
####Arguments:
#### Arguments:
key - See [keys](https://github.com/go-vgo/robotgo/blob/master/docs/keys.md).
down - Accepts 'down' or 'up'.
modifier (optional, string or array) - Accepts alt, command (mac), control, and shift.
####Return:
#### Return:
return KeyToggle status
###<h3 id="TypeString">.TypeString(string)</h3>
### <h3 id="TypeString">.TypeString(string)</h3>
####Arguments:
#### Arguments:
string - The string to send.
###<h3 id="TypeStrDelay">.TypeStrDelay(string, cpm)</h3>
### <h3 id="TypeStrDelay">.TypeStrDelay(string, cpm)</h3>
####Arguments:
#### Arguments:
string - The string to send.
cpm - Characters per minute.
##<h2 id="Mouse">Mouse</h2>
## <h2 id="Mouse">Mouse</h2>
###<h3 id="SetMouseDelay">.SetMouseDelay(ms)</h3>
### <h3 id="SetMouseDelay">.SetMouseDelay(ms)</h3>
Sets the delay in milliseconds to sleep after a mouse event. This is 10ms by default.
####Arguments:
#### Arguments:
ms - Time to sleep in milliseconds.
###<h3 id="MoveMouse">.MoveMouse(x, y)</h3>
### <h3 id="MoveMouse">.MoveMouse(x, y)</h3>
Moves mouse to x, y instantly, with the mouse button up.
####Arguments:
#### Arguments:
x,y
####Examples:
#### Examples:
```Go
//Move the mouse to 100, 100 on the screen.
// Move the mouse to 100, 100 on the screen.
robotgo.MoveMouse(100, 100)
```
###<h3 id="MoveMouseSmooth">.MoveMouseSmooth(x, y)</h3>
### <h3 id="MoveMouseSmooth">.MoveMouseSmooth(x, y)</h3>
Moves mouse to x, y human like, with the mouse button up.
####Arguments:
#### Arguments:
x,y
lowspeed,highspeed
####Examples:
#### Examples:
```Go
robotgo.MoveMouseSmooth(100, 200)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0)
robotgo.MoveMouseSmooth(100, 200)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0)
```
###<h3 id="MouseClick">.MouseClick(button, double)</h3>
### <h3 id="MouseClick">.MouseClick(button, double)</h3>
Clicks the mouse.
####Arguments:
#### Arguments:
button (optional) - Accepts "left", "right", or "center". Defaults to left.
double (optional) - Set to true to perform a double click. Defaults to false.
####Examples:
#### Examples:
```Go
robogo.MouseClick()
robogo.MouseClick("left", true)
robogo.MouseClick()
robogo.MouseClick("left", true)
```
###<h3 id="MoveClick">.MoveClick(x, y, button, double)</h3>
### <h3 id="MoveClick">.MoveClick(x, y, button, double)</h3>
Move and click the mouse.
####Arguments:
#### Arguments:
x,
y,
button (optional) - Accepts "left", "right", or "center". Defaults to left.
double (optional) - Set to true to perform a double click. Defaults to false.
####Examples:
#### Examples:
```Go
robogo.MoveClick(10, 20)
robogo.MoveClick(10, 20, "left", true)
robogo.MoveClick(10, 20)
robogo.MoveClick(10, 20, "left", true)
```
###<h3 id="MouseToggle">.MouseToggle(down, button)</h3>
### <h3 id="MouseToggle">.MouseToggle(down, button)</h3>
Toggles mouse button.
####Arguments:
#### Arguments:
down (optional) - Accepts down or up. Defaults to down.
button (optional) - Accepts "left", "right", or "center". Defaults to left.
####Examples:
#### Examples:
```Go
robotgo.MouseToggle("down")
robotgo.MouseToggle("down", "right")
```
###<h3 id="DragMouse">.DragMouse(x, y)</h3>
### <h3 id="DragMouse">.DragMouse(x, y)</h3>
Moves mouse to x, y instantly, with the mouse button held down.
####Arguments:
#### Arguments:
x,y
####Examples:
#### Examples:
```Go
// Mouse down at 0, 0 and then drag to 100, 100 and release.
@ -235,31 +235,31 @@ robotgo.DragMouse(100, 100)
robotgo.MouseToggle("up")
```
###<h3 id="GetMousePos">.GetMousePos()</h3>
### <h3 id="GetMousePos">.GetMousePos()</h3>
Gets the mouse coordinates.
####Return:
#### Return:
Returns an object with keys x and y.
####Examples:
#### Examples:
```Go
x,y := robotgo.GetMousePos()
fmt.Println("pos:", x, y)
```
###<h3 id="ScrollMouse">.ScrollMouse(magnitude, direction)</h3>
### <h3 id="ScrollMouse">.ScrollMouse(magnitude, direction)</h3>
Scrolls the mouse either up or down.
####Arguments:
#### Arguments:
magnitude - The amount to scroll.
direction - Accepts down or up.
####Examples:
#### Examples:
```Go
robotgo.ScrollMouse(50, "up")
@ -268,29 +268,29 @@ robotgo.ScrollMouse(50, "down")
```
##<h2 id="Screen">Screen</h2>
## <h2 id="Screen">Screen</h2>
###<h3 id="GetPixelColor">.GetPixelColor(x, y)
### <h3 id="GetPixelColor">.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:
#### Arguments:
x,y
####Return:
#### Return:
Returns the hex color code of the pixel at x, y.
###<h3 id="GetScreenSize">.GetScreenSize()</h3>
### <h3 id="GetScreenSize">.GetScreenSize()</h3>
Gets the screen width and height.
####Return:
#### Return:
Returns an object with .width and .height.
###<h3 id="CaptureScreen">.CaptureScreen</h3>
### <h3 id="CaptureScreen">.CaptureScreen</h3>
// CaptureScreen
Gets part or all of the screen.
@ -298,7 +298,7 @@ robotgo.ScrollMouse(50, "down")
BCaptureScreen Returns a go struct
Capture_Screen(Drop support)
####Arguments:
#### Arguments:
x (optional)
y (optional)
@ -306,114 +306,114 @@ robotgo.ScrollMouse(50, "down")
width (optional)
If no arguments are provided, screencapture will get the full screen.
####Return:
#### Return:
Returns a bitmap object.
##<h2 id="Bitmap">Bitmap</h2>
## <h2 id="Bitmap">Bitmap</h2>
This is a work in progress.
###<h3 id="FindBitmap">.FindBitmap</h3>
### <h3 id="FindBitmap">.FindBitmap</h3>
find bitmap.
####Arguments:
#### Arguments:
bitmap;
rect(optional): x, y, w, h
####Return:
#### Return:
Returns a position x and y
###<h3 id="OpenBitmap">.OpenBitmap</h3>
### <h3 id="OpenBitmap">.OpenBitmap</h3>
open bitmap.
####Arguments:
#### Arguments:
bitmap image path,
MMImageType(optional)
####Return:
#### Return:
Returns a bitmap
###<h3 id="SaveBitmap">.SaveBitmap</h3>
### <h3 id="SaveBitmap">.SaveBitmap</h3>
save a image with bitmap.
####Arguments:
#### Arguments:
bitmap,
path,
imagetype(int)
####Return:
#### Return:
return save image status
###<h3 id="TostringBitmap">.TostringBitmap</h3>
### <h3 id="TostringBitmap">.TostringBitmap</h3>
bitmap to string
####Arguments:
#### Arguments:
bitmap
####Return:
#### Return:
Return a sting bitmap
###<h3 id="GetPortion">.GetPortion</h3>
### <h3 id="GetPortion">.GetPortion</h3>
bitmap from a portion
####Arguments:
#### Arguments:
bitmap,
rect: x, y, w, h
####Return:
#### Return:
Returns new bitmap object created from a portion of another
###<h3 id="Convert">.Convert(openpath, savepath,MMImageType)</h3>
### <h3 id="Convert">.Convert(openpath, savepath,MMImageType)</h3>
Convert the image format
####Arguments:
#### Arguments:
openpath,
savepath,
MMImageType(optional)
####Examples:
#### Examples:
```Go
robotgo.Convert("test.png", "test.tif")
```
##<h2 id="Event">Event</h2>
## <h2 id="Event">Event</h2>
###<h3 id="AddEvent">.AddEvent(string)</h3>
### <h3 id="AddEvent">.AddEvent(string)</h3>
Listening global event
####Arguments:
#### Arguments:
string
(mosue arguments:mleft mright wheelDown wheelUp wheelLeft wheelRight)
####Return:
#### Return:
if listened return 0
####Examples:
#### Examples:
```Go
package main
@ -436,16 +436,16 @@ func main() {
}
}
```
###<h3 id="StopEvent">.StopEvent()</h3>
### <h3 id="StopEvent">.StopEvent()</h3>
stop listen global event
##<h2 id="Window">Window</h2>
## <h2 id="Window">Window</h2>
###<h3 id="ShowAlert">.ShowAlert(title, msg,defaultButton,cancelButton string)</h3>
### <h3 id="ShowAlert">.ShowAlert(title, msg,defaultButton,cancelButton string)</h3>
Displays alert with the given attributes. If cancelButton is not given, only the defaultButton is displayed
####Arguments:
#### Arguments:
title(string),
msg(string),
@ -453,89 +453,89 @@ func main() {
cancelButton(optional string)
####Return:
#### Return:
Returns 0(True) if the default button was pressed, or 1(False) if cancelled.
###<h3 id="CloseWindow">.CloseWindow()</h3>
### <h3 id="CloseWindow">.CloseWindow()</h3>
Close the Window
####Arguments:
#### Arguments:
None
####Return:
#### Return:
None
###<h3 id="IsValid">.IsValid()</h3>
### <h3 id="IsValid">.IsValid()</h3>
Valid the Window
####Arguments:
#### Arguments:
None
####Return:
#### Return:
Returns true if a window has been selected
###<h3 id="SetActive">.SetActive()</h3>
### <h3 id="SetActive">.SetActive()</h3>
Set the Active Window
####Arguments:
#### Arguments:
hwnd
####Return:
#### Return:
void
###<h3 id="GetActive">.GetActive()</h3>
### <h3 id="GetActive">.GetActive()</h3>
Get the Active Window
####Arguments:
#### Arguments:
None
####Return:
#### Return:
Returns hwnd
###<h3 id="SetHandle">.SetHandle()</h3>
### <h3 id="SetHandle">.SetHandle()</h3>
Set the Window Handle
####Arguments:
#### Arguments:
int
####Return:
#### Return:
bool
###<h3 id="GetHandle">.GetHandle()</h3>
### <h3 id="GetHandle">.GetHandle()</h3>
Get the Window Handle
####Arguments:
#### Arguments:
None
####Return:
#### Return:
Returns hwnd
###<h3 id="GetTitle">.GetTitle()</h3>
### <h3 id="GetTitle">.GetTitle()</h3>
Get the Window Title
####Arguments:
#### Arguments:
None
####Return:
#### Return:
Returns Window Title
###<h3 id="GetPID">.GetPID()</h3>
### <h3 id="GetPID">.GetPID()</h3>
Get the process id
####Arguments:
#### Arguments:
None
####Return:
#### Return:
Returns the process id