From f1e31356d279e27ca398511d86ed59de9a356c23 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 27 Mar 2018 23:25:30 +0800 Subject: [PATCH] update example README.md --- examples/README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/README.md b/examples/README.md index 0f7c188..7d3bbf2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -30,7 +30,8 @@ package main import ( "fmt" - "github.com/go-vgo/robotgo" + + "github.com/go-vgo/robotgo" ) func main() { @@ -46,7 +47,7 @@ func main() { arr := []string{"alt", "command"} robotgo.KeyTap("i", arr) - robotgo.WriteAll("测试") + robotgo.WriteAll("Test") text, err := robotgo.ReadAll() if err == nil { fmt.Println(text) @@ -134,11 +135,21 @@ func main() { fpid, err := robotgo.FindIds("Google") if err == nil { fmt.Println("pids...", fpid) + + if len(fpid) > 0 { + robotgo.ActivePID(fpid[0]) + + robotgo.Kill(fpid[0]) + } } + robotgo.ActiveName("chrome") + isExist, err := robotgo.PidExists(100) - if err == nil { + if err == nil && isExist { fmt.Println("pid exists is", isExist) + + robotgo.Kill(100) } abool := robotgo.ShowAlert("test", "robotgo") @@ -149,4 +160,4 @@ func main() { title := robotgo.GetTitle() fmt.Println("title@@@", title) } -``` +``` \ No newline at end of file