ghprog Posted March 10, 2010 Share Posted March 10, 2010 Hello folks, I am trying to help my friend who wants to do some html/css programming but both of us are stumped by a problem. What my friend wants to do is access the text in some class attributes. There are a number of HTML pages where he would like to get the text and put it into a database. But the thing is, we don't know how to set things up or how to refer to the variables. Take the example below, if he wants to get at street-address, how does he access the content of that ?? Does he use something like somevariable = .street-address ?? Where somevariable is defined as a string variable in his program ? How should he assign a variable that contains that text ? Is there an API or library when working with those kinds of things ? How do we set up AutoIt when doing this type of work ? Hopefully someone here can get us headed in the right direction. I spent a whole bunch of time on the web trying to find a decent example of how to do this but all I got were out of context examples (mostly definitions) that weren't helpful at all. Thanks for any help you can give ! Here is the code example--------------- <div class="vcard"> <div class="adr"> <span class="type">Work</span>: <div class="street-address">169 University Avenue</div> <span class="locality">Palo Alto</span>, <abbr class="region" title="California">CA</abbr> <span class="postal-code">94301</span> <div class="country-name">USA</div> </div> <div class="tel"> <span class="type">Work</span> +1-123-123-1234 </div> <div class="tel"> <span class="type">Fax</span> +1-123-123-1235 </div> <div>Email: <span class="email">info@bla_bla.net</span> </div> </div> Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 10, 2010 Share Posted March 10, 2010 Just a little start #include <Array.au3> $str = '<div class="vcard">' & @CRLF & _ '<div class="adr">' & @CRLF & _ '<span class="type">Work</span>:' & @CRLF & _ '<div class="street-address">169 University Avenue</div>' & @CRLF & _ '<span class="locality">Palo Alto</span>,' & @CRLF & _ '<abbr class="region" title="California">CA</abbr>' & @CRLF & _ '<span class="postal-code">94301</span>' & @CRLF & _ '<div class="country-name">USA</div>' & @CRLF & _ '</div>' & @CRLF & _ '<div class="tel">' & @CRLF & _ '<span class="type">Work</span> +1-123-123-1234' & @CRLF & _ '</div>' & @CRLF & _ '<div class="tel">' & @CRLF & _ '<span class="type">Fax</span> +1-123-123-1235' & @CRLF & _ '</div>' & @CRLF & _ '<div>Email:' & @CRLF & _ '<span class="email">info@bla_bla.net</span>' & @CRLF & _ '</div>' & @CRLF & _ '</div>' ConsoleWrite(StringStripCR(StringReplace($str, @LF, '')) & @CRLF) $re = StringRegExp(StringStripCR(StringReplace($str, @LF, '')) , '>([\w \.\@\:\-\+]+)<', 3) _ArrayDisplay($re) Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
BrettF Posted March 10, 2010 Share Posted March 10, 2010 XMLDomWrapper.au3. Search the forums for it. Since basic HTML is XML, it should be fairly easy... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now