Jump to content

DIV tag and text copying function


Shonnie
 Share

Recommended Posts

Hey, first of all, heres my code:

#include <IE.au3>
$oIE = _IEAttach("Slasher", "embedded ")
$oDiv = _IEGetObjById($oIE, "playerStats")
FileWriteLine("Text.txt", $oDiv)

What I was aiming for, was copying the text inside a DIV tag, from generated source on a java applet.

Heres the DIV tag and some surrounding code:

<div id="playerStats">
<div class="statLabel">Life:</div>
<div class="statValue">657 / 794</div>

What I'm making, is a program that looks at this, and saves it to a text file. Yes, this is messy, but just until I get it to work :)

So, any enlightenment out there? <_<

Link to comment
Share on other sites

You're missing the /div for the first div element, but I'll assume it follows the other two divs...

Change

FileWriteLine("Text.txt", $oDiv)

to FileWriteLine("Text.txt", _IEPropertyGet($oDiv, "innertext"))

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Works great thanks <_<

Now how can i get info out of a div class? Specifically, I only want : <div class="head">

Which contains : Shmoo (Fighter) (Lvl: 13)

And after that I'm going to parse it to find Lvl: x and make X into a variable...

Is this even doable? Hahaha sounds crazy now that I think of it :)

Edited by Shonnie
Link to comment
Share on other sites

$oDiv.classname gives you the class value. Don't know what Lvl: X is -- it's not in what you posted.

You'll need to go to MSDN to find more info on properties of Div (see my sig, start with DHTML Objects link).

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...