Applescript add track to playlist

I have two variables track_name and selectedpl
selectedpl is defined with
set selectedpl to {choose from list x with prompt "Please select the playlist you want to save this song." with title "Playlist Selector"}
And I'm trying to do this command
duplicate track track_name to playlist selectedpl
I tried "quoted form of", "a reference to", " "'" & selectedpl & "'" " but no luck.
Thanks in advance
Best Regards

Okey this is my code
>>>>>>>>>>>>>>>>>>>>>>
set userApproved to true
try
          set addPlaylist to display dialog ¬
                    "Do you want to add this track to playlist now ?" buttons {"No", "Yes"} ¬
  default button "Yes" cancel button ¬
                    "No"
on error number -128
          set userApproved to false
end try
if userApproved is true then
          set newPlaylist to true
          try
                    set newPlaylistMaker to display dialog ¬
                              "Do you want to make a new playlist and save your track in that playlist ?" buttons {"No", "Yes"} ¬
  default button "Yes" cancel button ¬
                              "No"
          on error
                    set newPlaylist to false
          end try
end if
if newPlaylist is true then
          try
                    set playlistName to display dialog ¬
                              "What is your new playlist name ?" buttons {"OK"} ¬
  default button ¬
                              "OK" default answer ""
          end try
          set new_playlist_name to text returned of playlistName
          tell application "iTunes"
  make new user playlist with properties {name:new_playlist_name}
          end tell
          set selectedpl to new_playlist_name as text
