Cameltoe Posted March 1, 2010 Share Posted March 1, 2010 Im Currently making an auto googler. what this does is: *Navigate to google *fill in the form *press submit *fetch the topmost headline here's the code: #include<IE.au3> $IE = _IECreate ("", 0, 1, 1, 1) $url = "Google.com" _IENavigate($IE, $url, 1) $set = $submit = $get = ive come to the place where im supposed to use the objget functions but thats not really where im stuck. i need help with the Get function. i cant get it to fetch the headline anyhow. would be nice to get this going. thx in advance. - Cameltoe Link to comment Share on other sites More sharing options...
Fulano Posted March 1, 2010 Share Posted March 1, 2010 I might suggest speeding this up by dumping your query into the URL. That'll prevent a good number of bugs and will speed it up quite a bit. You will need to sanitize the string you send, but that is fairly easy as there's code for that available online. This is the one that I use, the sanitizing function is a modified version of one I found on these forums (unfortunately I didn't think to write down the author), but the rest is my code. expandcollapse popupHotKeySet ("{F4}", "google") Func google() Local $search = copySelected() If Not $search Then $search = InputBox ("Missing Information", "Search Term:") $search = sanitizeString ($search) ;This opens it in my default browser (I despise IE), but you can probably change it to use the UDF so you can pull text out ShellExecute ("http://www.google.com/search?q=" & $search) EndFunc Func copySelected () ;prevents clobbering the clipboard contents Local $oldClip = ClipGet() If WinActive ("ACT!") Then ControlSend ("ACT", "", "[Name:Connected Menus]", "ec") Else ClipPut ("") Send ("^c") EndIf For $i = 0 to 20 Sleep (10) if ClipGet() Then ExitLoop Next Local $clipStuff = ClipGet () ClipPut ($oldClip) Return $clipStuff EndFunc Func sanitizeString ($string) Local $UnicodeBinary = StringToBinary ($string, 4) Local $UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1) Local $UnicodeBinaryLength = StringLen($UnicodeBinary2) Local $EncodedString For $i = 1 To $UnicodeBinaryLength Step 2 Local $UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2) If Not StringInStr("$-_.+!*'(),;/?:@=&#", BinaryToString ('0x' & $UnicodeBinaryChar, 4)) Then $EncodedString &= BinaryToString ('0x' & $UnicodeBinaryChar) Else $EncodedString &= '%' & $UnicodeBinaryChar EndIf Next ; you might be able to replace this next line with Return StringReplace ($EncodedString, " ", +) ; for some reason the replacement of & and was inconsistent on my machine Return StringReplace (StringReplace ($EncodedString, "&", "%26"), " ", "+") EndFunc #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now