#!/usr/bin/osascript | |
-- SpotifyPlayPause | |
-- Copyright 2015 Schlameel | |
-- | |
-- This program is free software: you can redistribute it and/or modify | |
-- it under the terms of the GNU General Public License as published by | |
-- the Free Software Foundation, either version 3 of the License, or | |
-- (at your option) any later version. | |
-- | |
-- This program is distributed in the hope that it will be useful, | |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
-- GNU General Public License for more details. | |
-- | |
-- You should have received a copy of the GNU General Public License | |
-- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
-- Try to playpause Spotify first if it running | |
if application "Spotify" is running then | |
tell application "Spotify" | |
playpause | |
end tell | |
else | |
-- If Spotify isn't running, then check to see if iTunes is | |
if application "iTunes" is running then | |
-- If iTunes is running tell it to playpause | |
tell application "iTunes" | |
playpause | |
end tell | |
else | |
-- Neither iTunes nor Spotify are running, so launch Spotify and tell it to play | |
tell application "Spotify" | |
launch | |
end tell | |
delay 3 -- Modify this delay as needed | |
tell application "Spotify" | |
playpause | |
end tell | |
end if | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment