Sending mouse clicks in cmd

Discussion about using the VirtualBox API, Tutorials, Samples.

Sending mouse clicks in cmd

Postby Mishmish » 4. Sep 2017, 08:10

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
Mishmish
 
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Postby noteirak » 4. Sep 2017, 22:19

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5152
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Re: Sending mouse clicks in cmd

Postby Mishmish » 5. Sep 2017, 16:21

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
Mishmish
 
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Postby noteirak » 5. Sep 2017, 16:25

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5152
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Re: Sending mouse clicks in cmd

Postby Mishmish » 7. Sep 2017, 08:54

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...
Mishmish
 
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Postby noteirak » 7. Sep 2017, 10:01

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5152
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Re: Sending mouse clicks in cmd

Postby Mishmish » 7. Sep 2017, 11:30

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
Mishmish
 
Posts: 4
Joined: 4. Sep 2017, 08:06

Re: Sending mouse clicks in cmd

Postby noteirak » 7. Sep 2017, 12:04

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5152
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 1 guest