I like having a hotkey to bring up the get info box for the current iTunes track so that if I'm using another app and a song comes up, I can quickly edit it. This works (though if it's not the best way, please let me know):
tell application "iTunes"
activate
reveal current track
end tell
tell application "System Events"
tell process "iTunes"
key code 34 using command down
end tell
end tell
I've assigned that a hotkey in BetterTouchTool and it's great.
I'd like to have a version of that script to edit the previous song… but changing "current track" to "previous track" causes a completely different result. iTunes goes back to play the previous track again even though I only told it to reveal it, and then I get an error saying applescript can't continue reveal.
tell application "iTunes"
activate
reveal (previous track)
end tell
What's the easiest way to get iTunes to show the previous track in a playlist using Applescript?
Best Answer
You can in a round about way using the "Recently Played" playlist.
You configure it the way you want, I've set it to the 5 most recent items, and then run this code...
Hope this helped.
EDIT: This only works with songs that are fully played. Partially played tracks will not show up in the "Recently Played".