I've also done a little work on a Wiki plugin, it gets me to wiki and that's about it. VR, (Rossi) of Virtual Humans website also has a vrWeb plugin which can get you to Wiki, actually I haven't tried it yet. I'm familiar wit the error codes that get generated and usually find the errors sooner or latter. I'm not familiar with your coding and there are statements new to me.
This is what I came up with:
Rem Type=Plugin
Rem Name=Wiki
Rem Author=Zabaware ModifiedCJ
Rem Host=Assistant
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Hal will open your browser and enter a Wiki query if you use the keyword "Wiki"
lblPlugin(0).Move 120, 120, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PLUGINAREA1
'The comment above tells Ultra Hal Assistant to insert the following code
'on-the-fly into the main brain code in the section referenced.
SearchEngine = "
https://en.wikipedia.org/wiki/English_language"
If InStr(1, UserSentence, "Wiki", 1) > 0 Then
SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+"))
SearchKeyWords = Replace(SearchKeywords, "find+", "")
SearchKeyWords = Replace(SearchKeywords, "research+", "")
SearchKeyWords = Replace(SearchKeywords, "locate+", "")
SearchKeyWords = Replace(SearchKeywords, "search+", "")
HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
GetResponse = GetResponse & "I will help you research this topic on the Internet. "
End If
This is the vrWeb plugin:
Rem Type=Plugin
Rem Name=Customized Web Searches
Rem Author=VR
Rem Host=Assistant
'------------------------------------------------------------------------------------------------------
' VR_Web.uhp - Release 1.0 by VR Consulting sas.
' This script shall not be sold or used for any purpose unless specifically authorized by the author
' in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
' If you want to use this software in business applications, you must contact us at info@vrconsulting.it
' This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
' VR CONSULTING DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS SOFTWARE, EXPRESS, IMPLIED, OR OTHERWISE,
' INCLUDING WITHOUT LIMITATION, ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
' OR NONINFRINGEMENT.
' VR CONSULTING SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
' DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST REVENUES, LOST PROFITS, OR LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE,
' RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.
' This software is made available free by the author. Although he is interested in your feedback,
' he is under no obligation to address bugs, enhancements, or answer questions.
'------------------------------------------------------------------------------------------------------
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "This replaces the standard Google plugin. It manages Google queries, Viki searches and other customizable topics such as local news, weather or mail. Click below for more info"
lblPlugin(0).Move 120, 120, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
cmdPlugin(0).Move 800, 1300, 2100, 375
cmdPlugin(0).Caption = "Help on this plugin"
cmdPlugin(0).Visible = True
End Sub
Sub cmdPlugin_Click(Index)
Select Case Index
Case 0
HalMenu.HalCommand "<RUNPROG>vrwebhelp.html</RUNPROG>"
End Select
End Sub
Rem PLUGIN: PLUGINAREA1
'The comment above tells Ultra Hal Assistant to insert the following code
'on-the-fly into the main brain code in the section referenced.
' If the table vrWeb does not exist, I create it and fill it with some default values
' each user will need to add other links and/or change these
If HalBrain.CheckTableExistence("vrWeb") = False Then
' I store temporarily the Read Only status
vrReadOnlyMode = HalBrain.ReadOnlyMode
HalBrain.ReadOnlyMode = False
HalBrain.CreateTable "vrWeb", "PatternMatch", "miscData"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*Hal Help*", "welcome.html"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*local weather*", "
http://uk.weather.com/weather/local/ITXX0067"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*local news*", "
http://www.nytimes.com/"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*yahoo mail*", "
http://my.yahoo.com/"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*zabaware forum*", "
http://www.zabaware.com/forum/"
HalBrain.AddToTable "vrWeb", "PatternMatch", "*virtual humans forum*", "
http://www.vrconsulting.it/vhf/"
' Set ReadOnly Mode to its previous state
HalBrain.ReadOnlyMode = vrReadOnlyMode
End If
'Run the corresponding Web page, if the user question contains one of the searched words
vrAddress = ""
vrAddress = HalBrain.PatternDB(OriginalSentence, "vrWeb")
If vrAddress <> "" Then
HalCommands = HalCommands & "<RUNPROG>" & vrAddress & "</RUNPROG>"
Select Case (Int(Rnd * 4) + 1)
Case 1
GetResponse = "Here is the page you asked me for." & vbCrLf
Case 2
GetResponse = "Now you can access it." & vbCrLf
Case 3
GetResponse = "I am really happy to give you this information." & vbCrLf
Case 4
GetResponse = "OK. Here it is." & vbCrLf
Case 5
GetResponse = "Now look at this." & vbCrLf
End Select
HalBrain.ReadOnlyMode = True
End If
'------------------
' Google search
'------------------
SearchEngine = "
http://www.google.com/search?q="
If InStr(1, UserSentence, "google ", 1) > 0 Then
SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+"))
SearchKeyWords = Replace(SearchKeywords, "google+", "")
HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
GetResponse = "I will help you research this topic on Google. "
HalBrain.ReadOnlyMode = True
End If
' This is too invasive: any input containing common words as "find" activates this search
'SearchEngine = "
http://www.google.com/search?q="
'If InStr(1, UserSentence, "search ", 1) > 0 Or InStr(1, UserSentence, "find ", 1) > 0 Or InStr(1, UserSentence, "locate ", 1) > 0 Then
' SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+"))
' SearchKeyWords = Replace(SearchKeywords, "find+", "")
' SearchKeyWords = Replace(SearchKeywords, "research+", "")
' SearchKeyWords = Replace(SearchKeywords, "locate+", "")
' SearchKeyWords = Replace(SearchKeywords, "search+", "")
' HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
' GetResponse = "I will help you research this topic on the Internet. "
' HalBrain.ReadOnlyMode = True
'End If
'------------------
' Wiki Search
'------------------
If InStr(1, UserSentence, "wiki ", 1) > 0 Then
SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+"))
SearchKeyWords = Replace(SearchKeywords, "wiki+", "")
HalCommands = HalCommands & "<RUNPROG>
http://en.wikipedia.org/wiki/" & Keywords & "</RUNPROG>"
GetResponse = "Here is what Wiki says about " & SearchKeywords
HalBrain.ReadOnlyMode = True
End If
What vr has done is ask his program to insert some tables in the brain, in the past I've found these tables do not get put into hals brain and you would have to do this yourself. The process is simple using the brain editor.
I hope this info has been helpful, let us know how you make out.
Carl2