Update examples and godoc

This commit is contained in:
vcaesar 2021-10-18 12:43:34 -04:00
parent fe1a46368f
commit 86da52b96d
3 changed files with 14 additions and 10 deletions

View File

@ -20,13 +20,13 @@ import (
func typeStr() { func typeStr() {
// importing "Hello World" // importing "Hello World"
robotgo.TypeStr("Hello World!", 1.0) robotgo.TypeStr("Hello World!", 1.0)
robotgo.KeySleep = 100
robotgo.TypeStr("だんしゃり") robotgo.TypeStr("だんしゃり")
robotgo.MicroSleep(10.2)
robotgo.TypeStr("Hi galaxy. こんにちは世界.") robotgo.TypeStr("Hi galaxy. こんにちは世界. 你好, 再见!")
robotgo.Sleep(2)
// robotgo.TypeStr("So, hi, bye!") robotgo.Sleep(1)
robotgo.TypeStr("So, hi, bye!")
robotgo.MilliSleep(100) robotgo.MilliSleep(100)
ustr := uint32(robotgo.CharCodeAt("So, hi, bye!", 0)) ustr := uint32(robotgo.CharCodeAt("So, hi, bye!", 0))
@ -38,6 +38,7 @@ func typeStr() {
func keyTap() { func keyTap() {
// press "enter" // press "enter"
robotgo.KeyTap("enter") robotgo.KeyTap("enter")
robotgo.KeySleep = 200
robotgo.KeyTap("a") robotgo.KeyTap("a")
robotgo.MilliSleep(100) robotgo.MilliSleep(100)
robotgo.KeyTap("a", "ctrl") robotgo.KeyTap("a", "ctrl")
@ -71,6 +72,7 @@ func keyTap() {
} }
func keyToggle() { func keyToggle() {
// robotgo.KeySleep = 150
robotgo.KeyToggle("a", "down") robotgo.KeyToggle("a", "down")
robotgo.KeyToggle("a", "down", "alt") robotgo.KeyToggle("a", "down", "alt")
robotgo.Sleep(1) robotgo.Sleep(1)

View File

@ -18,11 +18,12 @@ import (
) )
func move() { func move() {
robotgo.MouseSleep = 100
robotgo.Move(100, 200) robotgo.Move(100, 200)
robotgo.MoveRelative(10, -200) robotgo.MoveRelative(10, -200)
// move the mouse to 100, 200 // move the mouse to 100, 200
robotgo.MoveMouse(100, 200) robotgo.Move(100, 200)
robotgo.Drag(10, 10) robotgo.Drag(10, 10)
robotgo.Drag(20, 20, "right") robotgo.Drag(20, 20, "right")
@ -37,7 +38,8 @@ func move() {
for i := 0; i < 1080; i += 1000 { for i := 0; i < 1080; i += 1000 {
fmt.Println(i) fmt.Println(i)
robotgo.MoveMouse(800, i) // MoveMouse(800, i)
robotgo.Move(800, i)
} }
} }
@ -50,7 +52,7 @@ func click() {
robotgo.Click("right", false) robotgo.Click("right", false)
// double click the left mouse button // double click the left mouse button
robotgo.MouseClick("left", true) robotgo.Click("left", true)
} }
func get() { func get() {
@ -61,7 +63,7 @@ func get() {
fmt.Println("mouse...", "586") fmt.Println("mouse...", "586")
} }
robotgo.MoveMouse(x, y) robotgo.Move(x, y)
} }
func toggleAndScroll() { func toggleAndScroll() {

View File

@ -167,7 +167,7 @@ func U32ToHex(hex C.uint32_t) C.MMRGBHex {
return C.MMRGBHex(hex) return C.MMRGBHex(hex)
} }
// U8ToHex teans *C.uint8_t to C.MMRGBHex // U8ToHex trans *C.uint8_t to C.MMRGBHex
func U8ToHex(hex *C.uint8_t) C.MMRGBHex { func U8ToHex(hex *C.uint8_t) C.MMRGBHex {
return C.MMRGBHex(*hex) return C.MMRGBHex(*hex)
} }