Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b20a46cd37 | |||
0984a36f59 |
28
README.md
28
README.md
@ -1,3 +1,29 @@
|
|||||||
# autoclick
|
# autoclick
|
||||||
|
|
||||||
Go auto-clicker
|
Go auto-clicker that stores groups of locations.
|
||||||
|
Based on [Robotgo](https://github.com/go-vgo/robotgo).
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Depending on your OS, you may require
|
||||||
|
[different dependencies](https://github.com/go-vgo/robotgo?tab=readme-ov-file#requirements).
|
||||||
|
|
||||||
|
If you are running MacOS, you just need to install Xcode Command Line Tools
|
||||||
|
and grant Go the accessibility permissions when prompted from the system.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
xcode-select --install
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, once dependencies are met, to install autoclick run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install gogs.davte.it/Davte/autoclick@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
To launch autoclick from any path, add this to your bash profile or bashrc:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="$PATH:/$HOME/go/bin"
|
||||||
|
```
|
@ -22,9 +22,17 @@ func (p Point) String() string {
|
|||||||
return fmt.Sprintf("(%v, %v)", p.X, p.Y)
|
return fmt.Sprintf("(%v, %v)", p.X, p.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Point) Click() {
|
func (p Point) Click(button ...string) {
|
||||||
|
buttonToClick := "left"
|
||||||
|
if len(button) > 0 && (button[0] == "left" || button[0] == "right") {
|
||||||
|
buttonToClick = button[0]
|
||||||
|
}
|
||||||
robotgo.Move(p.X, p.Y)
|
robotgo.Move(p.X, p.Y)
|
||||||
robotgo.Click("left", false)
|
robotgo.Click(buttonToClick, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Point) RightClick() {
|
||||||
|
p.Click("right")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p1 *Point) GetDistance(p2 *Point) float64 {
|
func (p1 *Point) GetDistance(p2 *Point) float64 {
|
||||||
@ -145,6 +153,15 @@ func StringOscillator(s string, amplitude int) chan string {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func press(key string) {
|
||||||
|
robotgo.KeyTap(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func keyboardWrite(s string) {
|
||||||
|
robotgo.TypeStr(s)
|
||||||
|
robotgo.MilliSleep(100)
|
||||||
|
}
|
||||||
|
|
||||||
func ClickRepeatedly(s *SavedGroups, c chan os.Signal) {
|
func ClickRepeatedly(s *SavedGroups, c chan os.Signal) {
|
||||||
for index, g := range s.Groups {
|
for index, g := range s.Groups {
|
||||||
fmt.Printf("- Press %v to select %v\n", index+1, g.Name)
|
fmt.Printf("- Press %v to select %v\n", index+1, g.Name)
|
||||||
@ -159,6 +176,9 @@ func ClickRepeatedly(s *SavedGroups, c chan os.Signal) {
|
|||||||
fmt.Scanln(&discard)
|
fmt.Scanln(&discard)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if choice > len(s.Groups) {
|
||||||
|
choice = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
selection := s.Groups[choice-1]
|
selection := s.Groups[choice-1]
|
||||||
fmt.Printf("You selected %v. I'll be clicking in the following positions:\n", selection.Name)
|
fmt.Printf("You selected %v. I'll be clicking in the following positions:\n", selection.Name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user