Jump to content

Recommended Posts

Posted (edited)

<abbr class="timestamp">inner text example</abbr>

I would like to make AutoIt search in the website's source for the abbr tag with classname timestamp and return me the innertext of it.

How would I go about doing that, though? :/

Your help is very much appreciated! :)

Thanks a lot!

Edited by Sedoc94
Posted (edited)

Hmm, well that won't work because the <abbr> has got some other attributes that are dynamic (changes everytime), so I basically really need to check for the tag with the classname and then return the inner text of it.

Better example below

<abbr class="timestamp" data-utime="1341863797" title="Monday, July 9, 2012 at 9:56pm">inner text example</abbr>
Edited by Sedoc94
Posted

If you have the xml saved as a file, use load...if you have the xml as a string, use loadxml

$oXML=ObjCreate("Microsoft.XMLDOM")
$stest = @DesktopDir & "xml.xml"
$oXML.Load($stest)
ConsoleWrite ( $oXML.xml & @CRLF)
$result = $oXML.selectSingleNode('//abbr')
msgbox ( 4096, "test", $result.text )
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

As I'm not good as this, this now confuses me a lot. So it's not that easy for me to transform your example script to make it work. :(

Posted

Alright, I managed to transform your code into:

#include <Inet.au3>

$URL = 'http://www.example.com'
$urlSource = _INetGetSource($URL)
$Match = StringRegExp($urlSource,'<abbr (?:.*?)>(.*)</abbr>',3)

MsgBox(0, "", $Match[0])

But the thing is now that _INetGetSource takes very long to get the source, about 6 seconds long. Isn't there a way to speed up the process of getting the source? Thanks :)

Posted

Well, it's not my internet. It's just the source code is like thousands of lines long, I guess that's the reason why it take so long.

But it would be nice if the function would stop getting more of the source when it has reached the tag.

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
×
×
  • Create New...