Jump to content
Sign in to follow this  
DeeRiee

_IELinkGetCollection Alternative?

Recommended Posts

DeeRiee

Hello, I have a newbie question... >_<

Is there another way to get links from web page without _IELinkGetCollection? :(

(Alternative way to get links from web page besides _IELinkGetCollection)

Thanks before... :(

Sorry for bad english :D


Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
ThomasQ

There probably is, but I, as a n00b, have been using the _IELinkGetCollection command.. What problem do you run into while using that one?

Share this post


Link to post
Share on other sites
GEOSoft

This should get the text links.

;
#include<inet.au3>
#include<array.au3> ;; For testing with _ArrayDisplay() only
$sSrc = _InetGetSource("http://www.somesite.com")
$aLinks = StringRegExp($sSrc,"(?i)href=\x22(.+\..*)\x22.*>.+</a>", 3)
_ArrayDisplay($aLinks, "Links")
;

Edit: Oooops Code fix

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
DeeRiee

This should get the text links.

;
#include<inet.au3>
#include<array.au3> ;; For testing with _ArrayDisplay() only
$sSrc = _InetGetSource("http://www.somesite.com")
$aLinks = StringRegExp($sSrc,"(?i)href=\x22(.+\..*)\x22.*>.+</a>", 3)
_ArrayDisplay($aLinks, "Links")
;

Edit: Oooops Code fix

Doesnt work for some links >_<

Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
Juvigy

$oIE = _IECreate("sitename")
        $oDoc = _IEDocGetObj($oIE) 
        $oArray = $oDoc.getElementsByTagName ("a")

This should get you all the "a" tags (a hrev).

Share this post


Link to post
Share on other sites
DeeRiee

$oIE = _IECreate("sitename")
        $oDoc = _IEDocGetObj($oIE) 
        $oArray = $oDoc.getElementsByTagName ("a")

This should get you all the "a" tags (a hrev).

I need _IELinkGetCollection alternative because i dont want to use _IECreate in my script... >_<

Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
Juvigy

I see . What about _IEAtach?

Share this post


Link to post
Share on other sites
GEOSoft

What is your reason for not wanting to use the IE.au3 UDF? It works well.

And what links did the RegExp miss?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
DeeRiee

I see . What about _IEAtach?

No, i dont wanna use _IE :(

What is your reason for not wanting to use the IE.au3 UDF? It works well.

And what links did the RegExp miss?

I'm using _IECreate in invisible mode, and I have some problem when i'm using _IEQuit, sometimes iexplore.exe process still exist... :(

Sorry about regexp, it works well, just my fault... >_<

Thanks


Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
GEOSoft

Sorry about regexp, it works well, just my fault... >_<

Thanks

So we can ASSume that the problem is solved?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
DeeRiee

So we can ASSume that the problem is solved?

Yes, solved but i wonder, can i use _IELinkGetCollection without _IECreate?


Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
GEOSoft

Yes, solved but i wonder, can i use _IELinkGetCollection without _IECreate?

Not so far as I know but Dale may check the thread and say differently.

How did the speed of my method compare?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
DeeRiee

How did the speed of my method compare?

Its faster when im using your method... :(

But still wondering about using _IELinkGetCollection without _IECreate >_<


Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites
Vakari

Yes, solved but i wonder, can i use _IELinkGetCollection without _IECreate?

#include <IE.au3>

$oIE = ObjCreate("InternetExplorer.Application")
$oIE.Visible = True
$oIE.Navigate("http://www.google.com")
_IELoadWait($oIE)

$aLinks = _IELinkGetCollection($oIE)

For $aLink In $aLinks
    ConsoleWrite($aLink.href & @CR)
Next

$oIE.Quit
$oIE = ""

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.