-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNubEmulator.ps1
74 lines (66 loc) · 2.04 KB
/
NubEmulator.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
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName WindowsBase
Add-Type -AssemblyName PresentationCore
$IsOn = $false
$Mode = $false
$DelayTime = 100
$SpeedMultiplyer = 2
$signature=@'
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
'@
$SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru
while ($true)
{
$PosX = 0
$PosY = 0
$Enable = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::RightShift)
$SwitchMode = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::RightAlt)
$G = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::G)
$H = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::H)
$B = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::B)
$Lclick = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::V)
$Rclick = [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::N)
if ($Enable){
$IsOn = -not $IsOn
Start-Sleep -Milliseconds $DelayTime
}
if ($SwitchMode){
$Mode = -not $Mode
Start-Sleep -Milliseconds $DelayTime
}
if ($G)
{
$PosX += -1
$PosY += -1
}
if ($H) {
$PosX += 1
$PosY += -1
}
if ($B) {
$PosX += 0
if($Mode){
$PosY += 1
} else {
$PosY += 2
}
}
if($IsOn){
if ($Lclick){
$SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0)
$SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0)
Start-Sleep -Milliseconds $DelayTime
}
if ($Rclick){
$SendMouseClick::mouse_event(0x00000008, 0, 0, 0, 0)
$SendMouseClick::mouse_event(0x00000010, 0, 0, 0, 0)
Start-Sleep -Milliseconds $DelayTime
}
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X) + ($PosX * $SpeedMultiplyer)
$y = ($pos.Y) + ($PosY * $SpeedMultiplyer)
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Milliseconds 1
}
}