From fd60aa0b6aa4f15b462831aa10448203235b707d Mon Sep 17 00:00:00 2001 From: egieb <93350544+beigeworm@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:18:08 +0000 Subject: [PATCH] Add files via upload --- .../Voice-Activated-DarkMode.txt | 18 ++++++++ Voice-Activated-DarkMode/main.ps1 | 45 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Voice-Activated-DarkMode/Voice-Activated-DarkMode.txt create mode 100644 Voice-Activated-DarkMode/main.ps1 diff --git a/Voice-Activated-DarkMode/Voice-Activated-DarkMode.txt b/Voice-Activated-DarkMode/Voice-Activated-DarkMode.txt new file mode 100644 index 0000000..e40a8bc --- /dev/null +++ b/Voice-Activated-DarkMode/Voice-Activated-DarkMode.txt @@ -0,0 +1,18 @@ +REM Title: Voice-Activated-DarkMode +REM Author: @beigeworm | https://github.com/beigeworm +REM Description: Control Windows theme with your voice. Say 'Light' OR 'Dark' to change theme. +REM Target: Windows 10 + +REM *REQUIREMENTS* +REM admin required for disable USB function. + +REM some setup for dukie script. +DEFAULT_DELAY 100 + +REM open powershell (remove -W Hidden to show the window). +GUI r +DELAY 750 +STRING powershell -Exec Bypass -C irm https://raw.githubusercontent.com/beigeworm/BadUSB-Files-For-FlipperZero/main/BadUSB-Detect-and-Protect/main.ps1 | iex +CTRL-SHIFT ENTER +DELAY 2500 +ALT y diff --git a/Voice-Activated-DarkMode/main.ps1 b/Voice-Activated-DarkMode/main.ps1 new file mode 100644 index 0000000..ec25625 --- /dev/null +++ b/Voice-Activated-DarkMode/main.ps1 @@ -0,0 +1,45 @@ +<# ===================== VOICE ACTIVATED DARK/LIGHT MODE ====================== + +SYNOPSIS +Control Windows theme with your voice. +Say 'Light' OR 'Dark' to change theme. + +#> + +$Async = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' +$Type = Add-Type -MemberDefinition $Async -name Win32ShowWindowAsync -namespace Win32Functions -PassThru +$hwnd = (Get-Process -PID $pid).MainWindowHandle +if($hwnd -ne [System.IntPtr]::Zero){ + $Type::ShowWindowAsync($hwnd, 0) +} +else{ + $Host.UI.RawUI.WindowTitle = 'hideme' + $Proc = (Get-Process | Where-Object { $_.MainWindowTitle -eq 'hideme' }) + $hwnd = $Proc.MainWindowHandle + $Type::ShowWindowAsync($hwnd, 0) +} + +while ($true) { + Add-Type -AssemblyName System.Speech + $speech = New-Object System.Speech.Recognition.SpeechRecognitionEngine + $grammar = New-Object System.Speech.Recognition.DictationGrammar + $speech.LoadGrammar($grammar) + $speech.SetInputToDefaultAudioDevice() + $result = $speech.Recognize() + $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" + if ($result) { + $text = $result.Text + Write-Output $text + + if ($text -match 'Dark'){ + Write-Host "Set Dark Theme" + Set-ItemProperty $Theme AppsUseLightTheme -Value 0 + Set-ItemProperty $Theme SystemUsesLightTheme -Value 0 + } + if ($text -match 'Light'){ + Set-ItemProperty $Theme AppsUseLightTheme -Value 1 + Set-ItemProperty $Theme SystemUsesLightTheme -Value 1 + Write-Host "Set Light Theme" + } + } +} \ No newline at end of file