Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: cyberwd on March 16, 2004, 08:45:03 am
-
I ran into a problem last night, trying to send a url as a HalCommand.
When the url contained &-characters(as in providing url-parameters), Hal refused to open the adress. I tried some url-encoding but it did not help, maybe it has to do with vb using & as string concat.
-Does anyone know a solution to the problem?
-
cyberwd,
I don't understand the question. What were you asking Hal to do? Which version of Hal are you using? Can you give an example of the command you were giving Hal?
Thanks, I hope someone here can help out.
=vonsmith=
-
quote:
Originally posted by vonsmith
cyberwd,
I don't understand the question. What were you asking Hal to do? Which version of Hal are you using? Can you give an example of the command you were giving Hal?
Thanks, I hope someone here can help out.
=vonsmith=
I am using the variable "halcommands" as described in:
http://www.zabaware.com/forum/topic.asp?TOPIC_ID=996
To submit a url, I am using the syntax:
halcommands = "<runprog>http://www.altavista.com/web/results?q=badger&kgs=0&kls=1&avkw=aapt</runprog>"
It works fine for "http://www.altavista.com", but it stops executing whenever the &-character is included in the url.
I'm using version 5.0 of hal, and I try to get Hal to browse to different locations by scanning for key phrases in my commands and queries.
An example: retrieving the local traffic situation from a public site by accessing the site with a location parameter set to my part of the city. I could trigger Hal by just asking "Can I get to work by car today?" and he will display me the situation in a browser (and in the future maybe also interpret the data, and simply tell me if I should go by train instead)
-
cyberwd,
Thanks for the clarification.
Are the statements like:
halcommands = "<runprog>http://www.altavista.com/web/results?q=badger&kgs=0&kls=1&avkw=aapt</runprog>"
embedded directly in the GetResponse script or entered via some other method? The reason I ask is I'm wondering if Hal performs any processing on the URL or whether it is submitted directly into "halcommands" and returned to Hal's main program. If the unadulterated URL is passed back to Hal's main program and still doesn't work then the problem may be in the main program and probably not easily fixed. Logically the <runprog> command should be compatible with URL's although I haven't used it in that capacity.
When you want to display & as a text character in VB you have to double enter it, i.e. q=badger&&kgs=0&&kls= versus q=badger&kgs=0&kls=
I don't know if the && issue is the problem. Give it a try.
=vonsmith=
-
Try using Char(38) in place of the & symbol.
eg. "This " & Char(38) & " that" is the same as "This & that"
It's all the same to VB, but that depends on what the main Hal program does with it. Like vonsmith said, the main program is not easily fixed if at all possible.
Good luck with the traffic assesment function!