New Playlist window in iTunes

Hi,

I’m writing a script that plays a track from a playlist, but first opens a new playlist window of this playlist. The problem is that I can’t seem to get a new Playlist window in iTunes. I’ve tried ‘make new playlist’ or ‘set MyPlaylistWindow to etc…’ but this doesn’t seem to work.

Does anyone know how to open/create a new playlist window?

Thanks,

Bart

Hi Bart,

I don’t think you can do this. A work around might be to use the ‘choose from list’ standard addition.

tell application “iTunes”
set pl to current playlist
set ctn to name of current track
set tl to name of every track of pl
end tell
choose from list tl default items {ctn}

There might be a way to do what you intend in iTunes without opening the playlist window though. Depends what you’re trying to do after playing the song?

gl,

Hi,

Thanks for the repley.
I create songbooks and while I’m working I’m allways listening to iTunes. Sometime I need to listen to the song I’m working on. I 've created a script that selects the song I’m currently working on, but remembers the song I’m currently listening to so I can switch back to that song when I’m don listening to the song I’m working on… :? (are you still with me?)

The problem is that when you open a song in iTunes that is not in your current playlist., you can’t pause the song. Only stop it. Hitting the play button again starts the first (or selected) song in the current playlist ‘view’ in your browser window.

So what I want to do is first open a new Playlist window so I can pause the song if I want. And when I’m done working/listening to this song, close the playlist window and switch back to the song I was originally listening to.

But as if I understand you correctly this isn’t possible in iTunes.

Well if you can still understand me I’ll give you a PHD in forum-reeding.

:lol:

Bart

Hi Bart,

I understand. :shock:

Unfortunately you can’t play another playlist and come back to where it was paused in another track/playlist. You can’t get the place in a song where it is currently playing at also. If you use shuffle on the current playlist, then even if you come back to the same song, you’ll lose the last shuffle I think.

What I would do if getting back to the paused track is important is play the work song with some other app like QuickTime Player. Something like this:

tell application “iTunes”
pause
set cur_pl to current playlist
set cur_track to current track
set track_loc to location of cur_track
end tell
tell application “QuickTime Player”
launch
activate
open track_loc
end tell
tell application “System Events”
repeat until not (exists process “QuickTime Player”)
do shell script “sleep 1”
end repeat
end tell
tell application “iTunes”
activate
play
end tell

There is no error checking in the above, so you might want to add some. For instance, suppose the track is already paused. Another pause will cause it to toggle on and iTunes will play while QuickTime is playing.

If getting back to the pause is not important, then you can easily get the current playlist and current track, and replay the last song after playing the working song.

Too bad you can’t get the current playing position in iTunes like you can in QuickTime. Seems to me like it should be easy to add to iTunes as iTunes uses QuickTime.

gl,