Jump to content

Copy text froom website ?


Go to solution Solved by guestscripter,

Recommended Posts

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
Link to comment
Share on other sites

$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
Link to comment
Share on other sites

#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

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

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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