Jump to content

Recommended Posts

Posted

Hello, I've a problem (I'm newbie in AutoIT), I don't know how get one word in the html code, for example:

<span id="lblTotal" class="Bold_Text">26</span>

 I desire in the case, get a value "26", how I do it ?

Thanks.

  • Solution
Posted

Here are another couple of methods base on the "id".

#include <String.au3>

$string = '<span id="lblTotal" class="Bold_Text">26</span>'
$found = StringRegExpReplace($string, '(?s).*id="lblTotal"[^>]*>([^<]+)</span>.*', "\1")
MsgBox(0, '', $found)

and

#include <IE.au3>

Local $Source = '<span id="lblTotal" class="Bold_Text">26</span>'

Local $oIE = _IECreate("about:blank", 0, 0, 0, 0)
_IEBodyWriteHTML($oIE, $Source)

Local $oId = _IEGetObjById($oIE, "lblTotal")

MsgBox(0, "Results", $oId.innertext)

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
  • Recently Browsing   0 members

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