Jump to content

Get first link of google search results


FireFox
 Share

Recommended Posts

Something like this maybe?:)

#include <ie.au3>
$searchterm=StringReplace("AutoIt Wikipedia"," ","+")
$ie=_IECreate("http://www.google.com/search?hl=en&q="&$searchterm&"&btnG=Google+Search&aq=f&oq=",0,0)

$links=_IELinkGetCollection($ie)

$i=0
For $link In $links
    If $i=23 Then 
        MsgBox(0,$link.innerText,$link.href)
        ExitLoop
    EndIf
    
    $i+=1
Next

_IEQuit($ie)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Got it!

#include <ie.au3>
$searchterm = StringReplace("AutoIt Wikipedia", " ", "+")
$url = "http://www.google.com/search?hl=en&q=" & $searchterm & "&btnI=I%27m+Feeling+Lucky&aq=f&oq="

$answer = MsgBox(68, "?", "Direct link to AutoIt Wikipedia is:" & @CRLF & $url & @CRLF & "Navigate now?")
If $answer = 6 Then ShellExecute($url)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 8 years later...
On 2/12/2009 at 9:47 PM, monoceres said:

Got it!

 

#include <ie.au3>
$searchterm = StringReplace("AutoIt Wikipedia", " ", "+")
$url = "http://www.google.com/search?hl=en&q=" & $searchterm & "&btnI=I%27m+Feeling+Lucky&aq=f&oq="

$answer = MsgBox(68, "?", "Direct link to AutoIt Wikipedia is:" & @CRLF & $url & @CRLF & "Navigate now?")
If $answer = 6 Then ShellExecute($url)

amazing tip :)

how can I do the same for image search please ??

Link to comment
Share on other sites

  • Moderators

@AlienStar did you happen to notice this thread is over 9 years old? Please don't resurrect old posts, especially when what you're asking has absolutely NOTHING to do with the original question.

Start a new thread instead, include a detailed description of what you're trying to accomplish, along with what you have tried on your own, and we will do our best to assist.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Just now, JLogan3o13 said:

@AlienStar did you happen to notice this thread is over 9 years old? Please don't resurrect old posts, especially when asking a completely different question. Start a new thread instead, include a detailed description of what you're trying to accomplish, along with what you have tried on your own, and we will do our best to assist.

oh sorry I didn't notice its date

I'll make a new thread :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...