Update README.md, add more examples

This commit is contained in:
vcaesar 2020-06-09 11:02:01 -04:00
parent eedf0d1855
commit 37921d6678
2 changed files with 34 additions and 0 deletions

View File

@ -230,6 +230,12 @@ import (
)
func main() {
add()
low()
event()
}
func add() {
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
fmt.Println("ctrl-shift-q")
@ -243,7 +249,18 @@ func main() {
s := robotgo.EventStart()
<-robotgo.EventProcess(s)
}
func low() {
EvChan := hook.Start()
defer hook.End()
for ev := range EvChan {
fmt.Println("hook: ", ev)
}
}
func event() {
ok := robotgo.AddEvents("q", "ctrl", "shift")
if ok {
fmt.Println("add events...")

View File

@ -227,6 +227,12 @@ import (
)
func main() {
add()
low()
event()
}
func add() {
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
fmt.Println("ctrl-shift-q")
@ -240,7 +246,18 @@ func main() {
s := robotgo.EventStart()
<-robotgo.EventProcess(s)
}
func low() {
EvChan := hook.Start()
defer hook.End()
for ev := range EvChan {
fmt.Println("hook: ", ev)
}
}
func event() {
ok := robotgo.AddEvents("q", "ctrl", "shift")
if ok {
fmt.Println("add events...")