add more examples

This commit is contained in:
vcaesar 2018-01-18 21:39:27 +08:00
parent 4ff2a48182
commit a2ac46c3be
5 changed files with 31 additions and 1 deletions

View File

@ -30,6 +30,9 @@ func main() {
bitmap := robotgo.CaptureScreen(100, 200, 30, 40)
fmt.Println("CaptureScreen...", bitmap)
gbit := robotgo.ToBitmap(bitmap)
fmt.Println("go bitmap", gbit, gbit.Width)
// searches for needle in bitmap
fx, fy := robotgo.FindBit(bitmap)
fmt.Println("FindBitmap------", fx, fy)

View File

@ -25,6 +25,13 @@ func main() {
// importing "Hello World"
robotgo.TypeString("Hello World")
robotgo.TypeString("留给真爱你的人")
robotgo.TypeStr("留给真爱你的人")
ustr := uint32(robotgo.CharCodeAt("留给真爱你的人", 0))
robotgo.UnicodeType(ustr)
robotgo.PasteStr("粘贴字符串, paste")
// press "enter"
robotgo.KeyTap("enter")
robotgo.KeyTap("a", "control")

View File

@ -25,6 +25,13 @@ func key() {
// importing "Hello World"
robotgo.TypeString("Hello World")
robotgo.TypeString("留给真爱你的人")
robotgo.TypeStr("留给真爱你的人")
ustr := uint32(robotgo.CharCodeAt("留给真爱你的人", 0))
robotgo.UnicodeType(ustr)
robotgo.PasteStr("粘贴字符串, paste")
// press "enter"
robotgo.KeyTap("enter")
robotgo.KeyTap("a", "control")
@ -159,6 +166,9 @@ func bitmap() {
bitmap := robotgo.CaptureScreen(100, 200, 30, 40)
fmt.Println("CaptureScreen...", bitmap)
gbit := robotgo.ToBitmap(bitmap)
fmt.Println("go bitmap", gbit, gbit.Width)
// searches for needle in bitmap
fx, fy := robotgo.FindBit(bitmap)
fmt.Println("FindBitmap------", fx, fy)
@ -286,7 +296,12 @@ func window() {
fpid, err := robotgo.FindIds("Google")
if err == nil {
fmt.Println("pids...", fpid)
if len(fpid) > 0 {
robotgo.ActivePID(fpid[0])
}
}
robotgo.ActiveName("chrome")
// determine whether the process exists
isExist, err := robotgo.PidExists(100)

View File

@ -55,7 +55,12 @@ func main() {
fpid, err := robotgo.FindIds("Google")
if err == nil {
fmt.Println("pids...", fpid)
if len(fpid) > 0 {
robotgo.ActivePID(fpid[0])
}
}
robotgo.ActiveName("chrome")
// determine whether the process exists
isExist, err := robotgo.PidExists(100)

View File

@ -63,7 +63,7 @@ import (
)
const (
version string = "v0.47.0.485, Mount Cook!"
version string = "v0.47.0.487, Mount Cook!"
)
type (