Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add current iTunes track to a chosen playlist Apps
Ok, this might not sound all that interesting, but it's all in how you use it! I wrote this very simple AppleScript to tell iTunes to add the song that was currently playing to a specific playlist. I called this playlist "Current Favs." I wanted to be able to add songs to this list whenever I wanted to on the fly. I'll give you the script, then tell you how it is really convenient.
-- Set myList to the name of the playlist to
-- which you wish to add the currently playing song.

set myList to "Current Favs"

property okflag : false

tell application "Finder"
  if (get name of every process) contains "iTunes" then ¨
  set okflag to true
end tell

if okflag then
  tell application "iTunes"      
    set currentList to playlist myList
    add (get location of current track) to currentList
  end tell
end if
Once you've created the script, put it somewhere for safe keeping. I put all my referenced scripts under ~/Applescripts. Now the beauty of this script comes when you use a hot key application like iKey (Youpi Key) to set it to run with the press of a key. I already have F10 F11 and F12 set to prev track, pauseplay, next track respectively, so i set F9 to launch this applescript. Once you hit the key, its all transparent. You see nothing, and iTunes doesn't even gain focus. The track is instantly added to that playlist.

Next, I tell iTunes to use THAT playlist as one of the ones that is synced to my iPod. Now i have an instant key to add songs to my iPod. Whenever I hear a good song and think, 'MAN thats a good song!,' it gets bookmarked for later as well as instantly synced to my iPod once it's connected ... with nothing more than a button push.
    •    
  • Currently 3.00 / 5
  You rated: 4 / 5 (5 votes cast)
 
[15,165 views]  

Add current iTunes track to a chosen playlist | 7 comments | Create New Account
Click here to return to the 'Add current iTunes track to a chosen playlist' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add current iTunes track to a chosen playlist
Authored by: craigsheppard on Aug 25, '03 09:55:59AM

I do a similar thing, but I use my Sony Erricson and SEC to add songs from my phone. It's really great - you don't even have to get off the couch!



[ Reply to This | # ]
Add current iTunes track to a chosen playlist
Authored by: chabig on Aug 25, '03 10:19:38AM

Wouldn't it be simpler to just combine the iTunes test like this:

set myList to "Current Favs"

tell application Finder
  if (get name of every process) contains "iTunes" then
    tell application "iTunes"
    set currentList to playlist myList
    add (get location of current track) to currentList
  end tell
end tell

Chris (not a programmer--who am I to criticise code?)



[ Reply to This | # ]
Add current iTunes track to a chosen playlist
Authored by: DougAdams on Aug 25, '03 03:24:14PM
There's nothing new under the sun:

SaveFave

dec 02 '01

This script applet copies the track currently playing to a playlist called "Favorites". It will create a "Favorites" playlist if none exists. You can edit it to change the default playlist name from "Favorites" to something you find more appropriate.

Doug
Doug's AppleScripts for iTunes


[ Reply to This | # ]
It may not be new, but at least it works...
Authored by: ElectusUnum on Aug 26, '03 04:20:40PM

Your script goes into an endless loop and leaves me with a hundred "Favorites" playlists. Maybe you should debug your code instead of trolling news comments to pimp your script site?



[ Reply to This | # ]
Why not use ratings?
Authored by: rufo on Aug 26, '03 11:26:31AM
Seems to me a simpler thing to do is to have a smart playlist for your top rated songs, then use one of the numerous iTunes controllers (I'm partial to PTHiTunesNotifier) to rate it using a key. You can even rate it by right-clicking on the iTunes icon in the dock. Then it gets instantly added to your playlist, and gets synced to your iPod. No slightly messy AppleScripts involved. I could still see uses for something like this, but with a favorites playlist, why not use what's built in?

[ Reply to This | # ]
Add current iTunes track to a chosen playlist
Authored by: lllama on Aug 28, '03 03:52:16AM

I've got a similar script sitting in my dock. One thing that I added was a check for whether the playing track is in the playlist already.

The code for this is left as an exercise for the reader, as my iMac is packed up waiting to move to another house at the moment.



[ Reply to This | # ]
Add current iTunes track to a chosen playlist
Authored by: midget2000x on Jul 08, '09 11:45:25AM
I wanted to be able to add the playing track to *any* playlist, not just one that's hard-coded into a script. This script will prompt you for the playlist to add the track to, and create the playlist if it's not already there. Also, it doesn't add dupes if the track's already on the playlist. http://www.netstreamshifter.com/2009/05/quick-add-playin-track-to-itunes.html

[ Reply to This | # ]