Giter Site home page Giter Site logo

Comments (12)

sw3103 avatar sw3103 commented on July 20, 2024

Hi,

I don't have Hyper-V to test with, although I have tested on VMware ESXi and have noted similar behaviour.

I performed a test using Move Mouse Cursor and Click Mouse Button actions. Although once I had clicked inside the console of the VM I could no longer see the mouse cursor moving, the clicking action was passing through as expected. I suspect the mouse movement is also passing through, even though this may not be visible on screen.

Without knowing what you are trying to achieve it's hard to give advise on your next course of action.

If you are trying to automate tasks inside the VM, have you tried running Move Mouse on the actual VM itself rather than your workstation?

from movemouse.

vonkaz avatar vonkaz commented on July 20, 2024

Hi,

my work laptop locks up after 3 minutes of inactivity. I usually work on it via remote desktop and it's annoying that it locks up so quickly. So it's not about automating VM guest tasks.

The idea is not to lock up the VM host when there is no activity on it.

When the focus is on the VM guest, the VM host does not detect MoveMouse actions. I suspect that the system focus/caret is received in some specific way by the VM guest window and blocked, which causes the "last input tick" to malfunction.

In my scenarios the mouse is supposed to move down the desktop to the windows taskbar of the VM host, then to the right where in windows 11 I usually don't have apps and then MoveMouse should left click. So the mouse is not moving in the host.

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

Have you tried sending a mouse click in a safe position inside the VM? I was able to position the mouse pointer over the Start Button and click it to reset the idle time.

from movemouse.

vonkaz avatar vonkaz commented on July 20, 2024

MoveMouse on host. Focus in VM guest.
Action "Move Mouse Cursor" Distance 1500 South.
Behaviour repeat action every 5 sec.

Idle. The green circle counts down. Bang.
Mouse doesn't move both host and guest.

It's probably the SerCursorPos native function misbehaving in conjunction with focus in the VM guest . The expected action is that the mouse should move in the host.

from movemouse.

vonkaz avatar vonkaz commented on July 20, 2024

Mouse click action doesn't work either. The VM guest Start button does not open.

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

OK - there's clearly a fundamental difference between a VMware Remote Console and the Hyper-V equivalent.

I don't have Hyper-V installed at the moment, so allow me some time to sort that out and I will see if I can help troubleshoot further.

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

I have installed and witnessed for myself how Hyper-V will steal mouse and keyboard activity when in focus. I don't think there's anything Move Mouse, or any other software/script/macro can do generate activity on the host machine that won't be intercepted by the VM.

There may however be a workaround.

If you run the following code in an elevated PowerShell console (settings the $VmName variable accordingly), it will send keystrokes and/or mouse movement directly into the VM.

$VmName = "VM01"
$VmComputerSystem = Get-WmiObject -Namespace "root\virtualization\v2" -Class "Msvm_ComputerSystem" -Filter "ElementName = '$VmName'"

# Send keystrokes
$Keyboard = $VmComputerSystem.GetRelated("Msvm_Keyboard")
$Keyboard.TypeText("Hello!")

# Send mouse movement
$Mouse = $VmComputerSystem.GetRelated("Msvm_Ps2Mouse")
$Mouse.SetRelativePosition(1, 0)

I ran the Watch Idle Time.ps1 script on the VM and can confirm that either one of these actions will reset the idle time.

You could use Move Mouse on you local workstation to keep your session alive, whilst also running this code on a loop to keep the VM alive.

from movemouse.

vonkaz avatar vonkaz commented on July 20, 2024

I haven't tried the workaround you provided yet. I have an idea to get the focus out of the VM.

Can you add a special action to MoveMouse ("Activate Desktop") that will move the focus to the desktop of the machine it is running on - in my case VM host.
Maybe WinSDK GetDesktopWindow and SetFocus?

So my scenario will be this:

  1. Activate Desktop
  2. Move mouse cursor
  3. etc......

Maybe it will work. :)

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

You can use a PowerShell Script Action to accomplish this.

https://www.google.com/search?q=getdesktopwindow+powershell

If this does indeed work, presumably you will still need to use the code in my previous reply to keep the VM alive along with Move Mouse on the host computer, so not sure what this will buy you.

from movemouse.

kenpark76 avatar kenpark76 commented on July 20, 2024

The cmder(https://github.com/cmderdev/cmder) program also has the same problem, where the cursor actually does not move when the cmder window is in the active state.

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

@kenpark76 would you mind creating a separate issue for this as I suspect this is unrelated?

from movemouse.

sw3103 avatar sw3103 commented on July 20, 2024

@vonkaz do you require any more help with this or are you happy to accept the solution I proposed?

from movemouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.