Keyboard shortcut to 'Like' currently playing song in iTunes 12.2?

Would it be possible?
Any ideas?

Though not a direct answer how to click the love for the currently playing song thing might be something useful to you.

This didn't completely work for me but might get you started. I couldn't find any commands in the AppleScript for Love current song in iTunes 12.2.
iTunes - Love Current Song.kmmacros (32.4 KB)

Learn Current Song or Repeat (9.4 KB)

1 Like

How about this AppleScript?

tell application "iTunes"
    set loved of current track to not loved of current track
end tell

@JW123: Wow, works great and it’s straightforward!!

@skillet: Thanks but I’ll go with @JW123 script.

Thank you so much.

Me too! :slight_smile:


The ‘English-like’ character of Applescript means that when we want to like a track we write

    set loved to not loved

which might cause one to scratch one’s head outside a context like:

on run
	tell application "iTunes"
		tell current track
			-- Clear  :-) ?
			set loved to not loved
			return loved
		end tell
	end tell
end run

In Javascript for Applications, FWIW, you could write:

(function () {
	var appTunes = Application("iTunes"),
		oTrack = appTunes.currentTrack();
	oTrack.loved = !oTrack.loved();
	return oTrack.loved();

Why this works great on my home computer, it gives me the following error on my work computer, any idea?

execution error: Can’t make «class pLov» of «class pTrk» of application "iTunes" into type boolean. (-1700)

Hey Max,

I looks like you don't have iTunes 12.2 installed on that machine.

The 'loved' property is not available in versions previous to that.


I thought the same but I’m on, weird.

If you transferred a compiled (.scpt) applescript across, it may be worth transferring a text version (.applescript) to the other machine, and then doing Save As Compiled ( --> .scpt) from Script Editor there, and testing the locally re-compiled script.

Hey Max,

Hm... Make sure you don't have more than one version of iTunes installed.

If you haven't rebooted since installing iTunes 12.2 then do so.

Open the Script Editor (Applescript Editor pre-Yosemite) and run this script:

set iTunesApp to path to application id ""
tell application "Finder"
	version of iTunesApp
end tell

See if the version it shows is what you expect.

Otherwise I'm scratching my head...


I noticed that this script does also the opposite, (unmarks a loved song) (if it was already loved it turns into a “regular”/not loved one).
Maybe, due to my lack of knowledge in applescript it seems to me that I discovered something new but for all of you, “applescript knowers” its obvious; but I’ll take the risk… :smile:
If that’s the case, just ignore my “discovery”?

Hey Saul,

set loved of current track to (get not loved of current track)

Perhaps a couple of parentheses will make that a little more clear.

The parenthetical item will resolve to true or false depending upon the current state of loved, therefore this line will toggle loved on/off.


Hi Chris.
Thanks for taking the time to teach a novice something new! :thumbsup:
Have a nice afternoon.

Yes, I rebooted since. The result is

"iTunes, © 2000–2015 Apple Inc. All rights reserved."

Pretty weird. I’m getting a new laptop in a few days, hopefully I’ll be good with the new one :smile:

Thanks for your help.

Hi all.

Have the same issue as @maxaudet, @JW123’s script doesn’t work for me.
Looks like it’s an iTunes bug. Found radar report about this. “current track” doesn’t work. Also noticed the same issue with “current playlist”.

1 Like

Updated to iTunes 12.2.1 on Monday and was still having the bug.
Tried again this morning and it works… go figure. I don’t think I’ve done anything special…


Have you tried recompiling the script ?

(.applescript text → Save As .scpt)

Ugggh I get the same issue and I'm on 12.2.1 the latest.

It appears that the error message a few people are getting only happens for tracks which aren’t in My Music. If you’re listening to a track in For You, for example, and try to like it with the shortcut, you’ll get the error message. If you add the track to your My Music first, you don’t get the error.

A solution would be for the script to add the track to My Music, then love it. I’ve had a play around with it, but can’t figure out how to make that work. Maybe someone with better Applescript knowledge will have move luck?

Edit: Only noticed the Radar report that someone linked to after I’d replied. It seems that it related tot his issue.