Running a macro in a windows VM while being able to do things on the host

5,698

Solution 1

First of all, the question: "Why don't you just try it out?" springs to mind. But anyway, this is not the Superuser spirit, and I was interested to find out myself.

So I ran an AutoHotkey script

  • in a Windows Vista guest inside VirtualBox (which does not support mouse and keyboard integration)
  • in an XP mode guest with VirtualPC by Microsoft (which does support that integration)

while making sure the keyboard focus was off. The macro worked even when I took the keyboard focus away. I could watch it work in the virtual machine.

The answer to your question is therefore "yes, probably".

I am not sure this will work under all conditions, but I don't see why it should not.

Solution 2

Probably too late. But in case any Googlers stumble upon this page. You are in luck!

When you connect to a virtual machine the protocol that you use an enable what seems to be acting as guest services (the vm is borrowing your I/O capacities, your machine is loaning the mouse and keyboard, clipboard as well!).

If you use RDP as your protocol, this could be the cause.

Why do I know this- I had to take 10 vm's and run macros simultaneously. The ourput was all wrong!

It turns out the macro was coded so that it copied data from one cell and pasted it to another cell. My clipboard was being shared by 10 different sources!

Disabling guest services or using a protocol other than RDP should do the trick.

Share:
5,698

Related videos on Youtube

zeta
Author by

zeta

Updated on September 18, 2022

Comments

  • zeta
    zeta over 1 year

    Is it possible to simulate mouse and keyboard movements in a virtual machine (ie: running a macro) while still being able to work normally on my host.

    Reason I ask is because I currently run these macros on my PC, but this hinders me because as long as those macros are running, I can't do anything else.

    If anyone has any experience or ideas on this subject, or knows if it works with another VM software such as VirtualBox

    • billc.cn
      billc.cn over 12 years
      You should consider converting the macros to shell scripts. If they can't be easily done under Windows, try Linux. You can run your macros inside the VM and they won't interfere with the host.
    • Mokubai
      Mokubai over 12 years
      Why can't you simply put these macros inside your virtual machine environment and run them there?