iTunes 7.1 screwing up my script…

there must be some change in the iTunes dictionary for iTunes 7.1.1 because my script that worked with 7.0 no longer works. It’s this piece of code:

tell application "iTunes"
	set view of browser window 1 to library playlist 1
end tell

EDIT: I meant ot put this in the AS Studio thread, sorry:P

I moved it to OS X.

oh…lol…well do oyu know what the problem is?

I did try getting the name and setting it as a user playlist, but because the name comes back as “Library”
it did not work

it took a google to find it,

tell application "iTunes"
	set view of  browser window 1 to user playlist "Music"
end

Be nice if apple updated the .sdef to show changes.

That won’t work as expected for non-English users.

couldn’t you just go

tell application "iTunes"
   set view of browser window 1 to user playlist "Music" or "Musique"
end

oh wait, i guess there is more than french and english…

sorry for like the triple post here…but this works

set view of browser window 1 to user playlist 1

wooo, quadruple post!

ok, that doesn’t work, that sets it to the party shuffle playlist…thats so weird that library playlist 1 won’t work…

Ok, some playing,

It would seem that the Music/Library is a smart playlist.
It does not get listed as user playlist 1, because it actually slips in to the list of smart playlist names in the M’s in the English case.

Still trying to see if I can find a way to it without having to use its Smart Playlist name.

Hi,

Are you all saying that there is no library playlist property in the updated iTunes? In that case many iTunes scripts are now broken in the updated version. Almost all the scripts begin with getting the library playlist.


tell application "iTunes"
	activate
	set lib_pl to first library playlist
	set view of first browser window to lib_pl
end tell

This wouldn’t work?

gl,

nope, not anymore…:frowning:

the stupid thing is you can’t create smart playlists programmatically either (except for GUI scripting)

won’t that only work for people who have english iTunes?

‘special kind’ Man staring me in the face all that time.

I suspect that ‘set view of browser window 1 to user playlist “Music”’ would work in all Languages also.

I created two playlists called music one smart one not.
'set view of browser window 1 to user playlist “Music” only ever goes to the ‘Special’ Music playlist (library 1)

I meant to say library playlist object.

Then the library playlist class won’t compile in versions greater than 7.0 and you would get raw data for older scripts.

I tried that too, but in other languages that main playlist is not called “Music”; It’s localized. (Pick a different language in System Preferences and see for yourself).

The library playlist class still exists; However, I believe the “main” playlist a user uses has changed (like Mark mentioned). Consider this:

tell application "iTunes"
	count (tracks of library playlist 1)
end tell

My “Music” playlist has 840 songs, but the above script returns 880 (the other 40 items are videos and podcasts).

since in this snippet Music is not a string but an attribute it will work for all languages right?

Thanks Bruce just did that, yep it does not work.

So the only way to make it Localised is to use the Special Kind.

First of all, library playlist 1 can no longer be the object of a window’s view http://dougscripts.com/itunes/itinfo/itunes71info.php. This was done intentionally. Second, to display the Music playlist (which, yes, is a hard-coded Smart Playlist; see http://dougscripts.com/itunes/itinfo/itunes7masterlibs.php) do this:

tell application "iTunes"
	set view of front browser window to (get some playlist whose special kind is Music)
end tell

The Music playlist, however, is not the entire library, like “Library” playlist used to be. “Music” only displays audio tracks and PDFs. A workaround is to create a Smart Playlist with the criteria “size” - “is greater than” - “0”; name it “Everything”. To display it, use this:

tell application "iTunes"
	set view of front browser window to playlist "Everything"
end tell

See http://dougscripts.com/itunes/ixarch/arch.php?my=2007-03#030707