https://github.com/mariuspass/kbd
Simple library to simulate key press in Windows
https://github.com/mariuspass/kbd
go golang kbd keybd-event keyboard windows
Last synced: 5 months ago
JSON representation
Simple library to simulate key press in Windows
- Host: GitHub
- URL: https://github.com/mariuspass/kbd
- Owner: mariuspass
- License: mit
- Created: 2017-03-06T14:14:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T18:34:23.000Z (about 9 years ago)
- Last Synced: 2024-06-19T05:43:25.761Z (almost 2 years ago)
- Topics: go, golang, kbd, keybd-event, keyboard, windows
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kbd
### a simple library to simulate key press in Windows
**Example:**
```golang
package main
import (
"time"
"github.com/mariuspass/kbd"
)
func main() {
time.Sleep(time.Second * 2)
// will type 'Lorem ipsum dolor sit amet.' to the foreground window
kbd.TypeString(`Lorem ipsum dolor sit amet.`)
time.Sleep(time.Second * 2)
// will press Windows Key + E
kbd.ToggleKey(kbd.KeyE, kbd.KeyDown, kbd.ModMeta)
// will release Windows Key + E
kbd.ToggleKey(kbd.KeyE, kbd.KeyUp, kbd.ModMeta)
// Windows Explorer should be open
time.Sleep(time.Second * 2)
// will tap(press and release) Ctrl+Shift+Escape
kbd.TapKeys([]kbd.Code{kbd.Escape}, kbd.ModShift|kbd.ModControl)
// Task Manager should be open
}