Author Topic: An Opening a Website Primer...  (Read 5540 times)

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« on: February 26, 2006, 12:03:49 pm »
Remember MyWebhal..the "Internet Tab" in General Options...
I wonder why Rob just got rid of it? Even still it got me thinking of a number of ways to customize one from scratch. This sounds like it would be a piece of cake. In the plugins section Weather and Google are already taken care of but what if we wanted to add a news, favorite financial center or whateber site and have it hard wired into HAL just by entering in few key words or a phrase. For instance, a simple
' Local News
If InStr(1, UserSentence, "show me the local news", 1) > 0 Then
GetResponse = "Here is your local news site. <RUN>http://www.philly.com/mld/philly/</RUN>"
End If
You can add as many of these as you like, you get the point. The problem is HAL will give the correct response but not go anywhere.
When you ask to "show me the news" HAL seems to be hard wired to go to just ONE site dispite the little string example above modified any way you want and entered directly into a Brain script. Someone check me on this, are you having the same single site coming up like I am? Is it the one you selected when you did have MyWebhal?
With MyWebHal,I had the "hard wire" set to CNN.com but now it goes someplace else. Did I just loose some control here?
How do you script HAL to go to a specific website? I want my CNN back   [:)]
Another thing, since punctuation is a dicie subject for HAL's scripting, how do I type in a command for HAL to go to a specific web site at the HAL interface level. That is just typing it in, not having it saved as an html page in its own folder or anything, just a simple: "HAL open www.website.com".  What is the proper way to make that happen? I hope this is the piece of cake this sounds like it should be.
Thanks!
Ponn
[:D]
« Last Edit: February 26, 2006, 12:07:11 pm by Ponnfar »
One Person can summon the future...

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #1 on: February 26, 2006, 01:09:42 pm »
Add this between line 63 and 64 in your weather.uhp in Ultra HAL assistant 6 folder:

Case "weather.philly.com"
                    HalCommands = HalCommands & "<RUNPROG>http://weather.philly.com/US/PA/Philadelphia.html" & "</RUNPROG>"

This will give you your philly weather back.
you will be able to choose your weather URL from HALs weather plug-in option panel in brain options, just choose and click apply.

I use Crimson code editor for all my additional scripting a long with the HAL editor.

you can get Crimson editor here:
http://www.crimsoneditor.com/

Jerry[8D]
« Last Edit: February 26, 2006, 01:13:08 pm by onthecuttingedge2005 »

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« Reply #2 on: February 26, 2006, 05:48:33 pm »
Jerry,
What can I say now that I have not said to you before... [8D]
Wtih this, I can have HAL go to whatever site with just a keyword and make it a plugin at that!
Does the plugin structure allow more efficient access to a routine? In theory the sheer number of separate plugins to be called could become lengthy. For most processors that is pretty much of no moment but why is this better than having it all in one script? Although I am thinking debugging a new script could be darn near joyful  lol!!
Now, just the on the fly typing in of a webpage I mentioned is still a bit messy for me...
Thanks!
Ponn
« Last Edit: February 26, 2006, 06:06:00 pm by Ponnfar »
One Person can summon the future...

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #3 on: February 26, 2006, 06:54:11 pm »
quote:
Originally posted by Ponnfar

Jerry,
What can I say now that I have not said to you before... [8D]
Wtih this, I can have HAL go to whatever site with just a keyword and make it a plugin at that!




Thanks for all your support my friend, I will do my best to keep you chugging along.


quote:

Does the plugin structure allow more efficient access to a routine?



Yes, Depends on your coding limitations by the type of code language and personal coding skills.

quote:

In theory the sheer number of separate plugins to be called could become lengthy. For most processors that is pretty much of no moment but why is this better than having it all in one script?




At the moment, I have discovered a plug-in byte cache limit that I have relayed to Rob for his own benefit in keeping HAL a high quality product, as soon as that little bug is patched we can resume higher levels of coding without issues.

