diff --git a/docs/doc.md b/docs/doc.md index a6a268a..a3e934a 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -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) -###

.GetVersion()

+###

.GetVersion()

get robotgo version -##

Keyboard

+##

Keyboard

-###

.SetKeyDelay(ms)

+###

.SetKeyDelay(ms)

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) ``` -###

.KeyToggle(key, down, modifier)

+###

.KeyToggle(key, down, modifier)

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 -###

.TypeString(string)

+###

.TypeString(string)

-####Arguments: +#### Arguments: string - The string to send. -###

.TypeStrDelay(string, cpm)

+###

.TypeStrDelay(string, cpm)

-####Arguments: +#### Arguments: string - The string to send. cpm - Characters per minute. -##

Mouse

+##

Mouse

-###

.SetMouseDelay(ms)

+###

.SetMouseDelay(ms)

Sets the delay in milliseconds to sleep after a mouse event. This is 10ms by default. -####Arguments: +#### Arguments: ms - Time to sleep in milliseconds. -###

.MoveMouse(x, y)

+###

.MoveMouse(x, y)

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) ``` -###

.MoveMouseSmooth(x, y)

+###

.MoveMouseSmooth(x, y)

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) ``` -###

.MouseClick(button, double)

+###

.MouseClick(button, double)

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) ``` -###

.MoveClick(x, y, button, double)

+###

.MoveClick(x, y, button, double)

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) ``` -###

.MouseToggle(down, button)

+###

.MouseToggle(down, button)

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") ``` -###

.DragMouse(x, y)

+###

.DragMouse(x, y)

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") ``` -###

.GetMousePos()

+###

.GetMousePos()

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) ``` -###

.ScrollMouse(magnitude, direction)

+###

.ScrollMouse(magnitude, direction)

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") ``` -##

Screen

+##

Screen

-###

.GetPixelColor(x, y) +###

.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. -###

.GetScreenSize()

+###

.GetScreenSize()

Gets the screen width and height. -####Return: +#### Return: Returns an object with .width and .height. -###

.CaptureScreen

+###

.CaptureScreen

// 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. -##

Bitmap

+##

Bitmap

This is a work in progress. -###

.FindBitmap

+###

.FindBitmap

find bitmap. -####Arguments: +#### Arguments: bitmap; rect(optional): x, y, w, h -####Return: +#### Return: Returns a position x and y -###

.OpenBitmap

+###

.OpenBitmap

open bitmap. -####Arguments: +#### Arguments: bitmap image path, MMImageType(optional) -####Return: +#### Return: Returns a bitmap -###

.SaveBitmap

+###

.SaveBitmap

save a image with bitmap. -####Arguments: +#### Arguments: bitmap, path, imagetype(int) -####Return: +#### Return: return save image status -###

.TostringBitmap

+###

.TostringBitmap

bitmap to string -####Arguments: +#### Arguments: bitmap -####Return: +#### Return: Return a sting bitmap -###

.GetPortion

+###

.GetPortion

bitmap from a portion -####Arguments: +#### Arguments: bitmap, rect: x, y, w, h -####Return: +#### Return: Returns new bitmap object created from a portion of another -###

.Convert(openpath, savepath,MMImageType)

+###

.Convert(openpath, savepath,MMImageType)

Convert the image format -####Arguments: +#### Arguments: openpath, savepath, MMImageType(optional) -####Examples: +#### Examples: ```Go robotgo.Convert("test.png", "test.tif") ``` -##

Event

+##

Event

-###

.AddEvent(string)

+###

.AddEvent(string)

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() { } } ``` -###

.StopEvent()

+###

.StopEvent()

stop listen global event -##

Window

+##

Window

-###

.ShowAlert(title, msg,defaultButton,cancelButton string)

+###

.ShowAlert(title, msg,defaultButton,cancelButton string)

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. -###

.CloseWindow()

+###

.CloseWindow()

Close the Window -####Arguments: +#### Arguments: None -####Return: +#### Return: None -###

.IsValid()

+###

.IsValid()

Valid the Window -####Arguments: +#### Arguments: None -####Return: +#### Return: Returns true if a window has been selected -###

.SetActive()

+###

.SetActive()

Set the Active Window -####Arguments: +#### Arguments: hwnd -####Return: +#### Return: void -###

.GetActive()

+###

.GetActive()

Get the Active Window -####Arguments: +#### Arguments: None -####Return: +#### Return: Returns hwnd -###

.SetHandle()

+###

.SetHandle()

Set the Window Handle -####Arguments: +#### Arguments: int -####Return: +#### Return: bool -###

.GetHandle()

+###

.GetHandle()

Get the Window Handle -####Arguments: +#### Arguments: None -####Return: +#### Return: Returns hwnd -###

.GetTitle()

+###

.GetTitle()

Get the Window Title -####Arguments: +#### Arguments: None -####Return: +#### Return: Returns Window Title -###

.GetPID()

+###

.GetPID()

Get the process id -####Arguments: +#### Arguments: None -####Return: +#### Return: Returns the process id