Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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. – Dec 4 '11 at 11:41
Why can't you simply put these macros inside your virtual machine environment and run them there? – Mokubai Dec 4 '11 at 18:20
up vote 0 down vote accepted

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.

share|improve this answer

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|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.