Sign in to follow this  
Followers 0
Neeeewbie

How whould I read this one line? Website.

4 posts in this topic

#1 ·  Posted (edited)

Untitled.png

I googled and tried several differnt things (I'm not very skilled basicly cut and past).

This being the closest I think I came:

#include <IE.au3>

$oIE = _IECreate("The website")

$CurrentLevel = ""

$tags = $oIE.document.GetElementsByTagName("div")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "profileXpLevel" Then $CurrentLevel=IEBodyReadText($class_value)


MsgBox(0, "Level: ", $CurrentLevel)
    ExitLoop


Next

The msgbox comes up empty.

It gets to the <div class="profileXpLevel"> (I think) but Idk how to read the <h5>Level 187</h5> inside of it?

Edited by Neeeewbie

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, Neeeewbie. Is the site public where you can post a link, or can you please post the full HTML. You should be able to read the inner text, but it is difficult to tell from just that small snippet.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I posted in a similar topic not to long ago with code that does work, but probably can be done more efficiently. Especially with some of the IE functions. But here it goes anyway..
 

#include <INet.au3>
#include <String.au3>

Opt('MustDeclareVars', 1)

Local $URL = "", $Needle, $Haystack, $Needle_Start, $Needle_End

$Haystack     = _INetGetSource($URL)
$Needle_Start = '<div class="profileXpLevel"><h5>'
$Needle_End   = '</h5></div>'
$Needle       = _StringBetween($Haystack, $Needle_Start, $Needle_End)

MsgBox(4096, 'Needle in a Haystack', $Needle[0])

Note to edit the $URL variable accordingly. This is the post I made before - , feel free to try it out if you care.

Edited by somdcomputerguy

- 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

#4 ·  Posted (edited)

Thanks,  your code worked.

Edited by Neeeewbie
1 person likes this

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  
Followers 0