mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-11 02:23:58 +00:00
Update README.md
This commit is contained in:
parent
ad5a1aa7ca
commit
7643a714b8
30
README.md
30
README.md
@ -131,8 +131,12 @@ import (
|
||||
func main() {
|
||||
robotgo.ScrollMouse(10, "up")
|
||||
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.Click("left", true)
|
||||
@ -163,6 +167,7 @@ func main() {
|
||||
// ustr := uint32(robotgo.CharCodeAt("Test", 0))
|
||||
// robotgo.UnicodeType(ustr)
|
||||
|
||||
robotgo.KeySleep = 100
|
||||
robotgo.KeyTap("enter")
|
||||
// robotgo.TypeStr("en")
|
||||
robotgo.KeyTap("i", "alt", "command")
|
||||
@ -170,6 +175,7 @@ func main() {
|
||||
arr := []string{"alt", "command"}
|
||||
robotgo.KeyTap("i", arr)
|
||||
|
||||
robotgo.MilliSleep(100)
|
||||
robotgo.KeyToggle("a", "down")
|
||||
|
||||
robotgo.WriteAll("Test")
|
||||
@ -249,25 +255,29 @@ func main() {
|
||||
func opencv() {
|
||||
name := "test.png"
|
||||
name1 := "test_001.png"
|
||||
robotgo.SaveCapture(name, 10, 10, 30, 30)
|
||||
robotgo.SaveCapture(name1)
|
||||
robotgo.SaveCapture(name1, 10, 10, 30, 30)
|
||||
robotgo.SaveCapture(name)
|
||||
|
||||
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)
|
||||
fmt.Print("find bitmap: ")
|
||||
fmt.Println(robotgo.FindBitmap(bit))
|
||||
|
||||
bit0 := robotgo.CaptureScreen()
|
||||
img := robotgo.ToImage(bit0)
|
||||
bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
|
||||
img1 := robotgo.ToImage(bit1)
|
||||
defer robotgo.FreeBitmapArr(bit0, bit1)
|
||||
// bit0 := robotgo.CaptureScreen()
|
||||
// img := robotgo.ToImage(bit0)
|
||||
// bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
|
||||
// img1 := robotgo.ToImage(bit1)
|
||||
// defer robotgo.FreeBitmapArr(bit0, bit1)
|
||||
img := robotgo.CaptureImg()
|
||||
img1 := robotgo.CaptureImg(10, 10, 30, 30)
|
||||
|
||||
fmt.Print("gcv find image: ")
|
||||
fmt.Println(gcv.FindImg(img1, img))
|
||||
fmt.Println(gcv.FindAllImg(img1, img))
|
||||
}
|
||||
```
|
||||
|
||||
|
30
README_zh.md
30
README_zh.md
@ -129,8 +129,12 @@ import (
|
||||
func main() {
|
||||
robotgo.ScrollMouse(10, "up")
|
||||
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.Click("left", true)
|
||||
@ -161,6 +165,7 @@ func main() {
|
||||
// ustr := uint32(robotgo.CharCodeAt("テストする", 0))
|
||||
// robotgo.UnicodeType(ustr)
|
||||
|
||||
robotgo.KeySleep = 100
|
||||
robotgo.KeyTap("enter")
|
||||
// robotgo.TypeStr("en")
|
||||
robotgo.KeyTap("i", "alt", "command")
|
||||
@ -168,6 +173,7 @@ func main() {
|
||||
arr := []string{"alt", "command"}
|
||||
robotgo.KeyTap("i", arr)
|
||||
|
||||
robotgo.MilliSleep(100)
|
||||
robotgo.KeyToggle("a", "down")
|
||||
|
||||
robotgo.WriteAll("テストする")
|
||||
@ -247,25 +253,29 @@ func main() {
|
||||
func opencv() {
|
||||
name := "test.png"
|
||||
name1 := "test_001.png"
|
||||
robotgo.SaveCapture(name, 10, 10, 30, 30)
|
||||
robotgo.SaveCapture(name1)
|
||||
robotgo.SaveCapture(name1, 10, 10, 30, 30)
|
||||
robotgo.SaveCapture(name)
|
||||
|
||||
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)
|
||||
fmt.Print("find bitmap: ")
|
||||
fmt.Println(robotgo.FindBitmap(bit))
|
||||
|
||||
bit0 := robotgo.CaptureScreen()
|
||||
img := robotgo.ToImage(bit0)
|
||||
bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
|
||||
img1 := robotgo.ToImage(bit1)
|
||||
defer robotgo.FreeBitmapArr(bit0, bit1)
|
||||
// bit0 := robotgo.CaptureScreen()
|
||||
// img := robotgo.ToImage(bit0)
|
||||
// bit1 := robotgo.CaptureScreen(10, 10, 30, 30)
|
||||
// img1 := robotgo.ToImage(bit1)
|
||||
// defer robotgo.FreeBitmapArr(bit0, bit1)
|
||||
img := robotgo.CaptureImg()
|
||||
img1 := robotgo.CaptureImg(10, 10, 30, 30)
|
||||
|
||||
fmt.Print("gcv find image: ")
|
||||
fmt.Println(gcv.FindImg(img1, img))
|
||||
fmt.Println(gcv.FindAllImg(img1, img))
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user