Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

POWERSHELL - MAKE MOUSE CURSOR GO TO THE CENTER OF THE SCREEN NUMBER 3

$
0
0

Hello everybody,

I have a multimonitor setup with 4 monitors (2 columns with 2 monitors). Monitor number 1 is on the left upper corner, monitor number 2 is on the left bottom corner, monitor number 3 is on the right upper corner and monitor number 4 is on the right bottom corner. My primary monitor is monitor number 2. All monitors have 1920x1200 resolution.

The following PowerShell code is used to place the mouse cursor in center of primary screen (left bottom corner).

"C:\users\joao42\powershell\centercursor1.ps1"
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | out-null
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$center = $bounds.Location
$center.X += $bounds.Width / 2
$center.Y += $bounds.Height / 2
[System.Windows.Forms.Cursor]::Position = $center

I need to create a new code so that the mouse cursor goes to the center of screen number 3 (right upper corner).

Although it seems to be easy, so far I could not make the cursor go to the center of screen #3.

I really appreciate any help.

Thaks,

John


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>