Jump to content

How to run scripts on virtual machine independently of guest OS?

Recommended Posts

This is kind of hard to explain...but let me try!

What I want to do is run some tasks on a virtual PC independently of my current machine.

Say the task is this, running in a loop, it operates on mouse moves and keystrokes, fetches clipboard text

1. Open notepad, type "hello" world
2. Copy "hello" with mouse, and then paste it manually 4 lines lower.
2. Save the file

Now when I run tasks like this simultaneously on Virtual Box, my guest OS, mouse, keyboard and clipboard affects the guest host. Same thing with team viewer.

Short of running the task on a separate PC, is there a way to have tasks running on virtual machine that is independent of guest OS controls?


Link to post
Share on other sites

Use functions like ControlSetText rather than Send, and ControlClick rather that MouseClick.

Another option, run it on session 0 (where services run) so that it won't interact with your current user session.


Also, if you are only doing file manipulation, just use FileRead and FileWrite.


Using Send and MouseClick will make concurrent running scripts easily conflict with each-other.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to post
Share on other sites
  • Moderators

As jdelaney points out, you will not get that kind of machine-agnostic work with Sends and MouseClicks; they are just too volatile for that. If you post your code, or explain in more detail what you are trying to do, we will do our best to assist ;)


"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 post
Share on other sites

Can you disable keyb/mouse integration with the host?  I do find it interesting that running a script within the guest manipulates the host.  Does it do it if the VM is minimized or the console closed? 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...