Hi guys, I'm stumped!! I'm trying to create a hal plugin that will go out to wikipedia and grab a portion of the content and display it. I created a vbscript program that does this and works fine on its own, however when I try to put it in a uhp file and add it as a plugin it doesn't work, so many different errors no matter what I do. Below is the code, please let me know there is a way to get it working.
Rem Type=Plugin
Rem Name=KITT Wiki
Rem Author= Victor
Rem Host=Assistant
'------------------------------------------------------------------------------------------------------
' KITTWiki.uhp - Release 1.0 by Victor Yacobucci. 02-25-2016
'------------------------------------------------------------------------------------------------------
Rem PLUGIN: PLUGINAREA1
vrToSearch = ""
vrToSearch = UCase(HalBrain.SearchPattern(UserSentence, "*search for*", 2))
GetResponse = "searching for "& vrToSearch &" "
' Declaration of variables
Dim ie
' Declaration of subroutines
' Sub WaitForLoad waits for webpage to finish loading
' before proceeding with next line of code
Sub WaitForLoad
Do while ie.Busy or ie.readystate <> 4
wscript.sleep 2000
Loop
End Sub
' Open windows Internet explorer and surf to website
set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate "
https://en.wikipedia.org/wiki/Michael_Jordan"
.Toolbar=0
.StatusBar=0
.Height=560
.Width=1000
.Top=0
.Left=0
.Resizable=0
WaitForLoad
.Visible = false
end with
' Add code below to display in a msgbox the contents of each cell in column 0 (first column) should loop for each row.
dim element
dim counter
dim item
Set element = ie.document.getElementById("mw-content-text").getElementsByTagName("p")
counter = 1
For Each x In element
If(counter < 3) Then
content = Replace(x.innerText,"[","")
content = Replace(x.innerText,"]","")
content = Replace(x.innerText,"(","")
content = Replace(x.innerText,")","")
MsgBox content
End If
counter = counter + 1
Next