From 37f878b0fa1b0ef765c69eba41589f8d6653abf2 Mon Sep 17 00:00:00 2001 From: Gabe Date: Sat, 9 Aug 2025 16:40:26 +0000 Subject: [PATCH] Upload files to "Fun\Random" --- .../USB Connect & Disconnect Sound.ps1" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 "Fun\\Random/USB Connect & Disconnect Sound.ps1" diff --git "a/Fun\\Random/USB Connect & Disconnect Sound.ps1" "b/Fun\\Random/USB Connect & Disconnect Sound.ps1" new file mode 100644 index 0000000..d3a8d2e --- /dev/null +++ "b/Fun\\Random/USB Connect & Disconnect Sound.ps1" @@ -0,0 +1,44 @@ +<# +Author: Gabe Kerntke +Date: 03-10-2025 + +.Synopsis + +.Modified +2025-03-10 (GabeK) - Original script created + +#> + +# Variables # + +$soundPlayer = New-Object System.Media.SoundPlayer +$DisconnectSound = "C:\Windows\Media\Windows Hardware Remove.wav" +$ConnectSound = "C:\Windows\Media\Windows Hardware Insert.wav" + +# Functions # + +Function USBSound { + $soundPlayer.SoundLocation = $DisconnectSound + $soundPlayer.Play() + + Start-Sleep 2 + + $soundPlayer.SoundLocation = $ConnectSound + $soundPlayer.Play() +} + +Function LoopUSBSound { + for ($i = 0; $i -lt 3; $i++) { + Start-Sleep 5 + USBSound + } +} + +# Start Script # + +Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName PresentationFramework + +LoopUSBSound + +# End Script # \ No newline at end of file