Jump to content

Recommended Posts

Posted

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

Posted

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

Posted (edited)

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!"

Posted

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 >_<
Posted

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

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

Posted

$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... >_<
Posted

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!"

Posted

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

Posted

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!"

Posted

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!"

Posted

How did the speed of my method compare?

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

But still wondering about using _IELinkGetCollection without _IECreate >_<

Posted

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 = ""

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
  • Recently Browsing   0 members

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