Go To My Music
September 10th, 2009In response to the updated iTunes 9.0 from Apple, fellow developer Todd Ditchendorf complained on Twitter that the application still lacks a convenient shortcut for “jumping back to the music.”
I use iTunes all the time, but it hadn’t occurred to me how annoying this is. You’ve been fishing around in the iTunes store, or the Podcasts source, or Audiobooks, or any of the numerous other zones of the application. Then, you get the crazy notion to actually use iTunes to listen to music, so you jump to the search box and start searching. Bah! It’s not searching my music, it’s searching the App Store, or whatever. Now you have to go click the “Music” icon, and start your search again.
So yes, it would be handy to have a convenient shortcut to switch back to the Music source, and that is where my scripting utility FastScripts is particularly potent. It was a little tricky to deduce which magic scripting command would achieve the goal, but I think I figured it out:
tell application "iTunes" set view of (browser window 1) to user playlist 1 end tell
Save this as a script file in your home directory:
[Home] -> Library -> Scripts -> Applications -> iTunes
This is an “Application-specific” scripts folder for iTunes, meaning it will only show up when the iTunes application is actually active and frontmost. Now you can open up FastScripts (free for up to 10 shortcuts) and use it to assign a keyboard shortcut:
Now when I’m browsing iTunes, I just press cmd-option-M and it jumps instantly to my music!
I have a bunch of iTunes scripts that I find useful. Over the next few days I’ll be highlighting other convenient tricks I use to make iTunes a more useful application through its scriptability.
September 10th, 2009 at 1:17 pm
Perfect!
September 10th, 2009 at 2:17 pm
Excellent, thank you. I modified it to select the iTunesDJ.
…user playlist to “iTunes DJ”
September 10th, 2009 at 2:19 pm
If music is already playing, Cmd-L brings you to the currently playing track in its playing context (Library, iTunes DJ, etc.).
September 10th, 2009 at 2:21 pm
Reading this, I came to a similar realization: I go to the Music library often, but only to search. So I took your script and extended it (hope the formatting is readable):
tell application “iTunes” to set view of (browser window 1) to playlist “Music”
tell application “System Events”
tell process “iTunes”
keystroke “f” using {command down, option down}
end tell
end tell
My addition puts the cursor in the Find field, ready for typing, which saves me one step. I called the script “Find in Music,” and gave it a key combination of ⌘F in FastScripts. This overrides the iTunes fullscreen command, but I never use that, anyway.
Thanks for the inspiration! Looking forward to seeing your other iTunes scripts.
September 10th, 2009 at 2:56 pm
Also, if music is already playing, you can use CMD-L to go to the currently playing song.
September 10th, 2009 at 3:00 pm
the cmd-L shortcut is very nice, and i use that alot.
but usually the situation is that i was browsing the iTunes Store and playing music/media there. and then i want to go back to my own local music library without taking my mits off the keyboard. so in that very common case, cmd-L doesn’t work cuz I’m not currently playing anything in my library.
this shortcut with FastScripts is a *really* nice addition to iTunes :)
September 10th, 2009 at 6:01 pm
I think it is possible to get the playlist of the currently playing item and then you could set the view to that playlist so that this script would work no matter what playlist your track is contained in. I don’t have time to look into it right now but the syntax is something like this:
set view of (browser window 1) to Playlist of (current track)
I have written a number of iTunes scripts for use in iKey and have been looking at FastScripts but it doesn’t appear to have a feature I really need which is defining sets of hotkeys that work in all application except a list of applications (mostly just the Adobe CS apps and some games) I can define to be excluded. If I have just missed this feature then please correct me because I am kind of worried about the future of iKey with Snow Leopard.
September 10th, 2009 at 6:05 pm
Hi Twist – you haven’t missed that feature in FastScripts. Sounds like a great idea, though. The infrastructure for FastScripts is designed in a way that would make something like that fairly easy. The hardest part would be designing and implementing the UI. I’m adding it to my feature “maybes” list.
September 10th, 2009 at 6:36 pm
Nice script but it didn”™t worked when I put it in the folder you said … I had to change/put it into:
“~/Library/iTunes/Scripts/Go To Music.scpt”
Besides that … you don”™t needFastScripts to nail keyboard shortcut to it: in Mac OS X 10.6 you can add a shortcut via: System Preferences > Keyboard > Keyboard Shortcuts > Application Shortcuts (left sidebar) > [+] > Application: iTunes – Menu Title: “Go To Music” – Keyboard Shortcut: “⌥⌘M” (as example)
September 11th, 2009 at 12:57 am
Hi Yoram – the difference is the location I mentioned is where you put it to get it to show up in FastScripts or Apple’s Script Menu. iTunes does have its own app-specific script menu which is different. I wasn’t aware until today that system preferences keyboard shortcuts would work when the iTunes-specific script menu is used. That’s cool!
September 12th, 2009 at 12:15 am
Fantastic Stuff
Thanks
September 12th, 2009 at 9:22 am
Alright here is the improved version of the script I mentioned in my previous comment:
“tell application “iTunes” to set view of (browser window 1) to playlist (name of current playlist)”
It is all one line and should execute a tiny bit faster than the Daniel’s original script because of this (you will only notice it on really slow computers though).
October 3rd, 2009 at 2:40 am
Great solution! Really weird why Apple did not include a shortcut for this simple but often-used action.
October 26th, 2009 at 2:05 pm
Here’s a shortcut I use a lot while rating unrated music, etc.:
tell application “iTunes”
reveal current track
activate
end tell