-
-
Save phpfunk/4527397 to your computer and use it in GitHub Desktop.
Mute Spotify when ads are playing
This file contains hidden or 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
--Mute Spotify when ads are playing. Use if in a country where you can't | |
--purchase a pro account. Open AppleScript editor (Applications > Utilities) | |
--paste this script in and then go File -> Save As, change 'File Format' to | |
--'Application' and save somewhere. Run Spotify using that application. | |
set currentTrack to "" | |
do shell script "open -a \"Spotify\"" | |
delay 5 | |
repeat while appIsRunning("Spotify") | |
tell application "Spotify" | |
if player state is playing then | |
if get sound volume > 0 then | |
set defVolume to sound volume | |
else | |
set defVolume to 60 | |
end if | |
set currentTrack to current track | |
if currentTrack's name is "Spotify" then | |
set sound volume to 0 | |
else | |
set sound volume to defVolume | |
end if | |
end if | |
end tell | |
delay 2 | |
end repeat | |
on appIsRunning(appName) | |
tell application "System Events" to (name of processes) contains appName | |
end appIsRunning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment