This will remember a single piece of data by writing a table with the name of the type of data (for instance, "Zipcode" or "Zabaware Password") prefixed with the username ("_Bob_Zipcode"). There is a more natural request ability now, but there are still some requirements. In order to keep it from conflicting with Hal's native functions, I had to place restrictions on what you can say. I welcome ideas about how to get around this.
1) You must say the name of the type of data first, and the actual data second
2) You must say "is" between the data name and the actual data, "my code is 54637"
3) You must not say anything after the data.
Read the script to get a general idea of what else you can say, and feel free to add to the script any lines you may personally prefer.
Rem Type=Plugin
Rem Name= LoadData
Rem Author= Bill DeWitt, OnTheCuttingEdge2005
Rem Host=All
Sub OptionsPanel()
lblPlugin(0).Caption = "Creates and loads a single purpose data table. Use 'Please remember that my _____ is _____', and then try 'Recall and display my _____'. It should store then retrieve your information"
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PLUGINAREA7
'verify that you want the memory function
If InStr(1,OriginalSentence, "remember",1) Or _
InStr(1,OriginalSentence, "don't forget",1) Or _
InStr(1,OriginalSentence, "keep in mind",1) Or _
InStr(1,OriginalSentence, "your memory",1) Then
'verify that you are making a request
If InStr(1,OriginalSentence, "please",1) Or _
InStr(1,OriginalSentence, "I would like you to",1) Or _
InStr(1,OriginalSentence, "I'd like you to",1) Or _
InStr(1,OriginalSentence, "If you don't mind",1) Or _
InStr(1,OriginalSentence, "would you",1) Or _
InStr(1,OriginalSentence, "could you",1) Or _
InStr(1,OriginalSentence, "will you",1) Or _
InStr(1,OriginalSentence, "can you",1) Then
'ensure that the search pattern word is included
If InStr(1,OriginalSentence, "my",1) Or _
InStr(1,OriginalSentence, "our",1) Or _
InStr(1,OriginalSentence, "your",1) Or _
InStr(1,OriginalSentence, "the",1) Then
GetResponse = LoadData(OriginalSentence)
End If
End If
End If
'verify that you want the memory function
If InStr(1,OriginalSentence, "recall",1) Or _
InStr(1,OriginalSentence, "call up",1) Or _
InStr(1,OriginalSentence, "display",1) Then
'verify that you are making a request
If InStr(1,OriginalSentence, "please",1) Or _
InStr(1,OriginalSentence, "I would like you to",1) Or _
InStr(1,OriginalSentence, "I'd like you to",1) Or _
InStr(1,OriginalSentence, "If you don't mind",1) Or _
InStr(1,OriginalSentence, "would you",1) Or _
InStr(1,OriginalSentence, "could you",1) Or _
InStr(1,OriginalSentence, "will you",1) Or _
InStr(1,OriginalSentence, "can you",1) Then
'ensure that the search pattern word is included
If InStr(1,OriginalSentence, "my",1) Or _
InStr(1,OriginalSentence, "our",1) Or _
InStr(1,OriginalSentence, "your",1) Or _
InStr(1,OriginalSentence, "the",1) Then
GetResponse = FindData(OriginalSentence)
End If
End If
End If
Rem PLUGIN: FUNCTIONS
Function LoadData(Sentence)
HalBrain.ReadOnlyMode = False
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* my * IS *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* our * IS *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* your * IS *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* the * IS *", 2)
DataName = Trim(DataName)
DataName = Replace(DataName," ","_",1,3)
If HalBrain.CheckTableExistence("_"&UserName&"_"&DataName) = False Then HalBrain.CreateTable "_"&UserName&"_"&DataName, "TopicSearch", ""
GetData = HalBrain.SearchPattern(Sentence,"* * IS *", 3)
If GetData <> "" Then
HalBrain.AddToTable "_"&UserName&"_"&DataName, "TopicSearch", UserName, GetData
LoadData = UserName&", I have stored your "&DataName&" for future use"
End If
HalBrain.ReadOnlyMode = True
End Function
Function FindData(Sentence)
HalBrain.ReadOnlyMode = False
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* my *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* our *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* your *", 2)
If DataName = "" Then DataName = HalBrain.SearchPattern(Sentence, "* the *", 2)
DataName = Trim(DataName)
DataName = Replace(DataName," ","_",1,3)
If HalBrain.CheckTableExistence("_"&UserName&"_"&DataName) = False Then
FindData = "Please tell me what your "&DataName&" is, "&UserName
Else
s=HalBrain.TopicSearch(UserName, "_"&UserName&"_"&DataName)
FindData = "Your "&DataName&" is "&s&UserName
End If
HalBrain.ReadOnlyMode = True
End Function
Comments (0)
You don't have permission to comment on this page.