40 lines
930 B
PowerShell
40 lines
930 B
PowerShell
|
function Get-Hash([string]$textToHash) {
|
||
|
$hasher = new-object System.Security.Cryptography.MD5CryptoServiceProvider
|
||
|
$toHash = [System.Text.Encoding]::UTF8.GetBytes($textToHash)
|
||
|
$hashByteArray = $hasher.ComputeHash($toHash)
|
||
|
|
||
|
foreach($byte in $hashByteArray){
|
||
|
$result += "{0:X2}" -f $byte
|
||
|
}
|
||
|
|
||
|
return $result;
|
||
|
}
|
||
|
|
||
|
$ClearClipboard = $true
|
||
|
$PreviousHash = Get-Hash(Get-Clipboard)
|
||
|
|
||
|
while ($true) {
|
||
|
$Clipboard = Get-Clipboard
|
||
|
$ClipboardHash = Get-Hash($Clipboard)
|
||
|
|
||
|
if ($ClipboardHash -eq $PreviousHash) {
|
||
|
Write-Host "NOCHG"
|
||
|
Start-Sleep -Milliseconds 250
|
||
|
Continue
|
||
|
}
|
||
|
elseif ($Clipboard -match '^bankid:\/\/\/') {
|
||
|
Write-Host $Clipboard
|
||
|
start "$Clipboard"
|
||
|
}
|
||
|
else {
|
||
|
Write-Host "CHG"
|
||
|
}
|
||
|
|
||
|
if ($ClearClipboard) {
|
||
|
Set-Clipboard -Value $null
|
||
|
}
|
||
|
|
||
|
$PreviousHash = Get-Hash($Clipboard)
|
||
|
Start-Sleep -Milliseconds 250
|
||
|
}
|