Skip to content

Instantly share code, notes, and snippets.

@Pe8er
Last active August 31, 2018 02:30
Show Gist options
  • Save Pe8er/9c65f7e53556a06737c0971e73de8100 to your computer and use it in GitHub Desktop.
Save Pe8er/9c65f7e53556a06737c0971e73de8100 to your computer and use it in GitHub Desktop.
set localComputer to "" -- enter name of a remote computer
set username to "" -- remote computer username
set computerPassword to "" -- remote computer password
set remoteComputer to "eppc://" & username & ":" & computerPassword & "@" & localComputer
set rTunes to application "iTunes" of machine remoteComputer
if application "iTunes" is running then
try
tell application "iTunes"
set {tArtist, tName, tAlbum, theID} to {artist, name, album, database ID} of current track
set macbook to source 1
tell macbook to set songLocation to (every track of playlist 1 whose database ID is theID)
if songLocation is {} then
tell rTunes
set mySongs to every track of playlist 1 whose database ID is theID
repeat with aSong in mySongs
my toggleLoved(aSong)
end repeat
end tell
else
my toggleLoved(current track)
end if
end tell
on error e
return e
end try
end if
on toggleLoved(theSong)
tell application "iTunes"
tell theSong
if loved is false then
set loved to true
else
set loved to false
end if
return loved
end tell
end tell
end toggleLoved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment