Skip to content

Commit 86da52b

Browse files
committed
Update examples and godoc
1 parent fe1a463 commit 86da52b

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

examples/key/main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import (
2020
func typeStr() {
2121
// importing "Hello World"
2222
robotgo.TypeStr("Hello World!", 1.0)
23-
23+
robotgo.KeySleep = 100
2424
robotgo.TypeStr("だんしゃり")
25-
robotgo.MicroSleep(10.2)
2625

27-
robotgo.TypeStr("Hi galaxy. こんにちは世界.")
28-
robotgo.Sleep(2)
29-
// robotgo.TypeStr("So, hi, bye!")
26+
robotgo.TypeStr("Hi galaxy. こんにちは世界. 你好, 再见!")
27+
28+
robotgo.Sleep(1)
29+
robotgo.TypeStr("So, hi, bye!")
3030
robotgo.MilliSleep(100)
3131

3232
ustr := uint32(robotgo.CharCodeAt("So, hi, bye!", 0))
@@ -38,6 +38,7 @@ func typeStr() {
3838
func keyTap() {
3939
// press "enter"
4040
robotgo.KeyTap("enter")
41+
robotgo.KeySleep = 200
4142
robotgo.KeyTap("a")
4243
robotgo.MilliSleep(100)
4344
robotgo.KeyTap("a", "ctrl")
@@ -71,6 +72,7 @@ func keyTap() {
7172
}
7273

7374
func keyToggle() {
75+
// robotgo.KeySleep = 150
7476
robotgo.KeyToggle("a", "down")
7577
robotgo.KeyToggle("a", "down", "alt")
7678
robotgo.Sleep(1)

examples/mouse/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ import (
1818
)
1919

2020
func move() {
21+
robotgo.MouseSleep = 100
2122
robotgo.Move(100, 200)
2223
robotgo.MoveRelative(10, -200)
2324

2425
// move the mouse to 100, 200
25-
robotgo.MoveMouse(100, 200)
26+
robotgo.Move(100, 200)
2627

2728
robotgo.Drag(10, 10)
2829
robotgo.Drag(20, 20, "right")
@@ -37,7 +38,8 @@ func move() {
3738

3839
for i := 0; i < 1080; i += 1000 {
3940
fmt.Println(i)
40-
robotgo.MoveMouse(800, i)
41+
// MoveMouse(800, i)
42+
robotgo.Move(800, i)
4143
}
4244
}
4345

@@ -50,7 +52,7 @@ func click() {
5052
robotgo.Click("right", false)
5153

5254
// double click the left mouse button
53-
robotgo.MouseClick("left", true)
55+
robotgo.Click("left", true)
5456
}
5557

5658
func get() {
@@ -61,7 +63,7 @@ func get() {
6163
fmt.Println("mouse...", "586")
6264
}
6365

64-
robotgo.MoveMouse(x, y)
66+
robotgo.Move(x, y)
6567
}
6668

6769
func toggleAndScroll() {

robotgo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func U32ToHex(hex C.uint32_t) C.MMRGBHex {
167167
return C.MMRGBHex(hex)
168168
}
169169

170-
// U8ToHex teans *C.uint8_t to C.MMRGBHex
170+
// U8ToHex trans *C.uint8_t to C.MMRGBHex
171171
func U8ToHex(hex *C.uint8_t) C.MMRGBHex {
172172
return C.MMRGBHex(*hex)
173173
}

0 commit comments

Comments
 (0)