Sending mouse clicks in cmd

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Mishmish
Posts: 4
Joined: 4. Sep 2017, 08:06

Sending mouse clicks in cmd

Post by Mishmish »

Hi.
I am trying to automate something for my job in VBox.
My company uses a 64Bit linux distribution which i installed as guest.
I want to be able to send mouse clicks to my guest with a command.
Is it possible? i use vboxmanage to get screenshots of the VM
but no documentation anywhere about sending mouse clicks.
also if there was a settings to send long taps it would be awesome.
Thanks for helpers!

Technical data:
Host: Windows 10 64Bit
Guest: "Other Linux(64-Bit)"
VBox v5.1.26 r117224
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Sending mouse clicks in cmd

Post by noteirak »

The object IMouse contains what you need, allowing you to send arbitrary mouse events. You can get it with IConsole::mouse after obtaining a shared lock on the VM object.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Mishmish
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Post by Mishmish »

noteirak wrote:The object IMouse contains what you need, allowing you to send arbitrary mouse events. You can get it with IConsole::mouse after obtaining a shared lock on the VM object.
Hi and thanks for the fast response!
The api you linked is exactly what im looking for, especially because it has java API which is what im using
unfortunatly i couldnt find the jar file for VBox 5.1 (which is what im using)
will 4.2.8 work for me? and is 5.1 backwards compatible?
thank you
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Sending mouse clicks in cmd

Post by noteirak »

The jar file can be found in the SDK package in the Downloads page. Here's a download link for 5.1.26. You do not need an exact version match, as long as the VirtualBox version you installed is 5.1.x
For any other version, see the specific download page of the version, there is a SDK link as well.

You'll find two Jars in the SDK package within the bindings folder: one for XPCOM, one for WebServices.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Mishmish
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Post by Mishmish »

noteirak wrote:The jar file can be found in the SDK package in the Downloads page. Here's a download link for 5.1.26. You do not need an exact version match, as long as the VirtualBox version you installed is 5.1.x
For any other version, see the specific download page of the version, there is a SDK link as well.

You'll find two Jars in the SDK package within the bindings folder: one for XPCOM, one for WebServices.
I have researched quite a bit.
from what i can gather this api connects to a webserver in the quest machine - which i do not have
I use a custom linux machine and I CANNOT install anything on it...
also the sdk contains only XPCOM and SOAP jars which the documentation suggests dont work on windows hosts...
i simply want to send mouse clicks to a local guest...
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Sending mouse clicks in cmd

Post by noteirak »

I'm afraid you missunderstood the docs.

The webserver is vboxwebsrv which is a SOAP frontend and is present with any VirtualBox install.
The SOAP jar works on any system, only XPCOM is limited to Unix-like system.
And this is definittely the way to send from host to guest.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Mishmish
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Post by Mishmish »

noteirak wrote:I'm afraid you missunderstood the docs.

The webserver is vboxwebsrv which is a SOAP frontend and is present with any VirtualBox install.
The SOAP jar works on any system, only XPCOM is limited to Unix-like system.
And this is definittely the way to send from host to guest.
I cannot figure out what url to give the SOAP jar.
tried both "localhost:18083" and my guests ip.
I am using a bridged network.
keep getting the exception "org.virtualbox_5_1.VBoxException: Illegal endpoint address"
obviously while the VBoxWebSrv.exe file is running
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Sending mouse clicks in cmd

Post by noteirak »

The endpoint is http://localhost:18083

There are code samples to help you, see specifically "Export a VM to a OVA appliance" which shows you value in the code directly.
if you want to avoid dealing with authentication at the start, you can give "-A null" to the vboxwebsrv as argument.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply