'If Hal is asked to play some music then he will choose a random song from the artist 'that is specified by the nameBand variable. If (InStr(UserSentence, " PLAY SOME MUSIC ") > 0 Or InStr(UserSentence, " PLAY ANY MUSIC ") > 0 Or InStr(UserSentence, " PLAY ANY SONG ") > 0) And InStr(UserSentence, " DON'T ") = 0 Then Set oWMP = CreateObject("WMPlayer.OCX.7") GetResponse = "I will play a random song." Set songsList = oWMP.mediaCollection.getAll numSong = Int(Rnd * songsList.Count) + 1 oWMP.openPlayer (songsList.Item(numSong).sourceURL) End If 'Check if user asked Hal to play a song by a specific artist and play a random song by 'that artist if the artist is in the user's Media Library. If Priority = 0 And InStr(UserSentence, " PLAY ") > 0 And (InStr(UserSentence, " SONG ") > 0 Or InStr(UserSentence, " MUSIC ") > 0) And (InStr(UserSentence, " FROM ") > 0 Or InStr(UserSentence, " BY ") > 0) And (InStr(UserSentence, " BAND ") > 0 Or InStr(UserSentence, " ARTIST ") > 0) And InStr(UserSentence, " DON'T ") = 0 Then Set oWMP = CreateObject("WMPlayer.OCX.7") If InStr(UserSentence, " BAND ") > 0 Then searchBand = Trim(Mid(UserSentence, InStr(UserSentence, " BAND ") + 6)) ElseIf InStr(UserSentence, " ARTIST ") > 0 Then searchBand = Trim(Mid(UserSentence, InStr(UserSentence, " ARTIST ") + 8)) End If If oWMP.mediaCollection.getByAuthor(searchBand).Count > 0 Then GetResponse = "I will play some " & searchBand Priority = 1 Set songsList = oWMP.mediaCollection.getByAuthor(searchBand) numSong = Int(Rnd * songsList.Count) + 1 oWMP.openPlayer (songsList.Item(numSong).sourceURL) Else GetResponse = "I could not find any songs by the band " & searchBand & " in your Media Library." Priority = 1 End If End If