Skip to content

islonely/mouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Platform mouse and keyboard manipulation.

Cross-platform tool to manipulate the mouse and keyboard to automate tasks.

import islonely.mouse

import time

fn main() {
    // get current mouse position
    x, y := mouse.get_pos()
    println('Mouse is at: X: ${x}, Y: ${y}')

    // get the dimensions of the primary display
    sz := mouse.screen_size()

    // center the mouse in the middle of the screen
    mouse.set_pos(sz.width / 2, sz.height / 2)

    // left and right click the mouse
    mouse.click(.left)
    mouse.click(.right)

    // double left click
    mouse.double_click()

    // click and drag mouse to 100, 150
    mouse.drag_to(100, 150, button: .left, duration: time.second)
}