Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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?
 
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?

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.
 
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?
 
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
 
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.
 

Attachments

  • Picture 1.png
    Picture 1.png
    139.4 KB · Views: 63
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:

iscript.png


I have a feeling I'm doing something really stupid and I'm just waiting to find out what it is..
 
Is this where you placed your script? If the folders don't exist create them.
 

Attachments

  • Picture 3.png
    Picture 3.png
    110.1 KB · Views: 62
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.
 
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.

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/
 
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.
 
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.

Well you could make it check before it plays it. But that would be more work. :)
 
Well you could make it check before it plays it. But that would be more work. :)

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!
 
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!

Anytime thats what we are here for.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.