Skip to content

Instantly share code, notes, and snippets.

@robotsandcake
Created May 14, 2017 10:01
Show Gist options
  • Select an option

  • Save robotsandcake/bae13f6ff8af88567892806f5a6342d4 to your computer and use it in GitHub Desktop.

Select an option

Save robotsandcake/bae13f6ff8af88567892806f5a6342d4 to your computer and use it in GitHub Desktop.
This AppleScript when used in conjunction with DragonDictate for Mac will play/pause the current iTunes track.
try
-- Specify the application will want to work on, in this case iTunes.
tell application "iTunes"
-- Get iTunes current state
if player state is paused then
-- If iTunes is paused, press play.
play
-- Get iTunes state if it doesn't match the first condition
else if player state is playing then
-- If iTunes is playing, press pause.
pause
end if
end tell
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment