Skip to content

Jofich/clicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clicker

Static Badge

Minimalist Go library for simulating mouse clicks, movements, and basic automation based on Robotgo

Installation

go get github.com/Jofich/clicker@latest

Quick Start

Here's a simple example of how to use clicker

package main

import (
	"context"
	"sync"
	"time"

	"github.com/jofich/clicker"
)

func main() {
	posX, posY := clicker.GetGlobalMousePos()
  //create context with timeout to cancel clicking
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
	defer cancel()

	wg := sync.WaitGroup{}
	for i := 0; i < 3; i++ {
    //create new clicker
		mouse := clicker.NewClicker()
		mouse.SetPosition(posX+i*50, posY)
		wg.Add(1)
    //start clicking
		go func() {
			mouse.StartClicking(ctx, time.Millisecond*500*time.Duration(i+1), clicker.Args{
				MouseButton: clicker.Left,
			})
			wg.Done()
		}()
	}
  // waits for the context timeout expires
	wg.Wait()
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any problems or have questions, please open an issue

About

Minimalist Go library for simulating mouse clicks, movements, and basic automation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages