Last active
April 4, 2017 10:05
-
-
Save robotsandcake/3afc1d24f6b65e8bceb8e274ca460195 to your computer and use it in GitHub Desktop.
This AppleScript will toggle the iTunes player on macOS between two states, play and pause. It can be triggered from any application that can trigger AppleScripts.
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
| 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