Skip to content

Commit 9143170

Browse files
authored
add code for auto clicking
1 parent 516125b commit 9143170

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

autoclick.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
1+
package main
12

3+
import (
4+
"fmt"
5+
"time"
6+
7+
"github.com/go-vgo/robotgo"
8+
)
9+
10+
func moveAndClickStepOne() {
11+
fmt.Println("Moving Mouse")
12+
robotgo.MoveMouseSmooth(166, 775, 1.0, 7.0)
13+
fmt.Println("Clicking")
14+
robotgo.Click()
15+
}
16+
17+
func moveAndClickStepTwo() {
18+
fmt.Println("Moving Mouse")
19+
robotgo.MoveMouseSmooth(268, 112, 1.0, 7.0)
20+
fmt.Println("Clicking")
21+
robotgo.Click()
22+
}
23+
24+
func delay() {
25+
fmt.Println("Delaying with 2 Seconds")
26+
time.Sleep(2 * time.Second)
27+
}
28+
29+
func main() {
30+
count := 0
31+
iterations := 4
32+
33+
for count <= iterations {
34+
fmt.Println("Starting iteration")
35+
moveAndClickStepOne()
36+
delay()
37+
moveAndClickStepTwo()
38+
delay()
39+
fmt.Println("finising iteration")
40+
count++
41+
}
42+
fmt.Println("finished all iterations")
43+
}

0 commit comments

Comments
 (0)