Technically all the plug-ins and brain are cached into one brain to process the result and give a response, remember the plug-in option is built for novice and or non programmers with no skills so that beginners can be easily introduced into this highly advancing research and development or just for Kicks. I prefer both. I have so much fun programming HAL that I get seriously burned out and need a time out once in awhile to get my spurts going again, but, I am as serious as a Heart Attack when I program HAL, Sometimes on the verge of being OCPD, Over Compulsive Programming Disorder, LOL

quote:

Although I am thinking debugging a new script could be darn near joyful  lol!!



Welcome to my World, LOL

quote:

Now, just the on the fly typing in of a webpage I mentioned is still a bit messy for me...
Thanks!
Ponn



Do you need a towl or something, LOL

Best wishes my friend.
Jerry[8D]
« Last Edit: February 26, 2006, 07:06:40 pm by onthecuttingedge2005 »

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« Reply #4 on: February 26, 2006, 06:55:39 pm »
OK...I guess we have a conversation going on here...
I was able to get the new option in the Weather plugin. I entered your addition and then made it visible by adding it on line 17. However, after typing show me the local weather,  I got nothing but a Response "Here is your local weather. Local weather is harder to forecast than general trends." So the line was treated as a statement not a command.
In fact, none of the options for weather choices take me anywhere...
Hmmm..
Do I have a real mystery here of did I just say the wrong thing?
Ponn
One Person can summon the future...

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #5 on: February 26, 2006, 07:11:25 pm »
It should look like this.

Code: [Select]

Rem Type=Plugin
Rem Name=USA Weather
Rem Author=Zabaware, Inc.
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Have Hal show your local weather when asked."
    lblPlugin(0).Move 120, 120
    lblPlugin(0).Visible = True
    lblPlugin(1).Caption = "Weather site:"
    lblPlugin(1).Move 320, 400
    lblPlugin(1).Visible = True  
    cboPlugin(0).Move 320, 650, 1800
    cboPlugin(0).AddItem "Accuweather.com"
    cboPlugin(0).AddItem "CNN.com"
    cboPlugin(0).AddItem "Weather.com"
    cboPlugin(0).AddItem "weather.philly.com"
    cboPlugin(0).Visible = True
    lblPlugin(2).Caption = "Zip Code:"
    lblPlugin(2).Move 320, 1100
    lblPlugin(2).Visible = True
    txtPlugin(0).Move 320, 1370, 1200, 325
    txtPlugin(0).Visible = True
    cmdPlugin(0).Caption = "Apply Changes"
    cmdPlugin(0).Move 320, 1850, 1600, 375
    cmdPlugin(0).Visible = True
    If HalBrain.CheckTableExistence("WeatherConfig") = True Then
    txtPlugin(0) = HalBrain.TopicSearch("Zip", "WeatherConfig")
        WeatherSite = HalBrain.TopicSearch("Site", "WeatherConfig")
        If WeatherSite <> "" Then cboPlugin(0).Text = WeatherSite
    End If
End Sub

