elmoi0010 Posted January 18, 2014 Share Posted January 18, 2014 Is there a way to copy text from a website from a "DIV" tag ? I want to copy that meltmail i was searching on this forum but i dont get nothing that help me :C. so.. i ask to an expert. Anyone can help me :C ? Thanks in advanced to all guys am triying to learn as much as i can in AUTOIT , thanks to all Link to comment Share on other sites More sharing options...
mikell Posted January 18, 2014 Share Posted January 18, 2014 #include <IE.au3> $oIE = _IECreate(....) ; put the url inside $oDivs = _IETagNameGetCollection($oIE, "div") $sTxt = "" For $oDiv In $oDivs If $oDiv.id == "meltmail" Then $sTxt = $oDiv.innertext Next MsgBox(0, "", $sTxt) guestscripter 1 Link to comment Share on other sites More sharing options...
guestscripter Posted January 18, 2014 Share Posted January 18, 2014 (edited) $sEmailAddress = $oIE.Document.GetElementsByClassName("the meltmail").item(0).innertext may also work, though you won´t get the benefits of the error-handling etc. of "proper" _IE functions. (and you need that UDF either way for _IECreate) Edited January 18, 2014 by guestscripter ImageSearch15.au3 featuring _ImageSearchStartup() and _ImageSearchShutdown() Link to comment Share on other sites More sharing options...
elmoi0010 Posted January 18, 2014 Author Share Posted January 18, 2014 #include <IE.au3> $oIE = _IECreate(....) ; put the url inside $oDivs = _IETagNameGetCollection($oIE, "div") $sTxt = "" For $oDiv In $oDivs If $oDiv.id == "meltmail" Then $sTxt = $oDiv.innertext Next MsgBox(0, "", $sTxt) Its working but i got all the meltmail div, i just need the class "the_meltmail', tahnks for your help bro i will try to figure it out Link to comment Share on other sites More sharing options...
Solution guestscripter Posted January 18, 2014 Solution Share Posted January 18, 2014 (edited) #include <IE.au3> $oIE = _IECreate(....) ; put the url inside $sTxt = $oIE.Document.GetElementsByClassName("the meltmail").item(0).innertext MsgBox(0, "", $sTxt) Edited January 18, 2014 by guestscripter ImageSearch15.au3 featuring _ImageSearchStartup() and _ImageSearchShutdown() Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 18, 2014 Share Posted January 18, 2014 You maybe could use the _INetGetSource and _StringBetween functions, sorta like this _StringBetween(_INETGetSource(URL), '<p class="the_meltmail">', '</p>') I don't know if you realize this or not, but that won't work the way it is, see the Help file for the proper usage of those functions. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
elmoi0010 Posted January 18, 2014 Author Share Posted January 18, 2014 #include <IE.au3> $oIE = _IECreate(....) ; put the url inside $sTxt = $oIE.Document.GetElementsByClassName("the meltmail").item(0).innertext MsgBox(0, "", $sTxt) Thaaaaaaanks you very much bro! it works , thanks for your help ! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 18, 2014 Share Posted January 18, 2014 (edited) I see you already got a solution, but here's another one.. #include <INet.au3> #include <String.au3> Opt('MustDeclareVars', 1) Local $URL = "http://somdcomputerguy.com", $Needle, $Haystack $Haystack = _INetGetSource($URL) $Needle = _StringBetween($Haystack, '<p class="mainline_2">', '<br>') MsgBox(4096, 'Needle in a Haystack', $Needle[0]) Edited January 22, 2014 by somdcomputerguy elmoi0010 1 - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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