Jump to content
FireFox

Get first link of google search results

Recommended Posts

FireFox

Hi,

I want to know if its possible to get first web site link of google search results like when you click on "I'm Feeling Lucky" without navigate...

Thanks for anyhelp or idea :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
FireFox

@monoceres

Thanks for your suggestion, but I want to do it without navigate, like a direct link :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
monoceres

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)
  • Like 1

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

Share this post


Link to post
Share on other sites
FireFox

@monoceres

Thanks, you rock ! :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
AlienStar
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 ??

Share this post


Link to post
Share on other sites
JLogan3o13

@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
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
AlienStar
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 :)

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

×