dupa

Author Topic: Image of the day  (Read 1457 times)

cyberjedi

  • Hero Member
  • *****
  • Posts: 776
  • The Mighty Hal Machine
    • View Profile
Image of the day
« on: April 16, 2022, 10:18:38 am »
By popular demand i redid  Image of the day.
Direct action plugin
Nasa IOTD
The power of this iddy biddy bit of code cant be quantified....Enjoy
Trigger is Open IOTD




Rem Type=Plugin
Rem Name=Image of the day
Rem Author=Zabaware, Inc.
Rem Host=Assistant

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  '<<<<<<<<What do u think is gonna happen if you set that flag to false
'Determines that you are talking about the Image of the day
If InStr(1,InputString, "IOTD",1) > 0 Then
 UltraHal = GetIOTD(HalCommands)
ElseIf InStr(1,InputString, "IOTD",1) > 0 Then
 End If
 
 

Rem PLUGIN: FUNCTIONS
Function GetIOTD(HalCommands)

Dim oDoc1 , con1
Dim objExplorer

Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Sapi = CreateObject("SAPI.SpVoice")
   For Each Voice In Sapi.GetVoices
       i = i + 1
   Next
For loopvar = 0 to i-1
Set Sapi.Voice = Sapi.GetVoices.Item(loopvar)
Next
Set oDoc1 = CreateObject("HTMLFile")
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
 
Set objExplorer = CreateObject("InternetExplorer.Application")
Set con1 = CreateObject("MSXML2.ServerXMLHTTP.3.0")
URL = "https://earthobservatory.nasa.gov/topic/image-of-the-day"
con1.Open "GET", URL , False
con1.Send
oDoc1.Write con1.responseText

objExplorer.Navigate URL
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 940
objExplorer.Height = 970
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1

HalMenu.HalCommand "<SPEAK>" & "From the mind of cyber jedi" & "</SPEAK>"

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

else

end if

End Function
« Last Edit: April 16, 2022, 11:25:20 am by cyberjedi »

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Image of the day
« Reply #1 on: April 16, 2022, 04:51:01 pm »
Nicely done Cyber!

Good stuff!
In the world of AI it's the thought that counts!

- Art -

lightspeed

  • Hero Member
  • *****
  • Posts: 6687
    • View Profile
Re: Image of the day
« Reply #2 on: April 17, 2022, 10:18:14 pm »
will try it out , thanks
 

Honvai

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Image of the day
« Reply #3 on: August 16, 2022, 06:05:30 pm »
Can i have Image of the mood extension?

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Image of the day
« Reply #4 on: August 17, 2022, 03:33:22 pm »
What do you mean, Image of the Mood extension?

That plugin was for The Image of the Day but not some mood extension that I'm aware.

Just copy & paste the text and save it as IOTD.uhp and include it in the Ultra Hal 7 folder.
Then activate it in the Brain Options menu by selecting in from those in the scroll list.

In the world of AI it's the thought that counts!

- Art -

cyberjedi

  • Hero Member
  • *****
  • Posts: 776
  • The Mighty Hal Machine
    • View Profile
Re: Image of the day
« Reply #5 on: August 20, 2022, 07:11:59 pm »
Hey guys:
Just catching up here.
IOTD could very easily be converted to MOOD Of The day

By accessing Hal main script and building a trigger Rite here and call to the plugin. IOTD.
Pull it up from ur own drive (folder) and yes you can load out *.gif images as swell. So it could quite crafty'
Search around for  the mp3 player as well. You would use some of that code too

Have fun and make it ur own.



'PROCESS: EMOTIONAL REACTIONS
    'We enable Hal's expressions to respond to common verbal cues.
    'The verbal cues are identified in the editable table "emotion"
    If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
    If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
    If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
    If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
    If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
        EmotionalReaction = Ucase(HalBrain.TopicSearch(UserSentence, "emotion"))
    End If
    Select Case EmotionalReaction
        Case "SURPRISED"
            If Compliment > 0 Then Compliment = 4
            If Compliment = 0 Then Compliment = 2
            If Compliment < 0 Then Compliment = 0
        Case "HAPPY"
            If Compliment = 0 Then Compliment = 2 <<<here
            If Compliment < 0 Then Compliment = 0
        Case "SOBER"
            If Compliment < 4 Then Compliment = 0
            If Compliment = 4 Then Compliment = 2
        Case "ANGRY"
            If Compliment = 0 Then Compliment = -1 <<<<<<here
            If Compliment > 0 Then Compliment = 0
        Case "SAD"
            If Compliment = 0 Then Compliment = -2
            If Compliment > 0 Then Compliment = 0
    End Select


ect ect


Just a thought.
Cyber jedi



P.S: To the people in the loop. Very sorry for the extended vacation from ZabaWare.
This Job has turned into a beast. Never saw it coming.
Looks like another month then im free again
Gonna take the rest of the year off to work on hals code.
To put a point on it, ive had 200K dollars in change orders alone out of 500k proposed  none of which goes to me lolol, just a lot more work
Just to much money to say NO too'

https://www.youtube.com/shorts/UxtCjVuiRdY
https://www.youtube.com/shorts/i4EXH6I2ejQ
 https://www.youtube.com/shorts/EL9275rtkt4
https://www.youtube.com/watch?v=JZE2ZTqYHI8
https://www.youtube.com/watch?v=zgULpGYYh4Q
https://www.youtube.com/watch?v=HHp8ICIRoGo
https://www.youtube.com/watch?v=Q_IocgiD7wU
« Last Edit: August 20, 2022, 07:55:20 pm by cyberjedi »

lightspeed

  • Hero Member
  • *****
  • Posts: 6687
    • View Profile
Re: Image of the day
« Reply #6 on: August 23, 2022, 07:42:37 pm »
thanks cyberjedi , will check it out .  glad to see you back .  :)