Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Topaz on August 04, 2005, 12:02 PM

Title: [VB6] Google search
Post by: Topaz on August 04, 2005, 12:02 PM
I'm implementing a command in a chatbot which will open the user's browser and send the search query to Google.

I'm not sure why, but this isn't working:

If txtSend.text = Mid("/google", 9) Then
googlesearch = Mid(txtSend.text, 9)
ShellExecuteA Me.hWnd, "Open", "http://www.google.com/search?q=" & googlesearch & "&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official", 0&, 0&, 0&
Exit Sub
End If

I believe its to do with the fact that it's only being read after KeyPress, and at that point txtSend.Text is cleared.
Title: Re: [VB6] Google search
Post by: Stealth on August 04, 2005, 12:10 PM
Quote from: Topaz on August 04, 2005, 12:02 PM
If txtSend.text = Mid("/google", 9) Then

At first glance, this line is at fault. Your code is somewhat backwards. :)
Title: Re: [VB6] Google search
Post by: Topaz on August 04, 2005, 12:11 PM
Yeah, I just noticed my error:

If Left(txtSend.Text, 9) = "/google " Then
Title: Re: [VB6] Google search
Post by: l)ragon on August 04, 2005, 02:03 PM
Quote from: Topaz on August 04, 2005, 12:11 PM
Yeah, I just noticed my error:

If Left(txtSend.Text, 9) = "/google " Then

Shoulden't that be left(text, 8 )

edit: damned smilys
Title: Re: [VB6] Google search
Post by: hismajesty on August 04, 2005, 02:09 PM
pandachatcopycat!
Title: Re: [VB6] Google search
Post by: Warrior on August 04, 2005, 05:17 PM
Yea both bad ideas!
Title: Re: [VB6] Google search
Post by: Topaz on August 04, 2005, 05:27 PM
Quote from: hismajesty[yL] on August 04, 2005, 02:09 PM
pandachatcopycat!

Flamebotcopycat!*
Title: Re: [VB6] Google search
Post by: hismajesty on August 05, 2005, 11:29 PM
So, I don't know what that is. I do know, though, that /google was a command I put in PC. :)