opexxx icon

WiggleSend.ps1

opexxx | PRO | 03/25/21 06:07:54 AM UTC | 0 ⭐ | 1836 👁️ | Never ⏰ | []
PowerShell |

1.49 KB

|

None

|

0 👍

/

0 👎

function WiggleSend
{
    param(
        [string] $InputObject
    )
    
    Add-Type -Assembly System.Windows.Forms
 
    Write-Host "Position the mouse to the left hand side of the screen"
    Start-Sleep -Seconds 10
    $currentPosition = [Windows.Forms.Cursor]::Position
 
    $InputObject = $InputObject + [char]3
    foreach($char in $InputObject.ToCharArray())
    {
        $charOffset = [int] $char
 
        [Windows.Forms.Cursor]::Position = New-Object Drawing.Point ($currentPosition.X + ($charOffset * 3)),$currentPosition.Y
        Start-Sleep -m 50
        [Windows.Forms.Cursor]::Position = $currentPosition
        Start-Sleep -m 50
    }
}
 
function WiggleReceive
{
    Add-Type -Assembly System.Windows.Forms
 
    Start-Sleep -Seconds 10
    $currentPosition = [Windows.Forms.Cursor]::Position.X
 
    $baseX = $currentPosition
    $lastX = $baseX
 
    $sb = New-Object System.Text.StringBuilder
 
    while($true)
    {
        $currentPosition = [Windows.Forms.Cursor]::Position.X
        if($currentPosition -ne $lastX)
        {
            if($currentPosition -ne $baseX)
            {
                $result = [int] (($currentPosition - $baseX) / 3)
                if($result -eq 3)
                {
                    return $sb.ToString()
                }
                else
                {
                    $null = $sb.Append([char] $result)
                }
 
            }
            $lastX = $currentPosition
        }
    }
}

Comments