iTunes short for Add to Party Shuffle

Discussion in 'Mac Apps and Mac App Store' started by kolax, Mar 4, 2008.

  1. kolax macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #1
    I've been searching ages to try and find a shortcut to do this. Right-clicking and having to select something is very tedious.

    I'd rather just be able to press a key and it adds it. Much quicker.

    Any ideas how to do this? Maybe Apple Script?
     
  2. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #2
    I think your best bet is make an applescript add it to itunes so its in the script menu then map a key combo to it using system preferences.
    EDIT: I just checked and you can add keyboard shortcuts for items in that menu so you just need to make a script.
     
  3. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #3
    Nice - just what I was wanting to hear.

    Code:
    [b][color=blue]tell[/b] application[/color] "iTunes"
    	[b][color=blue]if [/b]selection[b] is not[/color][/b] {} [b][color=blue]then[/b][/color]
    		[b][color=blue]my[/color][/b] [color=green]addNextSong[/color][color=black]([/color][color=blue]item 1 of selection[/color][color=black])[/color]
    [b][color=blue]	end if
    end tell[/b][/color]
    
    [b][color=blue]on [/b][/color][color=green]addNextSong[/color][color=black]([/color][color=green]trackID[/color][color=black])[/color]
    	[b][color=blue]tell [/b]application [/color]"iTunes"
    		[b][color=blue]set [/b][/color][color=green]thePlaylist[/color][b][color=blue] to[/b] playlist [/color]"Party Shuffle"
    		[color=blue]duplicate[/color][color=green] trackID [/color][color=blue]to[/color][color=green] thePlaylist[/color]
    	[b][color=blue]end tell
    	
    end [/b][/color][color=green]addNextSong[/color]
    After looking at various tutorials, I've pieced together that. However, how do I get iTunes to run the script via a shortcut?
     
  4. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #4
    Now save that as a standard script with whatever name you want to appear in the menu. Then move it into your home folder /library/itunes/scripts Then it will appear in the script menu. Now go into system preferences and add a shortcut for it. :D
     
  5. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #5
    Yeh, that's what I done but I can't get iTunes to run the script when I press the shortcut combination.

    I put the script name as the menu title.

    Cheers.
     
  6. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #6
    does it run just by selecting it from the menu?
     
  7. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #7
    Yeah it runs. How do I assign a shortcut for that? It isn't a menu item is it?
     
  8. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #8
    It should be....
     

    Attached Files:

  9. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #9
    Okay, I don't get that in my iTunes menu bar! I have the normal menu bar, and to the right I have the script icon with this:

    [​IMG]

    I have a feeling I'm doing something really stupid and I'm just waiting to find out what it is..
     
  10. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #10
    Is this where you placed your script? If the folders don't exist create them.
     

    Attached Files:

  11. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #11
    Thought it was something stupid!

    I went to the script menu on the right of the screen and it had a pointer to the iTunes script folder in Home --> Library --> Scripts --> Applications --> iTunes.

    Got it working now, thanks for your help. Only problem now is when I run the script the music cuts out for a fraction of a second...maybe I need to tweak the script.
     
  12. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #12
    It does that for me too. That would be something with the script i suspect. But i have no experience with writing scripts though.

    The guy that made this site might be of some help: http://dougscripts.com/itunes/
     
  13. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #13
    Yeah, was Doug's scripting with a few others that I pieced together a simplified version.

    Turns out it is this part of the code:

    Code:
    try
    		play thePlaylist
    end try
    That was causing it to pause briefly. Idea of that was to start playing Party Shuffle if it wasn't already playing when a song is added.

    But I guess it is better without that, since it just replicates exactly the function 'Add to Party Shuffle - that doesn't start playing the playlist when a song is added.

    I'll update the code above incase others want to use that.
     
  14. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #14
    Well you could make it check before it plays it. But that would be more work. :)
     
  15. kolax thread starter macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #15
    Added in an If statement to check whether it was playing first or not and it worked, but I prefer being able to pause Party Shuffle and still add things to the playlist without causing it to start playing again.

    Cheers for all your help by the way!
     
  16. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #16
    Anytime thats what we are here for.
     

Share This Page