'Homeseer Media Player Music Request 1.0 (Special thanks to Steve Coles)
'Created by: Michael Lester (Verner, WV. USA) (k.mounts@citynet.net)
'Hello all, I'm a newbee at Homeseer and VB Script. And I hope that this short script will be 'enjoyed by some of you, especially since its my very first try at anything like this. I was 'trying to think of a way that I could just request Homeseer to play a particular type of 'music when I asked, like "Play some Rock and Roll" or "Play some Country". Or just ask it to 'play music and the have it ask me what type of music I wanted to listen to.
'Then I was looking at a script that Steve Coles wrote called (News Headlines). The more that 'I studied the script trying to make it work the more it came to me that I could borrow a 'little from his script and make Windows Media Player play my requested playlist.
'The script is very simple really, it explains itself when you read it. I included 'instructions inbeded in with the script like some others have done that helps so much.
'What it dose:
'1) You ask your MS Agent to play some music.
'2) MS Agent comes back and uses your Media Player playlist(s) to ask you to make your 'choice(s).
'3) You then choose "Rock" "Country" "Blues" etc... The possibilities are endless and the 'choices are totaly programed by you. Just make sure that you put the correct file path(s) 'and names to your (playlist.wpl) files.
'Here is what I created, please feel free to improve on it and post it. I'm still trying to 'work on it myself. Trying to figure out how to send play and stop commands to Media Player 'from Homeseer.
sub main()
' Define variables
Dim strType
hs.speak "What kind of music would you like to hear? You may choose from Rock and Roll, Country, Blues, Or say, cancel.", True
'clear out the last voice command recognized~
hs.LastVoiceCommand = ""
'create your own private playlist recognition list below, you can add any playlist name(s) 'you have, should be the first name of the playlist file for your Windows Media Player 'playlist music that you would like to call to make things easier.
'(ie.) filename: Country.wpl (should be) "Country Music" or "Country")
'Remember that Windows Media Player always wants to name your playlist file (my playlist.wpl)
'So make sure that particular playlist of Rock, Blues, Country, etc... is in the correct 'folder.
hs.AddVoiceCommand "Rock and Roll" 'file (C:\music\Rock and Roll\my playlist.wpl)
hs.AddVoiceCommand "Country" 'file (C:\music\Country\my playlist.wpl)
hs.AddVoiceCommand "Blues" 'file (C:\music\Blues\my playlist.wpl)
hs.AddVoiceCommand "cancel" ' (RESERVED FOR CANCEL OPTION)
'start Homeseer listening for your music choice
hs.StartListen
'wait for and check music choice command
Do
m = hs.LastVoiceCommand
If m = "Rock and Roll" Then
strType = "Rock and Roll"
Exit Do
End if
If m = "Country" Then
strType = "Country"
Exit Do
End if
If m = "Blues" Then
strType = "Blues"
Exit Do
End if
If m = "cancel" then
hs.speak "Cancelled. Maybe I can play some music for you later.", True
Exit sub
End if
hs.WaitEvents
Loop
hs.speak "Retrieving " & strType & ". Please wait.", True
'Enter your playlist name and location of playlist below, add as many playlist as you can 'dream up. Just make sure that they are in the correct folders and with the correct names 'that homeseer will look for.
If strType = "Rock and Roll" Then
hs.launch "C:\Music\Rock and Roll\my playlist.wpl",""
hs.speak "Rock and Roll should now be playing, if not, then you should check your settings in the script."
Exit Sub
End If
If strType = "Country" Then
hs.launch "C:\Music\Country\My Playlist.wpl",""
hs.speak "Country should now be playing, if not, then you should check your settings in the script."
Exit Sub
End If
If strType = "Blues" Then
hs.launch "C:\Music\Blues\My Playlist.wpl",""
hs.speak "Blues should now be playing, if not, then you should check your settings in the script."
Exit Sub
End if
End Sub
[This message was edited by WhatEver on Tue, 03 February 2004 at 01:16 AM.]
'Created by: Michael Lester (Verner, WV. USA) (k.mounts@citynet.net)
'Hello all, I'm a newbee at Homeseer and VB Script. And I hope that this short script will be 'enjoyed by some of you, especially since its my very first try at anything like this. I was 'trying to think of a way that I could just request Homeseer to play a particular type of 'music when I asked, like "Play some Rock and Roll" or "Play some Country". Or just ask it to 'play music and the have it ask me what type of music I wanted to listen to.
'Then I was looking at a script that Steve Coles wrote called (News Headlines). The more that 'I studied the script trying to make it work the more it came to me that I could borrow a 'little from his script and make Windows Media Player play my requested playlist.
'The script is very simple really, it explains itself when you read it. I included 'instructions inbeded in with the script like some others have done that helps so much.
'What it dose:
'1) You ask your MS Agent to play some music.
'2) MS Agent comes back and uses your Media Player playlist(s) to ask you to make your 'choice(s).
'3) You then choose "Rock" "Country" "Blues" etc... The possibilities are endless and the 'choices are totaly programed by you. Just make sure that you put the correct file path(s) 'and names to your (playlist.wpl) files.
'Here is what I created, please feel free to improve on it and post it. I'm still trying to 'work on it myself. Trying to figure out how to send play and stop commands to Media Player 'from Homeseer.
sub main()
' Define variables
Dim strType
hs.speak "What kind of music would you like to hear? You may choose from Rock and Roll, Country, Blues, Or say, cancel.", True
'clear out the last voice command recognized~
hs.LastVoiceCommand = ""
'create your own private playlist recognition list below, you can add any playlist name(s) 'you have, should be the first name of the playlist file for your Windows Media Player 'playlist music that you would like to call to make things easier.
'(ie.) filename: Country.wpl (should be) "Country Music" or "Country")
'Remember that Windows Media Player always wants to name your playlist file (my playlist.wpl)
'So make sure that particular playlist of Rock, Blues, Country, etc... is in the correct 'folder.
hs.AddVoiceCommand "Rock and Roll" 'file (C:\music\Rock and Roll\my playlist.wpl)
hs.AddVoiceCommand "Country" 'file (C:\music\Country\my playlist.wpl)
hs.AddVoiceCommand "Blues" 'file (C:\music\Blues\my playlist.wpl)
hs.AddVoiceCommand "cancel" ' (RESERVED FOR CANCEL OPTION)
'start Homeseer listening for your music choice
hs.StartListen
'wait for and check music choice command
Do
m = hs.LastVoiceCommand
If m = "Rock and Roll" Then
strType = "Rock and Roll"
Exit Do
End if
If m = "Country" Then
strType = "Country"
Exit Do
End if
If m = "Blues" Then
strType = "Blues"
Exit Do
End if
If m = "cancel" then
hs.speak "Cancelled. Maybe I can play some music for you later.", True
Exit sub
End if
hs.WaitEvents
Loop
hs.speak "Retrieving " & strType & ". Please wait.", True
'Enter your playlist name and location of playlist below, add as many playlist as you can 'dream up. Just make sure that they are in the correct folders and with the correct names 'that homeseer will look for.
If strType = "Rock and Roll" Then
hs.launch "C:\Music\Rock and Roll\my playlist.wpl",""
hs.speak "Rock and Roll should now be playing, if not, then you should check your settings in the script."
Exit Sub
End If
If strType = "Country" Then
hs.launch "C:\Music\Country\My Playlist.wpl",""
hs.speak "Country should now be playing, if not, then you should check your settings in the script."
Exit Sub
End If
If strType = "Blues" Then
hs.launch "C:\Music\Blues\My Playlist.wpl",""
hs.speak "Blues should now be playing, if not, then you should check your settings in the script."
Exit Sub
End if
End Sub
[This message was edited by WhatEver on Tue, 03 February 2004 at 01:16 AM.]
Comment