Sending mouse or touch events to VM from host shell?

This is for discussing general topics about how to use VirtualBox.
Post Reply
RocketNuts
Posts: 4
Joined: 11. Jul 2018, 06:27

Sending mouse or touch events to VM from host shell?

Post by RocketNuts »

I know how to send keyboard events (keystrokes) to a VM using VBoxManage, e.g.:

Code: Select all

VBoxManage controlvm "MyVirtualMachine" keyboardputscancode <scancode> <scancode> <etc...>
Is there a similar way to simulate mouse or touch events? For example, move the mouse to a certain coordinate or over a certain distance, or send a mouse click, or send a touch/tap on a given coordinate?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Sending mouse or touch events to VM from host shell?

Post by socratis »

Not that I know of. And since the mouse is a special device and it "translates" the position/events of the host's mouse, I can see issues where the two are disconnected. How are you going to be moving the guest's mouse independently? What if you move your host's mouse? Or you click on your host?

I would look for scripts/programs that do that either on the host and/or (most probably) in the guest. I think that what you're looking for is called mouse automation/recorder.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
RocketNuts
Posts: 4
Joined: 11. Jul 2018, 06:27

Re: Sending mouse or touch events to VM from host shell?

Post by RocketNuts »

Thanks, in this case I am running an x64 Android VM, so I won't have as much scriptability or freedom as within a normal desktop OS.

If I could just simulate simple tablet / touch events, e.g. a touch on a specific coordinate, that would be great.

I noticed this topic* there is something called "PutMouseEvent", but I have no idea how to access or use that.

(* can't post URLs, I was referring to topic 60656)
Post Reply