else
          tell application "iTunes"
                    try
                              set x to get name of playlists
                    on error
                              display alert ("Can't get playlists from iTunes.")
                              error number -128
                    end try
                    set itemsToDelete to {"Arşiv", "Müzikler", "Filmler", "TV Şovları", "iTunes U", "Kitaplar", "Purchased"}
                    set prevTIDs to AppleScript's text item delimiters
                    set AppleScript's text item delimiters to "TRICK"
                    set x to "TRICK" & x & "TRICK"
                    repeat with i in itemsToDelete
                              set AppleScript's text item delimiters to "TRICK" & i & "TRICK"
                              set x to x's text items
                              set AppleScript's text item delimiters to "TRICK"
                              set x to x as text
                    end repeat
                    set AppleScript's text item delimiters to "TRICK"
                    set x to (x's text 6 thru -6)'s text items
                    set AppleScript's text item delimiters to prevTIDs
                    set selectedpl to {choose from list x with prompt "Please select the playlist you want to save this song." with title "Playlist Selector"}
          end tell
end if
tell application "iTunes"
  duplicate track_name to user playlist selectedpl
end tell
<<<<<<<<<<<<<<<<<<<<<<<
track_name is defined before with another script
The result I want to get is:
track_name is set -- No problem track_name is "Cobrastyle"
selectedpl is set -- Playlist is selected no problem selectedpl is "test"
add track_name to selectedpl -- Problem selectedpl needs to be contain track_name
Thanks in advance

Similar Messages

  • How to add tracks to playlist

    how to add tracks to playlist

    Assuming the track you want to add already resides in your Library, one way is to navigate to that song, right click on the name of the song you want to add, select Add To Playlist. and choose the playlist you want to add the song to.  (iTunes 12.1, OS 10.9.5)
    Good luck
    srb

  • Right-click add track to playlist doesn't do anything

    About 90% of the time (iTunes 12) trying to add tracks to existing playlists via right-click doesn't do anything.  No error message, but the track just doesn't get added.  I think this mostly happens when adding multiple tracks at once, not sure.  Clicking on the little circle and adding to playlist that way, on the other hand, seems to work for the one track but ignores all the other tracks you have selected and only adds that one track.
    Is this a known bug?  Does it only happen to me?
    I have to resort to always selecting all the tracks I want to add, then choose 'create new playlist from selection'.  This always works. Then I have to copy (drag-and-drop) the entries from that new playlist to the playlist I actually wanted the tracks in, and then delete the new unnecessary playlist.  It's an unnecessary amount of work.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings, disables most add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • Can't add to collaborative playlist

    I am trying to use the collaborative playlist feature for the first time. I made my playlist collaborative and sent the link to a freind. When she clicks on the link she goes to a URL on play.spotify.com and she can see the playlist but can't add to it. 
    She then made a playlist, made it collaborative and sent me her link. The same thing happens. I click the link, go to a play.spotify.com URL but can't figure out how to add to her playlist. 
    When I open my spotify app, I can not figure out how to see the collaborative playlist she sent me. 
    I am a premium user, signed in with facebook
    she is a free user, signed in withou facebook
    Plese hlep! We need to finish this playlist inthe next few days!
    Thank you. 

    Hey  -- welcome to the Community!
    If it's the first time you're using collaborative playlists, you might not know that you have to be Following it to be able to add it. As soon as you're Following it, you should be able to add tracks to it as you do any other playlist.
    If it's still not working though, try it in the desktop app, either by changing the URl to "open.spotify.com" rather than "play.spotify.com" in the address bar, or head into the web player settings and change links to open automatically in the desktop app.
    Hope that helps!

  • Annoyances with adding tracks to playlists

    Why is iTunes (12) on windows so weird and inconsistent?
    It's not terrible (WMP has big problems of its own) but its puzzlingly random in how the GUI works.  Its like it was designed by several people who didn't talk to each other.
    A major example - why are there are two different ways to add a track to a playlist? 
    (Actually there are three if you include using the main menu, but having a menu bar way and a context menu way is normal windows UI behaviour so that's fair enough, but itunes has two different context menus)
    You can right click on the track, or you can left click on the little blob after a track name. 
    The first method gives you a list of playlists that can't be scrolled using the mouse wheel, and is extremely slow to scroll through (requiring you to click on the tiny arrow at the bottom of the list then hold the mouse button down for ages).  But though the second method can be scrolled more rapidly, because it acknowledges the scroll wheel of the mouse, it doesn't let you add multiple tracks at a time, only the one whose blob you click on gets added, not the other selected ones.
    Its weird - why have two different context menus, and then have each of them have different unnecessary limitations?  Neither method is entirely satisfactory and you have to keep deciding which one to use for any given playlisting.  If you want to add to a playlist which is at the end of the alphabet you have to use the blob method because scrolling down to it with the right-click method is tedious in the extreme.  But if you want to add multiple tracks you have to use the right-click 'cos the blob method ignores the other tracks.
    Why not just have one _good_ method instead of two bad ones?

    jfgvui wrote:
    Its like it was designed by several people who didn't talk to each other.
    I wouldn't be at all surprised if that was the case.
    Just three? Don't forget you can also enable the playlists sidebar and use drag & drop or copy & paste.
    Suggestions for improvement should go to iTunes Feedback.
    tt2

  • Dragging tracks into playlists/ within playlists suddenly a problem (itunes version 12.1.2)

    I updated to 12.1.2 april 15 (its may 4 today) and literally all of a sudden this morning I cannot drag and drop any tracks into playlists, within playlists, or to devices. I can add with the right click menu option but cannot drag. I have OS X 10.10.3 and I have not made any changes to the operating system or computer. I searched google and the itunes forum and can't find any explanation that applies to my situation. Why is this happening and what can I do to fix it as quickly as possible?

    i don't know... its about the most frustrating random itunes problem i've ever experienced. i still have no idea why it spontaneously started malfunctioning but i managed to "fix" it by restarting my computer... i have no idea why that seems to have worked. i saw it on a similar but not necessarily applicable thread and thought it was worth a shot before spending the next hour or so troubleshooting with apple. just looking at all the boards today trying to figure out how to fix this particular issue, there are literally so many different similar cases of so many problems with itunes that its become clear they need to start fresh... anyway, maybe see if a restart helps resolve the click and drag issue for you. good luck.

  • Unable to add song to playlist

    DescriptionCannot add song to specific playlist A more detailed description, using numbered steps1. Right click on playing song2.Add to playlist   What I expected to happenTried to add song to playlist  https://open.spotify.com/user/timbuhwolf/playlist/3lNLEoSrmxT2TkMeSp2rcw What actually happenedPlaylist will not accept new songs. OTher playlists work fine. My Operating SystemWindows 8 Pro Is your Operating System 32 or 64 bit?64 bit Do you have a Service Pack installed?No My Spotify version1.0.10.107.gd0dfca3a My internet provider and countryWork intranet, USA Did you do a clean install of your current Windows version or did you upgrade from a previous version?Clean My usernametimbuhwolf 

    Hi, and welcome to the community!
    Try Creating a new playlist, copying all the songs from that one into the new one, then adding the track.
    Anthony

  • How do I add a new playlist to my ipod using iTunes 11?

    I recently was prompted to upgrad to iTunes 11, and while my immediate reaction is to hate it, I know I am just not used to it. My problem is that I cannot for the life of me figure out how to add a new playlist onto my ipod. Any help would be greatly appreciated. Thanks!

    Sorry, for the late response..
    When I click on the iPod, it would open a page where my only option was to "sync everything". And "Playlist" wasn't an option along the tabs at the top.
    But I was able to open the sidebar, like the previous version of itunes and now am able to just drag and drop.
    Thank you! I am much less frustrated now

  • Cannot add a new playlist to my iphone - Help!!!

    I am not able to add a new playlist to my iphone.  I recently changed my computer, and when I choose the option to manually manage my music, I get a message that my phone is synced to a different itunes library, and if I sync to this library my content will be erased.  Obviously I did not continue.  I authorized this computer (which I had not done before), but I still cannot add a new playlist.  What can I do?

    I found this solution on a gogle discussion site, and it works.
    "In iTunes, right click the playlist on your iPhone then select "export" to export the playlist as a .txt file (I have 3GS with iOS5). 
    Then still in iTunes, select "File, Library, Import Playlist", navigate to and open the .txt file, and it will appear in the iTunes sidebar.
    I've tried to do this numerous times before.  Sorry if this is old news but I was so pleased I wanted to share it."
    After creating the playlists in your itunes library, sync your phone with the settings to manually manage your music (which will delete all the music from your phone), then drag the playlists back to your iphone.  You can then start manually managing music on your phone.

  • I would like to use my deactiveted iPhone 3G for apps and music.  How do I add music?  When I synch with iTunes it won't add the selected playlists.

    I would like to use my deactiveted iPhone 3G for apps and music.  How do I add music?  When I synch with iTunes it won't add the selected playlists.

    See if this link offers any insight,
    Use iPhone as an iPod
    http://support.apple.com/kb/HT3406

  • Can't move tracks in playlists

    Since upgrading I appear unable to move tracks within playlists. Previously I just 'drag and dropped'. Any suggestions?

    I have the same problem about dragging songs within play lists. Things were all great last night as we were making music for our wedding and then all at once it stopped allowing us to drag songs into the order we wanted. Clicking on the number column, as suggested, does not work. Any other thoughts?

  • Can't add tracks to queue

    I can't add tracks to my queue. I find an album, highight every track, and then right click 'add to queue'.  The tracks used to show up after some delay but now they don't show up at all! The last time I restarted my Mac, Spotify updated and deleted my entire saved queue.  Now I can't replace the tracks that were deleted. Help!  Help!  Help!  Thanks so much!  -Katie

    I figured out how to get around this glitch.  Play a single track.  This single track will show up in your queue and so will your added tracks!   They only issue now is that the number of visible tracks in my queue is limited to 50.  I have more than 50 tracks queued but I can't see all of them.  When a track is finished playing and goes into my 'history' list, another new track will replce it at spot 50.  So I know Spotify recognizes all my queued tracks but for some reason, only shows the top 50. All these changes and bugs are annoying!  Each update is something new and different.  Arg!!!  Katie

  • How do I add track marks to a continuous mix?

    I purchased an album from iTunes that contains one track that is a continuous mix of music for over an hour. How do I add track marks to the mix when burning it to a cd? I would like to seperate it into smaller pieces while still preserving the continuous mix. Is this possible?
    MacBook   Mac OS X (10.4.8)  

    You can not do it in iTunes. Well I should say, you can not do it very easily. You basically need to break the file up into many files, one for each chapter. If the files can have gaps between them (they are not continuous live a live show) you can put those files back into iTunes and then burn them to a CD. If you need them to run together seamlessly, then you may need an outside application (like Toast) to put them on a CD with no gaps. I know iTunes now supports gapless playback, but I don't know if that includes when burning to a CDR or now. I still use iTunes v6, so no experience with it.
    Patrick

  • My windows PCM has iTunes 11.0.4.4. I created a new playlist in iTunes and wanted to add it to my iPod nano. When I tried to add the new playlist iTunes wanted to wipeout all of my other playlists before it would allow me to sync!  Help!

    I don't want to lose my playlist already on the iPod so I won't click the sync box because it will delete all my lists. How can I add a new playlist without losing the others?  Can it be done?

    You want to transfer purchases from the iPod to your iTunes account.
    Connect the device to iTunes but do not sync.
    Select File > Transfer Purchases.
    This will copy the content purchased via iTunes on the iPod to your iTunes account.

  • HT5649 how can you add a previous playlist from a different apple Id  both belong to the same person

    how can you add a previous playlist form a different apple ID, both belong to the same person

    It's ok to share the same AppleID for iTunes.  Use Separate ID's for iCloud, iMessage, and Facetime. 

Maybe you are looking for

  • How can I fully remove MyStart by IncrediBar from Firefox and my computer?

    I have no idea how MyStart by IncrediBar got on to my computer. Initially, it hijacked my browser, where upon opening Firefox (8.01) it re-directed my homepage to a MyStart search page. I have never intentionally allowed MyStart, IncrediBar, or Incre

  • Two mail accounts with same name and SSL not allowed?!

    Dear Common Wisdom: I have two accounts in my Mail program with the same web host. That means the outgoing mail server has the same name. If I put on SSL, though, it is not allowed to save two servers with the same name in two different accounts. Can

  • Color management and printer dialog

    When I print from PS CS-3 to my Epson R1800 printer I check "Photoshop Manages Color." I immediately get a question, "Did you disable color management in the printer dialog?" I am unable to find where I do this. Can anyone help?

  • No iCloud support in iwork on mac?

    I just upgraded to Mountain Lion and I seems to have a problem: there is no Icloud support i iwork. My copy of iwork is not from the mac app store, is that the problem? I really hope someone can help, since this feature is one of the reasons i upgrad

  • System diganostics appear on screen

    a black screen with the System diganostics appear on screenand it can't go bak to the menu screen and my imac doesn't pik up the ipod what can i do