⚠ Work in progress. Only Windows is supported.
Basic desktop automation functions for V lang. PRs welcome :)
- Add more mouse easing functions, currently it only has linear
- Screen related functions
-
screen_size() -
pixel_color() -
locate_on_screen()For colors and images
-
- Keyboard simulation and hooks
- Linux support, not priority currently
All ideas are welcome!
import vrobot
// Print mouse position
pos := vrobot.mouse_pos()
println('Mouse position: $pos.x, $pos.y')
// Print pixel color at (100, 100)
color := vrobot.pixel_color(100, 100)
println('Pixel color is: ($color.r, $color.g, $color.b)')
// Print screen resolution
screen := vrobot.screen_size()
println('Screen size: $screen.width, $screen.height')
// Moves mouse twice and returns to starting position
vrobot.move_mouse(pos.x + 100, pos.y + 100)
vrobot.move_mouse_smooth_rel(-100, -100, 500, 'linear')
// Drags from (100, 100) to (150, 150) with left click
vrobot.move_mouse(100, 100)
vrobot.drag(150, 150)🖱️ Valid mouse buttons are: left, right, middle
Returns struct with current mouse position.
Clicks with mouse.
Double clicks.
Drags mouse (left) to specified position.
Drags mouse (left) relative to current position.
Moves mouse to x, y.
Moves mouse relative to current position.
Moves mouse smoothly to dest_x, dest_y in duration_ms.
See list of available tweens below.
Moves mouse smoothly, relative to current position in duration_ms.
See list of available tweens below.
Returns screen size in pixels.
Returns pixel color at x, y.
You can preview tweens here: https://easings.net/
linearease_in_quadease_out_quadease_in_out_quadease_in_cubicease_out_cubicease_in_out_cubicease_in_quartease_out_quartease_in_out_quartease_in_quintease_out_quintease_in_out_quintease_in_sineease_out_sineease_in_out_sineease_in_expoease_out_expoease_in_out_expoease_in_circease_out_circease_in_out_circease_in_elasticease_out_elasticease_in_out_elasticease_in_backease_out_backease_in_out_backease_in_bounceease_out_bounceease_in_out_bounce
Thanks to the amazing team at @vlang and their Discord channel.