Update README.md

This commit is contained in:
vcaesar 2021-10-13 15:23:36 -04:00
parent ad5a1aa7ca
commit 7643a714b8
2 changed files with 40 additions and 20 deletions

View File

@ -131,8 +131,12 @@ import (
func main() { func main() {
robotgo.ScrollMouse(10, "up") robotgo.ScrollMouse(10, "up")
robotgo.Scroll(100, 200) robotgo.Scroll(100, 200)
robotgo.MilliSleep(100)
robotgo.ScrollRelative(10, -100)
robotgo.Move(10, 10) robotgo.MouseSleep = 100
robotgo.Move(10, 20)
robotgo.MoveRelative(0, -10)
robotgo.Drag(10, 10) robotgo.Drag(10, 10)
robotgo.Click("left", true) robotgo.Click("left", true)
@ -163,6 +167,7 @@ func main() {
// ustr := uint32(robotgo.CharCodeAt("Test", 0)) // ustr := uint32(robotgo.CharCodeAt("Test", 0))
// robotgo.UnicodeType(ustr) // robotgo.UnicodeType(ustr)
robotgo.KeySleep = 100
robotgo.KeyTap("enter") robotgo.KeyTap("enter")
// robotgo.TypeStr("en") // robotgo.TypeStr("en")
robotgo.KeyTap("i", "alt", "command") robotgo.KeyTap("i", "alt", "command")
@ -170,6 +175,7 @@ func main() {
arr := []string{"alt", "command"} arr := []string{"alt", "command"}
robotgo.KeyTap("i", arr) robotgo.KeyTap("i", arr)
robotgo.MilliSleep(100)
robotgo.KeyToggle("a", "down") robotgo.KeyToggle("a", "down")
robotgo.WriteAll("Test") robotgo.WriteAll("Test")
@ -249,25 +255,29 @@ func main() {
func opencv() { func opencv() {
name := "test.png" name := "test.png"
name1 := "test_001.png" name1 := "test_001.png"
robotgo.SaveCapture(name, 10, 10, 30, 30) robotgo.SaveCapture(name1, 10, 10, 30, 30)
robotgo.SaveCapture(name1) robotgo.SaveCapture(name)
fmt.Print("gcv find image: ") fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImgFile(name, name1)) fmt.Println(gcv.FindImgFile(name1, name))
fmt.Println(gcv.FindAllImgFile(name1, name))
bit := robotgo.OpenBitmap(name) bit := robotgo.OpenBitmap(name1)
defer robotgo.FindBitmap(bit) defer robotgo.FindBitmap(bit)
fmt.Print("find bitmap: ") fmt.Print("find bitmap: ")
fmt.Println(robotgo.FindBitmap(bit)) fmt.Println(robotgo.FindBitmap(bit))
bit0 := robotgo.CaptureScreen() // bit0 := robotgo.CaptureScreen()
img := robotgo.ToImage(bit0) // img := robotgo.ToImage(bit0)
bit1 := robotgo.CaptureScreen(10, 10, 30, 30) // bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
img1 := robotgo.ToImage(bit1) // img1 := robotgo.ToImage(bit1)
defer robotgo.FreeBitmapArr(bit0, bit1) // defer robotgo.FreeBitmapArr(bit0, bit1)
img := robotgo.CaptureImg()
img1 := robotgo.CaptureImg(10, 10, 30, 30)
fmt.Print("gcv find image: ") fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImg(img1, img)) fmt.Println(gcv.FindImg(img1, img))
fmt.Println(gcv.FindAllImg(img1, img))
} }
``` ```

View File

@ -129,8 +129,12 @@ import (
func main() { func main() {
robotgo.ScrollMouse(10, "up") robotgo.ScrollMouse(10, "up")
robotgo.Scroll(100, 200) robotgo.Scroll(100, 200)
robotgo.MilliSleep(100)
robotgo.ScrollRelative(10, -100)
robotgo.Move(10, 10) robotgo.MouseSleep = 100
robotgo.Move(10, 20)
robotgo.MoveRelative(0, -10)
robotgo.Drag(10, 10) robotgo.Drag(10, 10)
robotgo.Click("left", true) robotgo.Click("left", true)
@ -161,6 +165,7 @@ func main() {
// ustr := uint32(robotgo.CharCodeAt("テストする", 0)) // ustr := uint32(robotgo.CharCodeAt("テストする", 0))
// robotgo.UnicodeType(ustr) // robotgo.UnicodeType(ustr)
robotgo.KeySleep = 100
robotgo.KeyTap("enter") robotgo.KeyTap("enter")
// robotgo.TypeStr("en") // robotgo.TypeStr("en")
robotgo.KeyTap("i", "alt", "command") robotgo.KeyTap("i", "alt", "command")
@ -168,6 +173,7 @@ func main() {
arr := []string{"alt", "command"} arr := []string{"alt", "command"}
robotgo.KeyTap("i", arr) robotgo.KeyTap("i", arr)
robotgo.MilliSleep(100)
robotgo.KeyToggle("a", "down") robotgo.KeyToggle("a", "down")
robotgo.WriteAll("テストする") robotgo.WriteAll("テストする")
@ -247,25 +253,29 @@ func main() {
func opencv() { func opencv() {
name := "test.png" name := "test.png"
name1 := "test_001.png" name1 := "test_001.png"
robotgo.SaveCapture(name, 10, 10, 30, 30) robotgo.SaveCapture(name1, 10, 10, 30, 30)
robotgo.SaveCapture(name1) robotgo.SaveCapture(name)
fmt.Print("gcv find image: ") fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImgFile(name, name1)) fmt.Println(gcv.FindImgFile(name1, name))
fmt.Println(gcv.FindAllImgFile(name1, name))
bit := robotgo.OpenBitmap(name) bit := robotgo.OpenBitmap(name1)
defer robotgo.FindBitmap(bit) defer robotgo.FindBitmap(bit)
fmt.Print("find bitmap: ") fmt.Print("find bitmap: ")
fmt.Println(robotgo.FindBitmap(bit)) fmt.Println(robotgo.FindBitmap(bit))
bit0 := robotgo.CaptureScreen() // bit0 := robotgo.CaptureScreen()
img := robotgo.ToImage(bit0) // img := robotgo.ToImage(bit0)
bit1 := robotgo.CaptureScreen(10, 10, 30, 30) // bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
img1 := robotgo.ToImage(bit1) // img1 := robotgo.ToImage(bit1)
defer robotgo.FreeBitmapArr(bit0, bit1) // defer robotgo.FreeBitmapArr(bit0, bit1)
img := robotgo.CaptureImg()
img1 := robotgo.CaptureImg(10, 10, 30, 30)
fmt.Print("gcv find image: ") fmt.Print("gcv find image: ")
fmt.Println(gcv.FindImg(img1, img)) fmt.Println(gcv.FindImg(img1, img))
fmt.Println(gcv.FindAllImg(img1, img))
} }
``` ```