The getByName method retrieves a playlist of the media items with the specified name.
retVal = MediaCollection.getByName( name )
String containing the name.
This method returns a Playlist object.
To use this method, read access to the library is required. For more information, see Library Access.
The following JScript example uses MediaCollection.getByName to retrieve three items from the library. Each item is then appended to the current playlist. The Player object was created with ID="Player".
// In each case, use the name exactly as it appears in the library. // Windows Media Player does not include file name extensions or file paths // in the name. Internet URLs include the entire path, but not the // file name extension. // Get a playlist object that contains an Internet URL. var One = Player.mediaCollection.getByName("https://www.proseware.com/Media/Laure"); // Get a playlist object that contains a file on a network server. var Two = Player.mediaCollection.getByName("Jeanne"); // Get a playlist object that contains a file on a local drive. var Three = Player.mediaCollection.getByName("house"); // Append each item to the current playlist. Since each playlist retrieved // using getByName contains one digital media item, use Playlist.item with // an index of zero to reference that item. Player.currentPlaylist.appendItem(One.item(0)); Player.currentPlaylist.appendItem(Two.item(0)); Player.currentPlaylist.appendItem(Three.item(0));
||Windows Media Player version 7.0 or later.