Jump to content

Controlsend and virtual machine


Recommended Posts

Hi, im able to send or click on a vmware virtual machine, example:

WinActivate("[TITLE:M1 - VMware Workstation]", "")
MouseClick("Right",233, 979)
Sleep(100)
Send("x")

But when it comes to controlclick, or controlsend nothing happens:

Autoit window info:
>>>> Window <<<<
Title: M1 - VMware Workstation
Class: VMUIFrame
Position: -8, -8
Size: 1936, 1056
Style: 0x17CF0000
ExStyle: 0x00000100
Handle: 0x00000000000306D0
>>>> Control <<<<
Class:  MKSEmbedded
Instance:   4
ClassnameNN:    MKSEmbedded3
Name:   
Advanced (Class):   [CLASS:MKSEmbedded; INSTANCE:4]
ID: 
Text:   MKSWindow#0
Position:   202, 94
Size:   1699, 884
ControlClick Coords:    456, 374
Style:  0x50000000
ExStyle:    0x00000000
Handle: 0x00000000000E0AC0

Tested controlclick and controlsend code:

 
WinActivate("[TITLE:M1 - VMware Workstation]", "")
$tempo = ControlSend("M1 - VMware Workstation", "","","ic")
$tempo = ControlClick("M1 - VMware Workstation", "","","left",1,456, 374)
$tempo = ControlSend("[CLASS:MKSEmbedded; INSTANCE:4]", "MKSWindow#0","","x")
$tempo = ControlSend("[CLASS:VMUIFrame]", "","","x")

Thank you.

EDIT: Tested sending something to VMWare and it worked, but when it comes to the actual virtual machine it keeps doing nothing.

Tested code to send alt+h to vmware, not working when i try it with the virtual machine.

$tempo = ControlSend("M1 - VMware Workstation", "","","!H")

Ok, all control send are giving me a 0 as output wich means "Returns 0 if window/control is not found.", except the one thats being sent to VMWare software, wich gives me a 1, anyone able to help? :S

Edited by adrigalilea
Link to comment
Share on other sites

What app are you trying to automate?

i need to automate certain tasks, on different OS's on different VM's and the needs will be changing from time to time, "low interaction needed"  so my idea was a fast universal solution, nothing fancy: a autoit script runing on host, controlling the multiple VM's in the background.

Not as easy as i thought though.

Link to comment
Share on other sites

In my experience once you mouseclick in the VM the mouse becomes 'owned' by the VM OS until you release it back to the host.  You said you cannot automate inside the VM.  looks like you are using the VMware player.  Have you looked for an API the player?  I think you can automate it from this: https://www.vmware.com/support/developer/vix-api/

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

  • Moderators

Or if the VMs are on the same network, go the psexec route. I have a customer that works in a VDI scenario, and that is what they do.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

In my experience once you mouseclick in the VM the mouse becomes 'owned' by the VM OS until you release it back to the host.  You said you cannot automate inside the VM.  looks like you are using the VMware player.  Have you looked for an API the player?  I think you can automate it from this: https://www.vmware.com/support/developer/vix-api/

This is not what i've experienced, i can make multiple clicks or sends without trouble, but cant make CONTROLclick nor CONTROLsend, i checked the API and i thank you the idea, but nothing over there will help me :S

BTW Im using VMWare workstation 10

Or if the VMs are on the same network, go the psexec route. I have a customer that works in a VDI scenario, and that is what they do.

psexec wont work hence, i need this not for only other non windows platforms too but completely isolated from other networks machines (the VM's for testing suspicious exe's etc...).

Sorry for my english.

Link to comment
Share on other sites

You're probably going to have to use MouseClick because there are no controls that ControlClick can see other than the VM window, anything inside of it is invisible to the host computer.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

simple idea, create individual scripts (EXE´s) for each of the VM environments, and use the send command to launch the one you need in the specific VM...

Other idea (just something to explor, I don´t really have details here),  give a different IP address to each of the VM´s, create a TCP client script, which is running at all VMs at the same time,  then a TCP Server on the host machine, which will send commands/instructions to the specific Client....

sorry I can´t provide details / code, I´m not really an expert, just trying to help giving you some options.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...