mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 07:33:55 +00:00
update example README.md
This commit is contained in:
parent
8865d93a65
commit
f1e31356d2
@ -30,7 +30,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-vgo/robotgo"
|
|
||||||
|
"github.com/go-vgo/robotgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -46,7 +47,7 @@ func main() {
|
|||||||
arr := []string{"alt", "command"}
|
arr := []string{"alt", "command"}
|
||||||
robotgo.KeyTap("i", arr)
|
robotgo.KeyTap("i", arr)
|
||||||
|
|
||||||
robotgo.WriteAll("测试")
|
robotgo.WriteAll("Test")
|
||||||
text, err := robotgo.ReadAll()
|
text, err := robotgo.ReadAll()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Println(text)
|
fmt.Println(text)
|
||||||
@ -134,11 +135,21 @@ func main() {
|
|||||||
fpid, err := robotgo.FindIds("Google")
|
fpid, err := robotgo.FindIds("Google")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Println("pids...", fpid)
|
fmt.Println("pids...", fpid)
|
||||||
|
|
||||||
|
if len(fpid) > 0 {
|
||||||
|
robotgo.ActivePID(fpid[0])
|
||||||
|
|
||||||
|
robotgo.Kill(fpid[0])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
robotgo.ActiveName("chrome")
|
||||||
|
|
||||||
isExist, err := robotgo.PidExists(100)
|
isExist, err := robotgo.PidExists(100)
|
||||||
if err == nil {
|
if err == nil && isExist {
|
||||||
fmt.Println("pid exists is", isExist)
|
fmt.Println("pid exists is", isExist)
|
||||||
|
|
||||||
|
robotgo.Kill(100)
|
||||||
}
|
}
|
||||||
|
|
||||||
abool := robotgo.ShowAlert("test", "robotgo")
|
abool := robotgo.ShowAlert("test", "robotgo")
|
||||||
@ -149,4 +160,4 @@ func main() {
|
|||||||
title := robotgo.GetTitle()
|
title := robotgo.GetTitle()
|
||||||
fmt.Println("title@@@", title)
|
fmt.Println("title@@@", title)
|
||||||
}
|
}
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user