Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Duck iTunes' volume (lower volume and then raise it again) with a keyboard shortcut
# https://gist.github.com/bfred-it/9690041
(* Duck iTunes' volume (lower volume and then raise it again) *)
(* Instructions:
- Create a service with Automator
- Add the "Run AppleScript" action
- Paste this in
- Save
- Open System Preferences > Keyboard > Shortcuts > Services
- Find what you just created
- Assign a keyboard shortcut
*)
on run {input, parameters}
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then
if the sound volume is greater than 50 then
set currentvolume to the sound volume
repeat with i from currentvolume to 50 by -1
set the sound volume to i
delay 0.01
end repeat
else
set currentvolume to the sound volume
repeat with i from currentvolume to 100 by 1
set the sound volume to i
delay 0.01
end repeat
end if
end if
end tell
return input
end if
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.