mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 20:50:02 +02:00
Rename folder Docs to docs
This commit is contained in:
87
docs/move-mouse-pointer.md
Normal file
87
docs/move-mouse-pointer.md
Normal file
@ -0,0 +1,87 @@
|
||||
*move-mouse-pointer.ps1*
|
||||
================
|
||||
|
||||
This PowerShell script moves the mouse pointer either to the given x/y coordinate or just slightly.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./move-mouse-pointer.ps1 [[-x] <Int32>] [[-y] <Int32>] [<CommonParameters>]
|
||||
|
||||
-x <Int32>
|
||||
Specifies the x coordinate in pixels
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value -1
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-y <Int32>
|
||||
Specifies the y coordinate in pixels
|
||||
|
||||
Required? false
|
||||
Position? 2
|
||||
Default value -1
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./move-mouse-pointer.ps1 100 100
|
||||
|
||||
```
|
||||
|
||||
Notes
|
||||
-----
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
|
||||
Related Links
|
||||
-------------
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
Script Content
|
||||
--------------
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Moves the mouse pointer
|
||||
.DESCRIPTION
|
||||
This PowerShell script moves the mouse pointer either to the given x/y coordinate or just slightly.
|
||||
.PARAMETER x
|
||||
Specifies the x coordinate in pixels
|
||||
.PARAMETER y
|
||||
Specifies the y coordinate in pixels
|
||||
.EXAMPLE
|
||||
PS> ./move-mouse-pointer.ps1 100 100
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([int]$x = -1, [int]$y = -1)
|
||||
|
||||
try {
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
if (($x -eq -1) -and ($y -eq -1)) {
|
||||
$Pos = [System.Windows.Forms.Cursor]::Position
|
||||
$x = $pos.X + 5
|
||||
$y = $pos.Y + 5
|
||||
}
|
||||
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of move-mouse-pointer.ps1 as of 10/19/2023 08:11:40)*
|
Reference in New Issue
Block a user