Last active
April 29, 2023 04:20
-
-
Save SandiyosDev/f3bcd6a27ddcaf1846d2a5e7c7afba21 to your computer and use it in GitHub Desktop.
Ping Notification_with FFmpeg on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ping_Notification_with_FFmpeg_on_Windows.ps1 | |
# Play a sound when a specific IP address responds to a ping | |
# Requires FFmpeg's ffplay (https://www.gyan.dev/ffmpeg/builds/) | |
# | |
# Instructions: | |
# 1. Download FFmpeg's ffplay binary from the link above and extract it to a folder (e.g., C:/Program Files (x86)/Ffmpeg6.0/) | |
# 2. Replace the $ipAddress variable's value with the IP address you want to ping | |
# 3. (Optional) Change the $soundFile variable's value to the path of your desired sound file | |
# 4. Save the script with a .ps1 file extension or copy the entire block to run directly in PowerShell | |
# 5. Run the script with administrative privileges in PowerShell | |
# 6. To stop the script, press Ctrl+C in the PowerShell window | |
# | |
# Note: The chime sound file used in the script is included in Windows by default | |
$ffplay = "C:/Program Files (x86)/Ffmpeg6.0/ffplay.exe" | |
$ipAddress = "127.0.0.1" # Replace with the IP address you want to ping | |
$soundFile = "C:/Windows/Media/chimes.wav" # Replace with the path to your sound file | |
while ($true) { | |
if (Test-Connection -Quiet -Count 1 $ipAddress) { | |
Start-Process -FilePath $ffplay -ArgumentList "-nodisp","-autoexit",$soundFile -NoNewWindow | |
} | |
Start-Sleep -Seconds 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment