VMware Communities
imphat
Contributor
Contributor

programmatically guest input from application running on host

Hello,

I am trying to get some automated tasks being executed on different guest machines running simultaneously on the same host. My design approach, so far, is to have a software running at the host which would cycle through all guests and interact as if it was a regular user (sending keystrokes and mouse movements/clicks) on each of the guests. This, of course, would work, but it limits the input to one guest at a time, can bring up some problems if some delay on focusing any of the guest occur and it kills this host machine im using from being able to be usable while the application is running.

What I am trying to find is a solution to interact, from the host, directly with each of the guests input interface (if there´s such interface). I´m really new to vmware, so I´m not quite positive this is possible, but from what I´ve seen the vmware application running on the host just relays all input information to the guests whenever it´s on focus and the mouse is hovering it.

My goal is to write an application that launches several threads, each thread responsible to feed on of the running guests, but I really don´t know a way to do it so without bringing each guest window to the front and mimicking a regular human input. I´ve googled a lot about it and took a look at vmware api, but I couldn´t find anything useful so far.

Does anybody knows if there´s a way to input into a guest vm without focusing its window? Any help is appreciated, thanks in advance.

Tags (3)
0 Kudos
5 Replies
jokke
Expert
Expert

You may find some different examples of executing commands from the host and into the guest in this document;

_command.pdf

Joakim

0 Kudos
imphat
Contributor
Contributor

Hello, thanks for your reply.

I´ve read the vmrun pdf and it has some very interesting information but it is not exactly what I am looking for.

Basically what I need is a way to make an application running on the host to control keyboard and mouse on the guest without using either the keyboard or mouse on the host. My idea is to have my application running on background (on the host) and performing the tasks I need (on the guest) while the host is free for me to use myself.

It would be easy if the application could run on the guest machine, but it has to run on the host only. I can´t install or run anything on the guests, only use the mouse and keyboard.

0 Kudos
jokke
Expert
Expert

Autoit will normally let you mimick mouse and keyboard actions in nonfocused windows, by communicating directly to controls.

The obstacle here would be vmware tools, ie the virtualized controls. I really don't know if this is possible. I have serious doubts and have never used autoit this way.

Joakim

0 Kudos
imphat
Contributor
Contributor

Hi, thanks for your time again... I did some research about autoIT and I believe if I were to use all the guests in unity mode it could work, but that´s another thing I am trying to avoid. Also, I am not really sure it is possible to send mouse movements to an unfocused window with autoIT, even on unity mode.. is it?

It´s interesting how I could not find anything on this subject on the Internet.. I thought it would be something vmware users would like to do more often.

0 Kudos
jokke
Expert
Expert

You can communicate to nonfocused windows with a function called "controlfocus" instead of with "winactivate". You can either way manipulate with "winsetstate".

BUT, what I think is even beyond tricky (if not impossible), is using this in a host-into-guest situation.

Rather and maybe a combination of vmrun (RunProgramInGuest & copyFileFromHostToGuest) and autoit compiled executables might to it.

I don't quite understand what you are aiming at with this.....

Joakim

0 Kudos