SHOW:
|
|
- or go back to the newest paste.
1 | function WiggleSend | |
2 | { | |
3 | param( | |
4 | [string] $InputObject | |
5 | ) | |
6 | ||
7 | Add-Type -Assembly System.Windows.Forms | |
8 | ||
9 | Write-Host "Position the mouse to the left hand side of the screen" | |
10 | Start-Sleep -Seconds 10 | |
11 | $currentPosition = [Windows.Forms.Cursor]::Position | |
12 | ||
13 | $InputObject = $InputObject + [char]3 | |
14 | foreach($char in $InputObject.ToCharArray()) | |
15 | { | |
16 | $charOffset = [int] $char | |
17 | ||
18 | [Windows.Forms.Cursor]::Position = New-Object Drawing.Point ($currentPosition.X + ($charOffset * 3)),$currentPosition.Y | |
19 | Start-Sleep -m 50 | |
20 | [Windows.Forms.Cursor]::Position = $currentPosition | |
21 | Start-Sleep -m 50 | |
22 | } | |
23 | } | |
24 | ||
25 | function WiggleReceive | |
26 | { | |
27 | Add-Type -Assembly System.Windows.Forms | |
28 | ||
29 | Start-Sleep -Seconds 10 | |
30 | $currentPosition = [Windows.Forms.Cursor]::Position.X | |
31 | ||
32 | $baseX = $currentPosition | |
33 | $lastX = $baseX | |
34 | ||
35 | $sb = New-Object System.Text.StringBuilder | |
36 | ||
37 | while($true) | |
38 | { | |
39 | $currentPosition = [Windows.Forms.Cursor]::Position.X | |
40 | if($currentPosition -ne $lastX) | |
41 | { | |
42 | if($currentPosition -ne $baseX) | |
43 | { | |
44 | $result = [int] (($currentPosition - $baseX) / 3) | |
45 | if($result -eq 3) | |
46 | { | |
47 | return $sb.ToString() | |
48 | } | |
49 | else | |
50 | { | |
51 | $null = $sb.Append([char] $result) | |
52 | } | |
53 | ||
54 | } | |
55 | $lastX = $currentPosition | |
56 | } | |
57 | } | |
58 | } |