logcomptechs Posted February 26, 2009 Share Posted February 26, 2009 I was wondering if their is any way to grab a URL from a Text Link, for example "Click Here" (put the actual URL points to www.google.com). Anyway using the IE functions to grab that URL from that link of text. Been looking around, still have not figure it out. If someone could point me in the right direction that would be great, and no I am not asking for anyone to write any code for me, just some direction would be nice. Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 _IELinkGetCollection [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
logcomptechs Posted February 26, 2009 Author Share Posted February 26, 2009 Doesn't this grab all the links on the page, what I just want certain links? Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 yeah, so go through them and do what you want with the ones that fit your requirements. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
Bru Posted February 26, 2009 Share Posted February 26, 2009 _IELinkGetCollection. Maybe save these to something, or put them into an array, Then sort out the ones you want from the ones you do not want. [right][/right] Link to comment Share on other sites More sharing options...
logcomptechs Posted February 26, 2009 Author Share Posted February 26, 2009 Thanks guys, going to try that out now. Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 Modified example from the help file: ; ******************************************************* ; Example 1 - Open browser with basic example, get link collection, ; loop through items and display the associated link URL references ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended ;MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks ;MsgBox(0, "Link Info", $oLink.href) If StringInStr($oLink.href ,"forum") Then MsgBox(0, "Link Info", $oLink.href) Next [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
logcomptechs Posted February 26, 2009 Author Share Posted February 26, 2009 Works great, now I just need to figure out how to get it into a array, thank you so much for your help! Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 (edited) ; ******************************************************* ; Example 1 - Open browser with basic example, get link collection, ; loop through items and display the associated link URL references ; ******************************************************* ; #include <IE.au3> #include <array.au3> ; just used for _ArrayDisplay $oIE = _IE_Example("basic") $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended Dim $a_links[1] = [0] ;MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks ;MsgBox(0, "Link Info", $oLink.href) $a_links_size = UBound($a_links) ReDim $a_links[$a_links_size + 1] $a_links[0]=$a_links_size $a_links[$a_links_size] = $oLink.href Next _ArrayDisplay($a_links) [edit] updated $a_links[0] to = count Edited February 26, 2009 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
logcomptechs Posted February 26, 2009 Author Share Posted February 26, 2009 Would you have any clue why I would repeats of the URL? The array works fine, and it displays the URLs I am looking for, but it display each URL found with the StringInStr parameters 3 times each. I am guessing that the it just has those URLs three times on the site, but I do not know. Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 Dont do your string searching inside the loop that is building the array. Do another loop after the array has been completed to do your searching. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 ; ******************************************************* ; Example 1 - Open browser with basic example, get link collection, ; loop through items and display the associated link URL references ; ******************************************************* ; #include <IE.au3> #include <array.au3> ; just used for _ArrayDisplay $oIE = _IE_Example("basic") $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended Dim $a_links[1] = [0] ;MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks ;MsgBox(0, "Link Info", $oLink.href) $a_links_size = UBound($a_links) ReDim $a_links[$a_links_size + 1] $a_links[0] = $a_links_size $a_links[$a_links_size] = $oLink.href Next _ArrayDisplay($a_links) For $x = 1 To $a_links[0] If StringInStr($a_links[$x], "forum") Then MsgBox(0, "Link Info", $a_links[$x]) Next [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
logcomptechs Posted February 26, 2009 Author Share Posted February 26, 2009 I was doing the searching in the same array, but I did it outside with the For Statement, and then wrote to a File so I can see all the URLs and it still produce 3 of each URL. I am guessing it has to be the website then, otherwise no reason it would create the URL three times. Thanks for your help, guess have to find a different solution, maybe I can just delete the duplicates or something. Link to comment Share on other sites More sharing options...
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