Created
September 30, 2017 18:08
-
-
Save JPablomr/ecc05091e101a702888e79b77f634c9c to your computer and use it in GitHub Desktop.
Set Skype Mood Message to what's playing on Spotify
This file contains 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
on getCurrentlyPlayingTrack() | |
tell application "Spotify" | |
set currentArtist to artist of current track as string | |
set currentTrack to name of current track as string | |
return currentArtist & " - " & currentTrack | |
end tell | |
end getCurrentlyPlayingTrack | |
on isSpotifyPlaying() | |
tell application "Spotify" | |
set appStatus to player state as string | |
return appStatus = "playing" | |
end tell | |
end isSpotifyPlaying | |
on getSkypeMoodMessage() | |
tell application "Skype" | |
return send command "GET PROFILE MOOD_TEXT" script name "Status-Script" | |
end tell | |
end getSkypeMoodMessage | |
-- Let's keep the status | |
set currentStatus to getSkypeMoodMessage() | |
try | |
repeat while 1 ≠ 0 | |
set currentSong to getCurrentlyPlayingTrack() | |
if isSpotifyPlaying() then | |
tell application "Skype" | |
send command "SET PROFILE MOOD_TEXT (music) #nowplaying: " & currentSong script name "Status-Script" | |
end tell | |
else | |
tell application "Skype" | |
send command "SET " & currentStatus script name "Status-Script" | |
end tell | |
end if | |
delay 2 | |
end repeat | |
on error ctrlC | |
log ctrlC | |
-- Alright, something broke. Enough fun, back to the original Mood Text | |
tell application "Skype" | |
send command "SET " & currentStatus script name "Status-Script" | |
end tell | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment