input

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
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

func KeyDown(key uint16) error

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

func KeyUp(key uint16) error

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

func LeftClickAt(x, y int) error

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

func LeftDoubleClickAt(x, y int) error

LeftDoubleClickAt moves the mouse to screen coordinates x,y and clicks the left mouse button twice.

func LeftDown

func LeftDown(x, y int) error

LeftDown presses the left mouse button down.

func LeftUp

func LeftUp() error

LeftUp releases the left mouse button.

func MiddleClick

func MiddleClick() error

MiddleClick clicks the middle mouse button, i.e. presses and releases it.

func MiddleClickAt

func MiddleClickAt(x, y int) error

MiddleClickAt moves the mouse to screen coordinates x,y and clicks the middle mouse button.

func MiddleDown

func MiddleDown(x, y int) error

MiddleDown presses the middle mouse button down.

func MiddleUp

func MiddleUp() error

MiddleUp releases the middle mouse button.

func MoveMouseBy

func MoveMouseBy(dx, dy int) error

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

func MoveMouseTo(x, y int) error

MoveMouseTo move the mouse cursor to the given screen coordinates.

func PressKey

func PressKey(key uint16) error

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

func RightClickAt(x, y int) error

RightClickAt moves the mouse to screen coordinates x,y and clicks the right mouse button.

func RightDown

func RightDown(x, y int) error

RightDown presses the right mouse button down.

func RightUp

func RightUp() error

RightUp releases the right mouse button.

func SetClipboardText

func SetClipboardText(text string)

SetClipboardText sets the contents of the clipboard to the given string.

func Type

func Type(s string) error

Type will write the given text using Alt+Numpad numbers. It will sleep the smallest, non-0 delay between two letters.

func TypeWithDelay added in v1.1.0

func TypeWithDelay(s string, delay time.Duration) error

TypeWithDelay will write the given text using Alt+Numpad numbers. It will sleep the given delay between two letters.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL