Jump to content
Sign in to follow this  
Toady

Google Suggest

Recommended Posts

Toady

Here is an example of using Google suggest. As you type in a keyword, a list of suggestions are populated below. Scripts use XMLHTTPRequest to accomplish the task. Probably error prone, but like I said its just an example. Two examples shown below, one is regular Google suggest and other is YouTube suggest.

Ex 1) Google Suggest

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>

_Singleton('GoogleSuggest.au3')
Opt('GUICloseOnESC', 1)
GuiCreate('Google Suggest', 200, 190)
$input = GUICtrlCreateInput("",10,10,180)
$listbox = GUICtrlCreateList("",10,30,180)
GuiSetState()

Dim $objXMLHTTP = ObjCreate("Microsoft.XMLHTTP")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $IDFrom, $iCode
    $IDFrom = BitAND($wParam, 0xFFFF)
    $iCode = BitShift($wParam, 16)
    If $IDFrom <> $input Then Return
    If GUICtrlRead($input) = "" Then
        GUICtrlSetData($listbox,"")
        Return
    EndIf
    GUICtrlSetData($listbox,"")
    $objXMLHTTP.open("GET","http://suggestqueries.google.com/complete/search?output=firefox&client=&qu=" & GUICtrlRead($input),true)
    $objXMLHTTP.send("")
    Dim $strReturn = StringRegExpReplace($objXMLHTTP.responseText,"(.*\[)|(\].*)|""","")
    If $strReturn = "" Then Return
    GUICtrlSetData($listbox,StringRegExpReplace($strReturn,",","|"),GUICtrlRead($input))
EndFuncoÝ÷ Ù±1Ù.NæÞJè zËm«­¢+Ø¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU%
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±Ðí5¥Í¹ÔÌÐì()}M¥¹±Ñ½¸ Ìäíe½ÕQÕÕÍйÔÌÌäì¤)=ÁÐ ÌäíU%
±½Í=¹MÌäì°Ä¤)Õ¥
ÉÑ Ìäíe½ÕQÕMÕÍÐÌäì°ÈÀÀ°ÄäÀ¤(ÀÌØí¥¹ÁÕÐôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÄÀ°ÄàÀ¤(ÀÌØí±¥ÍѽàôU%
Ñɱ
ÉÑ1¥ÍÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÌÀ°ÄàÀ¤)Õ¥MÑMÑÑ ¤()¥´ÀÌØí½©a51!QQ@ô=©
ÉÑ ÅÕ½Ðí5¥É½Í½Ð¹a51!QQ@ÅÕ½Ðì¤)U%I¥ÍÑÉ5Í ÀÌØí]5}
=559°ÅÕ½Ðí]5}
=559ÅÕ½Ðì¤()]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%M±Ð($%
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M($$%á¥Ð(%¹M±Ð)]¹()Õ¹]5}
=559 ÀÌØí¡]¹°ÀÌØí5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤(%1½°ÀÌØí%ɽ´°ÀÌØí¥
½($ÀÌØí%ɽ´ô   ¥Ñ9 ÀÌØíÝAÉ´°Áá¤($ÀÌØí¥
½ô    ¥ÑM¡¥Ð ÀÌØíÝAÉ´°Äؤ(%%ÀÌØí%ɽ´±ÐìÐìÀÌØí¥¹ÁÕÐQ¡¸IÑÕɸ(%%MÑÉ¥¹IáÁIÁ±¡U%
ÑɱI ÀÌØí¥¹ÁÕФ°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤ôÅÕ½ÐìÅÕ½ÐìQ¡¸($%U%
ÑɱMÑÑ ÀÌØí±¥Íѽà°ÅÕ½ÐìÅÕ½Ðì¤($%IÑÕɸ(%¹%(%U%
ÑɱMÑÑ ÀÌØí±¥Íѽà°ÅÕ½ÐìÅÕ½Ðì¤($ÀÌØí½©a51!QQ@¹½Á¸ ÅÕ½ÐíPÅÕ½Ðì°ÅÕ½Ðí¡ÑÑÀè¼½ÍÕÍÑÅÕɥ̹½½±¹½´½½µÁ±Ñ½ÍÉ ý¡°õ¸µÀíÌõåеÀí©Í½¸õеÀí©Í½¹ÀôµÀíÄôÅÕ½ÐìµÀìU%
ÑɱI ÀÌØí¥¹ÁÕФ±ÑÉÕ¤($ÀÌØí½©a51!QQ@¹Í¹ ÅÕ½ÐìÅÕ½Ðì¤(%¥´ÀÌØíÉÑÕɹÍÐôMÑÉ¥¹MÁ±¥Ð ÀÌØí½©a51!QQ@¹ÉÍÁ½¹ÍQáаÅÕ½Ðít±lÅÕ½Ðì°Ä¤(%¥´ÀÌØíÍÑÉIÑÕɸôMÑÉ¥¹IáÁIÁ± ÀÌØíÉÑÕɹÍÑlÅt°ÅÕ½Ðì ÀäÈíl¸¨ÀäÈíl¥ðÅÕ½ÐìÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(%%ÀÌØíÍÑÉIÑÕɸôÅÕ½ÐìÅÕ½ÐìQ¡¸IÑÕɸ(%U%
ÑɱMÑÑ ÀÌØí±¥Íѽà±MÑÉ¥¹IáÁIÁ± ÀÌØíÍÑÉIÑÕɸ°ÅÕ½Ðì°ÅÕ½Ðì°ÅÕ½ÐíðÅÕ½Ð줱U%
ÑɱI ÀÌØí¥¹ÁÕФ¤)¹Õ¹
Edited by Toady

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites
ptrex
Minikori

I know that firefox has suggestions as you type your search querie.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×