PlaylistCollection.getByName method

The getByName method retrieves a PlaylistArray object containing playlists with the specified name, if any exist.

Syntax

retVal = PlaylistCollection.getByName(
  name
)

Parameters

name [in]

String containing the name of the playlists to be retrieved.

Return value

This method returns a PlaylistArray object.

Remarks

Use PlaylistArray.count to determine whether a playlist exists. If count is zero, a playlist does not exist.

To use this method, read access to the library is required. For more information, see Library Access.

Examples

The following JScript example uses playlistCollection.getByName to check the playlistCollection object for a playlist named "ThreeList". If the "Threelist" playlist exists, getByName sets "ThreeList" as the current playlist. The Player object was created with the ID = "Player".

//Retrieve the count of the playlists named "ThreeList".
var Checkit = Player.playlistCollection.getByName("ThreeList").count;

//Since duplicate playlist names are allowed, the count returned
//will be either zero (no playlist) or greater than zero 
//(playlist exists).
if (Checkit > 0){ 
    
   //Retrieve a playlistArray object containing "ThreeList". Assume that
   //there is only one playlist with that name, and assign it to the 
   //current playlist.
   Player.currentPlaylist = Player.playlistCollection.getByName("ThreeList").item(0);
}

Requirements

Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

PlaylistArray Object

PlaylistArray.count

PlaylistCollection Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights