Update examples and README.md

This commit is contained in:
vcaesar 2021-11-24 15:49:00 -04:00
parent b9cb452594
commit f8539139b7
5 changed files with 17 additions and 16 deletions

View File

@ -17,9 +17,10 @@ import (
) )
func main() { func main() {
robotgo.ScrollMouse(10, "up") // robotgo.ScrollMouse(10, "up")
robotgo.Scroll(0, 10)
robotgo.MouseClick("left", true) robotgo.MouseClick("left", true)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0) robotgo.MoveSmooth(100, 200, 1.0, 100.0)
} }
``` ```

View File

@ -46,7 +46,7 @@ func test() {
fx, fy := robotgo.FindBitmap(bit2) fx, fy := robotgo.FindBitmap(bit2)
fmt.Println("FindBitmap------ ", fx, fy) fmt.Println("FindBitmap------ ", fx, fy)
arr := robotgo.FindEveryBitmap(bit2) arr := robotgo.FindAllBitmap(bit2)
fmt.Println("Find every bitmap: ", arr) fmt.Println("Find every bitmap: ", arr)
robotgo.SaveBitmap(bitmap, "test.png") robotgo.SaveBitmap(bitmap, "test.png")
} }

View File

@ -59,7 +59,7 @@ func findColor(bmp robotgo.CBitmap) {
cnt1 := robotgo.CountColorCS(0xAADCDC, 10, 20, 30, 40) cnt1 := robotgo.CountColorCS(0xAADCDC, 10, 20, 30, 40)
fmt.Println("count...", cnt1) fmt.Println("count...", cnt1)
arr := robotgo.FindEveryColor(0xAADCDC) arr := robotgo.FindAllColor(0xAADCDC)
fmt.Println("find all color: ", arr) fmt.Println("find all color: ", arr)
for i := 0; i < len(arr); i++ { for i := 0; i < len(arr); i++ {
fmt.Println("pos is: ", arr[i].X, arr[i].Y) fmt.Println("pos is: ", arr[i].X, arr[i].Y)
@ -160,7 +160,7 @@ func findBitmap(bmp robotgo.CBitmap) {
fx, fy = robotgo.FindPic("test.tif") fx, fy = robotgo.FindPic("test.tif")
fmt.Println("FindPic------", fx, fy) fmt.Println("FindPic------", fx, fy)
arr := robotgo.FindEveryBitmap(openbit) arr := robotgo.FindAllBitmap(openbit)
fmt.Println("find all bitmap: ", arr) fmt.Println("find all bitmap: ", arr)
for i := 0; i < len(arr); i++ { for i := 0; i < len(arr); i++ {
fmt.Println("pos is: ", arr[i].X, arr[i].Y) fmt.Println("pos is: ", arr[i].X, arr[i].Y)

View File

@ -33,7 +33,7 @@ func move() {
// smooth move the mouse to 100, 200 // smooth move the mouse to 100, 200
robotgo.MoveSmooth(100, 200) robotgo.MoveSmooth(100, 200)
robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0) robotgo.MoveSmooth(100, 200, 1.0, 100.0)
robotgo.MoveSmoothRelative(10, -100, 1.0, 30.0) robotgo.MoveSmoothRelative(10, -100, 1.0, 30.0)
for i := 0; i < 1080; i += 1000 { for i := 0; i < 1080; i += 1000 {
@ -68,13 +68,13 @@ func get() {
func toggleAndScroll() { func toggleAndScroll() {
// scrolls the mouse either up // scrolls the mouse either up
robotgo.ScrollMouse(10, "up") // robotgo.ScrollMouse(10, "up")
robotgo.Scroll(100, 200) robotgo.Scroll(100, 10)
robotgo.Scroll(0, -10)
// toggles right mouse button // toggles the right mouse button
robotgo.MouseToggle("down", "right") robotgo.Toggle("right")
robotgo.Toggle("right", "up")
robotgo.MouseToggle("up")
} }
func mouse() { func mouse() {

View File

@ -26,14 +26,14 @@ func aRobotgo() {
x, y := robotgo.GetMousePos() x, y := robotgo.GetMousePos()
fmt.Println("pos:", x, y) fmt.Println("pos:", x, y)
robotgo.MoveMouse(x, y) robotgo.Move(x, y)
robotgo.MoveMouse(100, 200) robotgo.Move(100, 200)
robotgo.MouseToggle("up") robotgo.MouseToggle("up")
for i := 0; i < 1080; i += 1000 { for i := 0; i < 1080; i += 1000 {
fmt.Println(i) fmt.Println(i)
robotgo.MoveMouse(800, i) robotgo.Move(800, i)
} }
fmt.Println(robotgo.GetPixelColor(x, y)) fmt.Println(robotgo.GetPixelColor(x, y))
@ -65,7 +65,7 @@ func aRobotgo() {
fmt.Println("...type", reflect.TypeOf(bitTest), reflect.TypeOf(bitmapTest)) fmt.Println("...type", reflect.TypeOf(bitTest), reflect.TypeOf(bitmapTest))
// robotgo.MouseClick() // robotgo.MouseClick()
robotgo.ScrollMouse(10, "up") robotgo.Scroll(0, 10)
} }
func main() { func main() {