⚠ 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/
linear
ease_in_quad
ease_out_quad
ease_in_out_quad
ease_in_cubic
ease_out_cubic
ease_in_out_cubic
ease_in_quart
ease_out_quart
ease_in_out_quart
ease_in_quint
ease_out_quint
ease_in_out_quint
ease_in_sine
ease_out_sine
ease_in_out_sine
ease_in_expo
ease_out_expo
ease_in_out_expo
ease_in_circ
ease_out_circ
ease_in_out_circ
ease_in_elastic
ease_out_elastic
ease_in_out_elastic
ease_in_back
ease_out_back
ease_in_out_back
ease_in_bounce
ease_out_bounce
ease_in_out_bounce
Thanks to the amazing team at @vlang and their Discord channel.