Rem Type=Plugin
Rem Name= Image of the day
Rem Author= cyberjedi
Rem Host=All
Rem PLUGIN: PRE-PROCESS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.
HalBrain.ReadOnlyMode = True
'Determines that you are talking about image of the day.
If InStr(1,InputString, "image",1) > 0 Then
UltraHal = image(HalCommands)
ElseIf InStr(1,InputString, "image",1) > 0 Then
End If
' Image of the day hooks wikipedia for what they post daily as Image of the day and definition.
'Trigger = image, change to fit
Rem PLUGIN: FUNCTIONS
Function image (HalCommands)
Dim oDoc1 , con1
Dim objExplorer
Set Sapi = CreateObject("SAPI.SpVoice")
For Each Voice In Sapi.GetVoices
i = i + 1
Next
For loopvar = 0 to i-1
if loopvar = CInt(confirm_voice) then
Set Sapi.Voice = Sapi.GetVoices.Item(loopvar)
end if
Next
Set oDoc1 = CreateObject("HTMLFile")
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
HalMenu.HalCommand "<SPEAK>"& "Please wait ." & "</SPEAK>"
Set objExplorer = CreateObject("InternetExplorer.Application")
Set con1 = CreateObject("MSXML2.ServerXMLHTTP.3.0")
URL = "
https://en.wikipedia.org/wiki/Main_Page"
con1.Open "GET", URL , False
con1.Send
oDoc1.Write con1.responseText
URL2 = oDoc1.GetElementsByTagName("img")(4).src
URL3 = Mid(URL2,7)
objExplorer.Navigate URL3
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 500
objExplorer.Height = 320
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
if oDoc1.GetElementsByTagName("img")(4) is nothing then
HalMenu.HalCommand "<SPEAK>" & "Sorry , featured image of the day is not available" & "</SPEAK>"
objExplorer.Quit
wscript.Quit
else
HalMenu.HalCommand "<SPEAK>" & "This is the featured image of the day" & "</SPEAK>"
HalMenu.HalCommand "<SPEAK>" & oDoc1.GetElementsByTagName("img")(4).alt & "</SPEAK>"
if oDoc1.GetElementsByTagName("p")(2) is nothing then
HalMenu.HalCommand "<SPEAK>" & "No information is available for this image ." & "</SPEAK>"
objExplorer.Quit
wscript.Quit
else
HalMenu.HalCommand "<SPEAK>" & oDoc1.GetElementsByTagName("p")(2).InnerText & "</SPEAK>"
'objExplorer.Quit
end if
end if
End Function