Sign in to follow this  
Followers 0
adroitful

_IEDocReadHtml searchable?

9 posts in this topic

Is it possible to search or remove everything but a given tag. For example,

<fieldset><legend>Equipment</legend>

Item stats

random item name

+1 Lightning Damage

</fieldset>

Would it be possible to search thru just this part of the html for a specific statistic. Like say, I wanted to check if the item has +1 lightning damage and if not, have my autoit code trash it. I figure the best way would be to create a temp text file or something. Thanks again for any input on this. I hope this will be the last question I have to bother you guys with and i'm just stumped on this one.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can use standard string functions.

Example :

#Include <string.au3>
#Include <Array.au3>

$string = "<fieldset> <legend>Equipment</legend>Item statsrandom item name+1 Lightning Damage </fieldset>"
$array1 = _StringBetween($string, "<fieldset>", "</fieldset>")
_ArrayDisplay($array1)
Edited by Inverted

Share this post


Link to post
Share on other sites

You can use standard string functions.

Example :

#Include <string.au3>
#Include <Array.au3>

$string = "<fieldset> <legend>Equipment</legend>Item statsrandom item name+1 Lightning Damage </fieldset>"
$array1 = _StringBetween($string, "<fieldset>", "</fieldset>")
_ArrayDisplay($array1)

Wow, I had no idea that AutoIt had this kind of function built into it. Thanks for the quick and helpful reply. I'll mess with it and see if I can't get it to do what I want.

Share this post


Link to post
Share on other sites

Okay, I've tried messing with what you've given me. I cannot get it to display the array though. Here's what I have:

$string = "<fieldset> <legend>Equipment ( 4 / 8 )</legend> </fieldset>"
$array1 = _StringBetween($string, "<legend>", "</legend>")
_ArrayDisplay($array1,"Items:")

Heres the page code:

<fieldset><legend>Equipment ( 4 / 8 )</legend>
<div class="ce"><!-- 20919875 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/Club.gif"> <b> splintered club</b><br>

Damage:  2 to 10<br>
<br>
<br><br><br><br></div><!-- 2078549 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/Dagger.gif"> <b>Mystical mithril dagger</b><br>
Level Req: 25<br>
Damage:  46 to 80<br>

<br>
+25% Enhanced Effect<br>+5 Extra Item Slots<br>+1% Damage Return<br></div><!-- 20920775 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/Dagger.gif"> <b>Mystical mithril dagger</b><br>
Level Req: 25<br>
Damage:  36 to 64<br>
<br>
+1 Magic Luck<br>+1% Block<br>+2% Mana Syphon<br></div><!-- 20918593 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/LightCharm.gif"> <b>Magical lightning I</b><br>

Spell Damage:  2 to 24<br>
Mana Cost: 5<br><br>
+1 to 10 Mana per Kill<br><br><br></div></div>
</fieldset>

<fieldset><legend>Items</legend>
<div class="ce"><!-- 20797326 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/Comfrey.gif"> <b>Magical  comfrey</b><br>
Level Req: 5<br>
<desc>Use Item to Receive Effect</desc><br>

<br>
Heals 340 Life<br></div><!-- 20817938 --><div class="mpl fL"><img src="http://ladderslasher.d2jsp.org/icons/Comfrey.gif"> <b>Magical  comfrey</b><br>

<desc>Use Item to Receive Effect</desc><br>
<br>
Recovers 434 Mana<br></div></div>
</fieldset>

Basically, i'm trying to make it search the items and if they don't meet my expectations, i'll have my bot toss them. Hopefully I can get this working and as always any help would be greatly appreciated

Share this post


Link to post
Share on other sites

#Include <string.au3>
#Include <Array.au3>
#include <Inet.au3>
;
$array1 = _StringBetween(_INetGetSource ("http://www.autoitscript.com/forum/index.php?showtopic=96648"), "<title>", "</title>")
_ArrayDisplay($array1)
Okay, I tried changing my code to this and all I get is an error. It's not specifying anything in particular about it either:

$string = "<fieldset> <legend>Equipment ( 4 / 8 )</legend> </fieldset>"
$array1 = _StringBetween(_INetGetSource ("http://forums.d2jsp.org/user.php?c=3&i=564064&p=283765?"), "<legend>", "</legend>")
_ArrayDisplay($array1,"Items:")

Share this post


Link to post
Share on other sites

Okay, with a little tweaking of the code you gave me, I managed to get it to work. Then, I used _ArraySearch to search for different stats. Thanks very much, now I can go finish my program

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

N/m

Edited by adroitful

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