0

There's SendKeys command for WshShell object which imitates pressing keys on keyboard. Is there a command which would imitate scrolling a mouse wheel?

Johnny B. Goode
  • 121
  • 1
  • 10

1 Answers1

1

I dont know of powershell command to scroll the mouse wheel, but you can embed a C# class in a powershell script/module and you can use C# to scroll a window.

"Basically", you need to use the Windows api PostMessage in user32.dll to send a WM_MOUSEWHEEL message to the Window handle to make that window scroll. User32 is an "unmanaged" dll (part of Windows) and not a dotnet assembly so it requires special handling.

Have a read of these two links - between them they cover roughly what you would need to know to write a powershell function to fake scrolling the mouse of a window yourself:

Advanced warning - these are advanced topics and there are plenty of pitfalls using low level operating system functions. Good luck!

MisterSmith
  • 2,884
  • 1
  • 10
  • 13