Documentation ¶
Index ¶
- Constants
- func ClipboardText() string
- func ForegroundWindowClassName() string
- func ForegroundWindowTitle() string
- func KeyDown(key uint16) error
- func KeyUp(key uint16) error
- func LeftClick() error
- func LeftClickAt(x, y int) error
- func LeftDoubleClick() error
- func LeftDoubleClickAt(x, y int) error
- func LeftDown(x, y int) error
- func LeftUp() error
- func MiddleClick() error
- func MiddleClickAt(x, y int) error
- func MiddleDown(x, y int) error
- func MiddleUp() error
- func MoveMouseBy(dx, dy int) error
- func MoveMouseTo(x, y int) error
- func PressKey(key uint16) error
- func RightClick() error
- func RightClickAt(x, y int) error
- func RightDown(x, y int) error
- func RightUp() error
- func SetClipboardText(text string)
- func Type(s string) error
- func TypeWithDelay(s string, delay time.Duration) error
Constants ¶
const ( // ErrBlocked happens when the winapi function SendInput is blocked by User // Interface Privilege Isolation. ErrBlocked errString = "w32.SendInput returned 0, meaning input was blocked" // ErrGetCursorFailed happens when the winapi function GetCursorPos fails. ErrGetCursorFailed errString = "w32.GetCursorPos failed" // ErrSetCursorFailed happens when the winapi function SetCursorPos fails. ErrSetCursorFailed errString = "w32.SetCursorPos failed" )
Variables ¶
This section is empty.
Functions ¶
func ClipboardText ¶
func ClipboardText() string
ClipboardText returns the contents of the clipboard as text. If the clipboard is empty or does not contain text it returns "".
func ForegroundWindowClassName ¶
func ForegroundWindowClassName() string
ForegroundWindowClassName returns the class name of the window that currently has the focus.
func ForegroundWindowTitle ¶
func ForegroundWindowTitle() string
ForegroundWindowTitle returns the title of the window that currently has the focus. The desktop window usually has title "".
func KeyDown ¶
KeyDown presses the given key on the keyboard. The value must be a virtual keycode like 'A', '1' or VK_RETURN (you can use the constants in github.com/gonutz/w32 VK_...).
func KeyUp ¶
KeyUp releases the given key on the keyboard. The value must be a virtual keycode like 'A', '1' or VK_RETURN (you can use the constants in github.com/gonutz/w32 VK_...).
func LeftClick ¶
func LeftClick() error
LeftClick clicks the left mouse button, i.e. presses and releases it.
func LeftClickAt ¶
LeftClickAt moves the mouse to screen coordinates x,y and clicks the left mouse button.
func LeftDoubleClick ¶
func LeftDoubleClick() error
LeftDoubleClick clicks the left mouse button twice.
func LeftDoubleClickAt ¶
LeftDoubleClickAt moves the mouse to screen coordinates x,y and clicks the left mouse button twice.
func MiddleClick ¶
func MiddleClick() error
MiddleClick clicks the middle mouse button, i.e. presses and releases it.
func MiddleClickAt ¶
MiddleClickAt moves the mouse to screen coordinates x,y and clicks the middle mouse button.
func MoveMouseBy ¶
MoveMouseBy moves the mouse cursor by the given amount of pixels in x and y. Note that positive dy means the cursor is move down on the screen.
func MoveMouseTo ¶
MoveMouseTo move the mouse cursor to the given screen coordinates.
func PressKey ¶
PressKey presses and releases the given key on the keyboard. The value must be a virtual keycode like 'A', '1' or VK_RETURN (you can use the constants in github.com/gonutz/w32 VK_...).
func RightClick ¶
func RightClick() error
RightClick clicks the right mouse button, i.e. presses and releases it.
func RightClickAt ¶
RightClickAt moves the mouse to screen coordinates x,y and clicks the right mouse button.
func SetClipboardText ¶
func SetClipboardText(text string)
SetClipboardText sets the contents of the clipboard to the given string.
Types ¶
This section is empty.