DeeRiee Posted August 9, 2009 Posted August 9, 2009 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
ThomasQ Posted August 9, 2009 Posted August 9, 2009 There probably is, but I, as a n00b, have been using the _IELinkGetCollection command.. What problem do you run into while using that one?
GEOSoft Posted August 9, 2009 Posted August 9, 2009 (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 August 9, 2009 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!"
DeeRiee Posted August 10, 2009 Author Posted August 10, 2009 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 >_<
Juvigy Posted August 10, 2009 Posted August 10, 2009 $oIE = _IECreate("sitename") $oDoc = _IEDocGetObj($oIE) $oArray = $oDoc.getElementsByTagName ("a") This should get you all the "a" tags (a hrev).
DeeRiee Posted August 10, 2009 Author Posted August 10, 2009 $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... >_<
GEOSoft Posted August 10, 2009 Posted August 10, 2009 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!"
DeeRiee Posted August 11, 2009 Author Posted August 11, 2009 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
GEOSoft Posted August 11, 2009 Posted August 11, 2009 Sorry about regexp, it works well, just my fault... >_< ThanksSo 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!"
DeeRiee Posted August 12, 2009 Author Posted August 12, 2009 So we can ASSume that the problem is solved?Yes, solved but i wonder, can i use _IELinkGetCollection without _IECreate?
GEOSoft Posted August 12, 2009 Posted August 12, 2009 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!"
DeeRiee Posted August 12, 2009 Author Posted August 12, 2009 How did the speed of my method compare?Its faster when im using your method... But still wondering about using _IELinkGetCollection without _IECreate >_<
Vakari Posted August 12, 2009 Posted August 12, 2009 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 = ""
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