-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mouse Mover plus setting change.ps1
111 lines (68 loc) · 3.27 KB
/
Mouse Mover plus setting change.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Remotely Invoke:
# $ScriptFromGithHub = Invoke-WebRequest https://raw.githubusercontent.com/VonKrieghoff/Powershell-0365/main/Mouse%20Mover.ps1
# Invoke-Expression $($ScriptFromGithHub.Content)
# $ScriptFromGithHub = Invoke-WebRequest https://raw.githubusercontent.com/VonKrieghoff/Powershell-0365/main/Mouse%20Mover.ps1; Invoke-Expression $($ScriptFromGithHub.Content)
# Known issues:
# - On Linux Nano editor it opens when triggers SCROLLLOCK key
cls
Write-Output "
__ __
/ \~~~/ \
,----( .. )
/ \__ __/
/| (\ |( Mouse is Running
^ \ /___\ /\_| I am Hiding
|__| |__| https://github.com/VonKrieghoff/
"
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
#Get position
$Positon = [System.Windows.Forms.Cursor]::Position
#Edit Position
$x = $Positon.X + 1
$y = $Positon.Y + 1
#Send Mouse to new position
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
#Write where is mouse
$date = Get-Date
Write-Progress -CurrentOperation "Waiting for new mouse position" (" $date - Mouse is now in position X: $X | Y: $Y")
#Write-Output " $date - Mouse is now in positon X: $X | Y: $Y"
# Pressign ScrollLock on Keyboard:
$WShell = New-Object -com "Wscript.Shell"
$WShell.sendkeys("{SCROLLLOCK}")
#$WShell.sendkeys("{CAPSLOCK}") #Will blink more lights on Keyboard, but is litTle bit annoying :)
# Waiting 100ms and pressing again:
Start-Sleep -Milliseconds 100
$WShell.sendkeys("{SCROLLLOCK}")
#$WShell.sendkeys("{CAPSLOCK}") #Will blink more lights on Keyboard, but is litTle bit annoying :)
# Change Settings
# Set default Browser Edge
#Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -Name ProgId -Value 'MSEdgeHTM'
#Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -Name ProgId -Value 'MSEdgeHTM'
# Set which one slould be default browser
$SetAsDefaultBrowser = "MSEdgeHTM"
#$SetAsDefaultBrowser = MSEdgeHTM
# Get default browser that we have at this moment
$HTTPBrowser = (Get-ItemProperty -Path Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice).ProgId
$HTTPsBrowser = (Get-ItemProperty -Path Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice).ProgId
# If default browser is not what we need then if in loop will change that.
if($HTTPBrowser -ne $SetAsDefaultBrowser)
{
#Set as Default Browser
Write-Output $HTTPBrowser
#Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -Name ProgId -Value $SetAsDefaultBrowser
}
else {
Write-Output "DEfault HTTP browser already is $HTTPBrowser" }
if($HTTPSBrowser -ne $SetAsDefaultBrowser)
{
#Set as Default Browser
Write-Output $HTTPBrowser
#Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -Name ProgId -Value $SetAsDefaultBrowser
}
else {
Write-Output "DEfault HTTPS browser already is $HTTPSBrowser" }
# Waiting 5s and doing everything all over.
Start-Sleep -Seconds 15
}