Jump to content
Sign in to follow this  
elmoi0010

Copy text froom website ?

Recommended Posts

elmoi0010
Is there a way to copy text from a website from a "DIV" tag ?
screenshot_28.png
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

Share this post


Link to post
Share on other sites
guestscripter

$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 by guestscripter

Share this post


Link to post
Share on other sites
elmoi0010
#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 

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
elmoi0010
#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 !

Share this post


Link to post
Share on other sites
somdcomputerguy

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 by somdcomputerguy
  • Like 1

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

×