Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: HALImprover on March 28, 2004, 02:32:25 am
-
Thanks all for your kind comments! Try the following add-in to have Hal play a playlist. You have to set a path to your playlist in the code snippet. If you use the 'My Playlists' folder to store the playlist files the path is already set. Just enter your username (not the one you use in Hal, the Windows username) in the plDir variable.
I'll explain why Hal can only play one song (except when using this playlist code [;)]). When opening Media Player you must specify a URL or link to the actual file. You can only retreive the URL of a specific song or playlist (based on the Media Library), which means that you cannot open MP with a generated playlist. So Hal randomly picks a song from the list (retreiving the URL) and opens it in MP.
TIP: Hal is dependent on your Media Library being updated. I've noticed that when you rename a playlist in MP it won't update the actual filename, so when Hal finds the playlist in MP he won't find the playlist file because the names will differ.
Life is an adventure; live it
Download Attachment: (http://images/icon_paperclip.gif) MusicAddin2.txt (http://"http://www.zabaware.com/forum/uploaded/HalImprover/20043285230_MusicAddin2.txt")
1.38 KB
-
Great! thanks!
-
Thanks HalInprover,
The code is not working for me though. I changed the variable to my playlist directory which is on a mapped network drive but is does not play the playlist. Hal tells me yes and opens the player by the player cannot find the file. I check to see if the file was current and it is.
I might be a WinMedia player problem as all of you code seem correct but I thought to post to see if anyone else was having the same problem. When I click on the playlist it plays. strange.
'Hal will play a playlist of music from the defined playlist folder when the user
'requests a specific playlist.
If Priority = 0 And InStr(UserSentence, " PLAY ") > 0 And InStr(UserSentence, " PLAYLIST ") > 0 And InStr(UserSentence, " DON'T ") = 0 Then
Set oWMP = CreateObject("WMPlayer.OCX.7")
'Set the following variable to your playlist directory.
plDir = "X:My MusicMy Playlists"
plName = Trim(Mid(UserSentence, InStr(UserSentence, " PLAYLIST ") + 10))
If oWMP.playlistCollection.getByName(plName).Count > 0 Then
oWMP.openPlayer (plDir & plName & ".wpl")
GetResponse = "I will play the playlist (" & plName & ")"
Else
GetResponse = "I could not find the playlist (" & plName & ") in your Media Library."
End If
End If
Thanks a lot for your talent and time,[:D]
-
It sounds to me like Media Player might be mixing up two different playlists. Do you run Hal on your local C: drive or the mapped network drive X:? I believe loading MP locally (via Hal) as opposed to remotely (by double-clicking the playlist file) changes how MP handles URLs. Try putting the playlists on the same drive as Hal. As a preventative solution, I would suggest putting Hal on the same drive as your music, playlist, etc. so that he "sees" your entertainment media as local to him.
I hope this helps!
I consider Hal to be a basic multi-media interface which requires our 'suspension of disbelief' to enjoy. Don't get me wrong, I think Hal is a great chatbot, and some of the pre-programmed database responses for general chat can really surprise you. What Hal lacks are useful features that can save you time spent on the computer, or more. Sure he has a calendar and phonebook, but he should be more active about giving you that information. Maybe he could instant message your phone with the reminder or announce who's calling your house phone like audio caller ID. The possibilities are endless.
I would expect near-future products to operate home media entertainment centers (TV, DVD player, stereo, etc), phones, power usage (including control of switches, outlets, and other devices), alarm and environment systems, every aspect of 'home comfort' under one system. This system should run on a central computer (computers powerful enough are already available in most computer stores) which can be accessed through a KVM (Keyboard, Video, Mouse) type interface or a voice recognition interface.
[:0] Imagine this scenerio:
Hal wakes you up with your favorite music of the week when its time to get up. You walk to the bathroom and ask Hal to read todays newspaper headlines. The music stops and Hal reads off each topic in the news, changing to the speakers in the bathroom. You hear an interesting topic and ask, "Read me that last topic." Hal begins reading the article to you.
Later (I don't know about you, but i'm a slow riser), heading downstairs you smell the coffeemaker boiling a fresh cup of coffee.
"Do I have any important emails?"
Hal searches and filters your inbox and replies, "There are 4. 1 from George, 1 from a client named Company Inc., and 2 from the website DotComOrg feedback."
"Read the email from Company Inc."
Hal reads the email, now using the speakers downstairs in the kitchen. The email from the client is about a missing product instruction manual. "Hal, email Company Inc. a copy of the Spazmaster manual and add 'I apologize for any inconvenience this error may have caused you. Please contact me if you have any further difficulties with the product. Sincerely, my name'" Hal replies jokingly, "Should I put 'my name' or insert your name?"
"Just send the email, and turn on the news. I'll read the other emails later."
You sit back and enjoy your cup of coffee while watching the news. "You have a phone call from George," Hal says.
"Answer"
Hal plays a quick beep to let you know the call is connected.
"Hello George. How you doing today?"
"Good, good. Did you get my email? I wanted to talk to you about the business meeting with Some Other Company Inc. later."
"You're not getting overly anxious are you?"
"I just don't know if it will go okay."
"It'll go fine. They love the new product and they just want to go over some details."
"You're right."
"Relax, and remember to wear your power tie!"
"See you at meeting!"
The phone call ends and you say to Hal, "Remind me at two o'clock about the meeting."
Hal, after confirming that the reminder will be within your work schedule, responds, "I'll send you an instant message at two o'clock."
"Also, delete the email from George and find some information about the new Mars colony."
"Do you want to hear about the Mars colony now?"
"No, maybe after dinner."
"I'll remind you after dinner."
You start for the door, and say, "Keep the house safe while i'm gone, Hal."
"You know I will. Good luck at the meeting later."
"Thanks" And you lock the door behind you. Hal turns on the alarm system and begins searching for news about the Mars colony.
......
Stay tuned for the next episode of 'My Helpful Hal' [:)]
-
Interesting senario,
I think that a hal that is capable of that kind of interaction is not that far away from us. Especially with the effort that people like you but in. I like the abilities of your Hal in that scenario, but creating something to replace a servant, slave position kind of gives me the willies. If I am going to have or create a counciousness on a system then I will have to deal with it as a conciousness and all that comes with it, like negotiating and mutual interests.
I am running Hal from C:program files\zabaware but my playlist is on x:. I will move my playlist and see if that helps. Thank you for the suggestion. I will post the results.
Enjoy the day,
-
Thank you so much HalInprover,
You inproved my Hal. You were right! It had to do with the network. It is really great to be able to make the program more functional. I will have to take some time out to do some experimenting myself. I really appreciate your time in this Hal Effort.
Enjoy the day,
iam
-
This is great script! The random player works just fine. I am having a problem getting the playlist to work as well though. It tells me it cannot find the playlist Ponn. Not until I type in "play playlist ponn playlist" will it open Windows Media Player but then tell me "Windows Media Player cannot find the specified file" in an error message. The "Ponn" directory referenced is listed as "Ponn Playlist" in WMP. My "D" drive is where both HAL and WMP reside.
Any help here would be appreciated.
Thanks
P
If Priority = 0 And InStr(UserSentence, " PLAY ") > 0 And InStr(UserSentence, " PLAYLIST ") > 0 And InStr(UserSentence, " DON'T ") = 0 Then
Set oWMP = CreateObject("WMPlayer.OCX.7")
'Set the following variable To your playlist directory.
plDir = "D:Documents And SettingsPonnfarMy DocumentsMy MusicMy PlaylistsPonn"
plName = Trim(Mid(UserSentence, InStr(UserSentence, " PLAYLIST ") + 10))
If oWMP.playlistCollection.getByName(plName).Count > 0 Then
oWMP.openPlayer (plDir & plName & ".wpl")
GetResponse = "Here is your playlist (" & plName & ") enjoy!"
Else
GetResponse = "I could Not find the playlist (" & plName & ") In your Media Library."
GetResponseBlock = True 'Vonsmith edit -This prevents the following scripts from overwriting your script's GetResponse.
BlockSave = True 'Vonsmith edit- This prevents your Hal command from being saved to Hal's knowledge files. This is more selective than using the XTF_SYS_EphemeralDetect.brn method.
End If
End If
-
All,
Just a related commentary about the XTF Brain script...
The last two statements in Ponnfar's script make the script compatible with the XTF Brain. The script shown is presumably located before the XTF function inside of the XTF .uhp file.
Just as a note, obviously the "BlockSave" variable can only block saving within scripts that follow Ponnfar's script, assuming the following scripts are equipped to check the "BlockSave" variable before saving. The "GetResponseBlock" variable should be checked by all following scripts as well so that they don't overwrite the "GetResponse" variable. Obviously any scripts preceding Ponnfar's script shouldn't be equipped to set the "GetResponseBlock" to "True" unless Ponnfar's script is equipped to check and honor the "GetResponseBlock" request. I hope that is clear.
The default Hal brain uses the "BlockSave" variable already. If you use Hal's name in the user input the default brain sets "BlockSave" to "True" to prevent saving data to .brn files. The "GetResponseBlock" variable is unique to the XTF Brain. It is used to prevent overwriting the "GetResponse" variable so that higher priority responses that already exist are not overwritten. Obviously the order that these two variables occur in scripts within the Hal brain is important to proper functioning.
Just thought I should mention it. By the way, nice script. I'll have to try it out.
=vonsmith=
-
Greatings Ponnfar,
In your message:
quote:
This is great script! The random player works just fine. I am having a problem getting the playlist to work as well though. It tells me it cannot find the playlist Ponn. Not until I type in "play playlist ponn playlist" will it open Windows Media Player but then tell me "Windows Media Player cannot find the specified file" in an error message. The "Ponn" directory referenced is listed as "Ponn Playlist" in WMP. My "D" drive is where both HAL and WMP reside.
Any help here would be appreciated.
Thanks
P
If Priority = 0 And InStr(UserSentence, " PLAY ") > 0 And InStr(UserSentence, " PLAYLIST ") > 0 And InStr(UserSentence, " DON'T ") = 0 Then
Set oWMP = CreateObject("WMPlayer.OCX.7")
'Set the following variable To your playlist directory.
plDir = "D:Documents And SettingsPonnfarMy DocumentsMy MusicMy PlaylistsPonn"
plName = Trim(Mid(UserSentence, InStr(UserSentence, " PLAYLIST ") + 10))
If oWMP.playlistCollection.getByName(plName).Count > 0 Then
oWMP.openPlayer (plDir & plName & ".wpl")
GetResponse = "Here is your playlist (" & plName & ") enjoy!"
Else
GetResponse = "I could Not find the playlist (" & plName & ") In your Media Library."
GetResponseBlock = True 'Vonsmith edit -This prevents the following scripts from overwriting your script's GetResponse.
BlockSave = True 'Vonsmith edit- This prevents your Hal command from being saved to Hal's knowledge files. This is more selective than using the XTF_SYS_EphemeralDetect.brn method.
End If
End If
Your set the Playlist director to :
"D:Documents And SettingsPonnfarMy DocumentsMy MusicMy PlaylistsPonn",
but where are you slashes?Try this: "D:Documents and SettingsPonnfarMy DocumentsMy MusicMy PlaylistPonn\" That should do it. Just make sure that your folder in Documents and settings is the exact name of the folder as window can add stuff to it if you are on a network.
I hope this helps you, as others have helped me.
Enjoy the sound,
-
Thanks for your response!! I have had the path set the way you suggest. As you may have noticed, I do not think the forum allows backslashes in typing a path. I am glad you at least let me know I am on the right track.
I wonder what I might be forgetting or not doing right here? I bet iti is right in front of my face!
Thanks again for your help [8D]
P
-
Thank you,
I thought that that looked very strange.[:D] Thank you for clearing that up for me. I will let the bigger minds handle it from here. It I do think of anything or run across anything that might help I will not hesitate to post to you again.
Peace to you,
-
I just wanted to give a big thank you for your script. It works great with the XTF brain as long as you add that...
GetResponseBlock = True
BlockSave = True
As mentioned by vonsmith.
As least now my Pilot (What I call my HAL) Seems to have some usefullness. Now if I could only make him do more.
Thanks again.
[:o)]
-
ALL
Has anyone been able to get the playlist function to work? How about a specific song within the playlist? If so, how does your script read?
Any help would be greatly appreciated.
P
-
Ponn,
It is working really well for me. Just playing the playlist not a specific cut in the playlist.
-
Ponnfar, I think the playlist filename is different from the playlist name in MP. Check in MP's Media Library and click on My Playlists. It tells you the playlist name and the URL to the .wpl file. What Hal does is check for the playlist name and if it exists, he assumes the playlist filename is the same with a .wpl extension.
Make sure that the two names match (MP has a tendency to not correct minor discrepencies; especially when you rename your playlists) and I believe all will work. If not, I'll see what else I can do for you.
In the meantime, here's a little addin to allow Hal to play a specific song. Enjoy! [:)]
Download Attachment: (http://images/icon_paperclip.gif) MusicAddin3.txt (http://"http://www.zabaware.com/forum/uploaded/HALImprover/2004444956_MusicAddin3.txt")
1.12 KB
-
My problem is after it finds and goes to the playlist. Actually any playlist I type in that I have created and put in the WMP MyPlaylists directory. It will go there, except that then, I get the error message:
"Windows Media Player cannot find the specified file. Be sure the path is typed correctly. If it is, the file does not exist at the specified location, or the computer where the file is stored is offline."
I ran the path from the command line in Windows and got the same message. The ".wpl" files seem to only work when you activate them with a double click outside WMP and of course just activating them within WMP. That makes sense, but in this case, I imagine I am missing something really simple to get this to work from this new script.
Oh well, maybe someone can set me on the path to glory [:D]
I am looking forward to using this cool feature!
Oh, Hal Improver thanks for the heads up. This is a great script!
I just read your reply. I will give your suggestions a try. Thanks for the new script as well!!
P
-
Does Hal say "Here is your playlist (Some Playlist Name) enjoy!"? If so, what is Hal saying in place of (Some Playlist Name)?
-
HalImprover,
Yes, HAL does say "here is your playlist" (after I type in "play playlist XYZPlaylist" and then WMP starts but then the problem begins.
Only then with that syntax does it even get me that far. Is that the correct syntax I should be using?
P
-
Please try this:
Cut and paste the following phrase into Hal and hit enter:
Play playlist ponn playlist
Then cut and paste Hal's response into your next post. Hopefully this will point me to the problem.
-
HalImprover,
Your new plugin works great! Thanks. A lot of folks are going to enjoy this one! I only wish I could get the Playlist script to work as well [:D]
P