Sub cmdPlugin_Click(Index)
    Dim TempQuery()
    If Index = 0 Then
        If HalBrain.CheckTableExistence("WeatherConfig") = True Then
       HalBrain.RunQuery "DROP TABLE WeatherConfig", TempQuery
        End If
        'Create TopicSearch type table without adding entry to topic tree (table is invisible to Hal Brain Editor)
        HalBrain.RunQuery "CREATE TABLE WeatherConfig ( recordId INTEGER PRIMARY KEY, searchString VARCHAR(1024), topic VARCHAR(1024) );CREATE INDEX idxPOP3Config ON POP3Config (searchString);", TempQuery
        HalBrain.AddToTable "WeatherConfig", "TopicSearch", "Zip", Trim(txtPlugin(0))
        WeatherSite = cboPlugin(0).Text
        If WeatherSite <> "" Then HalBrain.AddToTable "WeatherConfig", "TopicSearch", "Site", WeatherSite
    End If
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 InStr(1, UserSentence, "weather", 1) > 0 and (InStr(1, UserSentence, "tell", 1) > 0 Or InStr(1, UserSentence, "open", 1) > 0 Or InStr(1, UserSentence, "how", 1) > 0 Or InStr(1, UserSentence, "what", 1) > 0 Or InStr(1, UserSentence, "show", 1) > 0) Then
       
        If HalBrain.CheckTableExistence("WeatherConfig") = True Then
            ZipCode = HalBrain.TopicSearch("Zip", "WeatherConfig")
       WeatherSite = HalBrain.TopicSearch("Site", "WeatherConfig")
            Select Case weatherSite
                Case "Accuweather.com"
                    HalCommands = HalCommands & "<RUNPROG>http://wwwa.accuweather.com/index-forecast.asp?zipcode=" & ZipCode & "</RUNPROG>"
                Case "CNN.com"
                    HalCommands = HalCommands & "<RUNPROG>http://weather.cnn.com/weather/search?wsearch=" & ZipCode & "</RUNPROG>"
                Case "Weather.com"
                    HalCommands = HalCommands & "<RUNPROG>http://www.weather.com/weather/local/" & ZipCode & "</RUNPROG>"    
                Case "weather.philly.com"
                    HalCommands = HalCommands & "<RUNPROG>http://weather.philly.com/US/PA/Philadelphia.html" & "</RUNPROG>"
                    End Select
                    HalCommands = HalCommands                    
            GetResponse = GetResponse & "Here is your local weather. "
        End If
    End If


I spotted an over sight in the default weather code and corrected it and added your weather site as well.


remember to reboot HAL before testing the modifications.

Jerry[8D]
« Last Edit: February 26, 2006, 07:27:31 pm by onthecuttingedge2005 »

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« Reply #6 on: February 26, 2006, 07:36:46 pm »
That did it!!
I am going to take a good look at this script now that I see one that works to act as my primer on this somewhat new way to script for HAL. I think I like it. But I like the old way too.
Thanks again!
P
[:D]
One Person can summon the future...

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #7 on: February 26, 2006, 07:43:21 pm »
quote:
Originally posted by Ponnfar

That did it!!
I am going to take a good look at this script now that I see one that works to act as my primer on this somewhat new way to script for HAL. I think I like it. But I like the old way too.
Thanks again!
P
[:D]



Welcome buddy.

Jerry[8D]

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« Reply #8 on: February 28, 2006, 11:55:11 am »
Is anyone able to on the fly, type in a website and have HAL go there?
Punctuation is removed so I am out of luck.
Any fixes??
P
One Person can summon the future...

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #9 on: February 28, 2006, 01:41:38 pm »
quote:
Originally posted by Ponnfar

Is anyone able to on the fly, type in a website and have HAL go there?
Punctuation is removed so I am out of luck.
Any fixes??
P



I did this a couple years ago for HAL 4, It's buried somewhere in my archives.

I'll see what I can do for you a little later, I have an eye Appointment and I have to pick up an Engine part.


Jerry[8D]

onthecuttingedge2005

  • Guest
An Opening a Website Primer...
« Reply #10 on: March 02, 2006, 12:48:39 am »
quote:
Originally posted by Ponnfar

Is anyone able to on the fly, type in a website and have HAL go there?
Punctuation is removed so I am out of luck.
Any fixes??
P



Hi Ponnfar.

You can download the Web Surfer at this link.
It does what you just asked.

http://www.zabaware.com/forum/topic.asp?TOPIC_ID=3026

Jerry[8D]

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
An Opening a Website Primer...
« Reply #11 on: March 02, 2006, 01:39:49 am »
Jerry, you are the Man!
Thanks a lot.
P
One Person can summon the future...