Méthode PlaylistCollection. getByName
La méthode GetByName récupère un objet PlaylistArray contenant des sélections portant le nom spécifié, le cas échéant.
Syntaxe
retVal = PlaylistCollection.getByName(
name
)
Paramètres
-
nom [ dans]
-
Chaîne contenant le nom des sélections à récupérer.
Valeur de retour
Cette méthode retourne un objet PlaylistArray .
Notes
Utilisez PlaylistArray. Count pour déterminer si une sélection existe. Si Count est égal à zéro, aucune playlist n’existe.
Pour utiliser cette méthode, l’accès en lecture à la bibliothèque est requis. Pour plus d’informations, consultez accès à la bibliothèque.
Exemples
l’exemple de JScript suivant utilise playlistCollection. GetByName pour vérifier l’objet playlistCollection pour une sélection nommée « ThreeList ». Si la sélection « Threelist » existe, GetByName définit « Threelist » comme sélection actuelle. L’objet Player a été créé avec l’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);
}
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media version 7,0 ou ultérieure. |
| DLL |
|