Jump to content
Sign in to follow this  
Regency

Help with reading and comparing html from a website

Recommended Posts

Regency

I need to compare a section of html to a number. I remember readng somewhere about a html readbetween function. where you put the beginning of the section and the end and it reads the section between the two, anyone remmber the function?

i know how to do the script but it hinges if i can find this function...

thanks

Share this post


Link to post
Share on other sites
weaponx

_StringBetween()

Share this post


Link to post
Share on other sites
Regency

Ar yu positive this is it?

I am looking and thinking about it and i dont think this is it. How would i check and compare

There is <span id="ctl00_MainPageContent_lblHandgunFMJStock" style="font-weight:bold;">0</span> Handgun FMJ left.

I need to check to see i that "0" goes up to anything. Like i would say

if bla blah > 0 then

the bla blah would be th compare f the strig i posted above.. any help?

Share this post


Link to post
Share on other sites
weaponx

$result = _StringBetween ('<span id="ctl00_MainPageContent_lblHandgunFMJStock" style="font-weight:bold;">0</span>', '<span id="ctl00_MainPageContent_lblHandgunFMJStock" style="font-weight:bold;">', '</span>')

It would probably be more reliable to use the IE functions to get the value by id.

Share this post


Link to post
Share on other sites
Regency

How would you do the get value by id?

Share this post


Link to post
Share on other sites
weaponx

#include <IE.au3>
;$oIE  = _IE_Example ("basic")
$oIE = _IECreate ("www.yourwebsite.com")
$oDiv = _IEGetObjById  ($oIE, "ctl00_MainPageContent_lblHandgunFMJStock")
ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR)

Share this post


Link to post
Share on other sites
Regency

What does consolewrite do?

Share this post


Link to post
Share on other sites
weaponx

What does consolewrite do?

It dumps the value you are trying to get to the SciTe console.

Share this post


Link to post
Share on other sites
Regency

So, by writting it to the consle i can compare it?

Share this post


Link to post
Share on other sites
weaponx

So, by writting it to the consle i can compare it?

This is what you said in your first post:

i know how to do the script but it hinges if i can find this function...

You can do whatever you want with the output work with me here man:

$variable = _IEPropertyGet($oDiv, "innertext")

MsgBox(0,"", $variable)

If $variable = 666 Then....

Share this post


Link to post
Share on other sites
Regency

lol i am trying to work with you, but i dont understand... And the first post was for the function i couldnt find not the one you offered there is another one)

#include <IE.au3>
#include <string.au3>
$BF = _IECreate("http://www.tmnx.net/Authenticated/bulletfactory.aspx",0,1,1,0)
_IELoadWait($BF)
$oDiv = _IEGetObjById ($BF, "ctl00_MainPageContent_lblHandgunFMJStock")
ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR)
$variable = _IEPropertyGet($oDiv, "innertext")
If $variable > 0 Then
    while 1
        sleep(100)
    MsgBox(0,"Sniper FMJ", "G Buy Some")
WEnd
endif

This iswat i got.. kina like you explained,, but all it does it exits...i goes through it all guess but exits

Share this post


Link to post
Share on other sites
weaponx

When I search for Mafia Network in this forum I find six different topics started by you. I see heavy use of IE functions, did you not write any of that yourself?

Share this post


Link to post
Share on other sites
Regency

I wrote almost all of it, other then the minimize and other random functions. But i havent wrote anything in like 2 months and i am new to this whole fuction way your tellig me.

Are you saying i am retarded? sorry i dont know how to do this

Share this post


Link to post
Share on other sites
weaponx

I wrote almost all of it, other then the minimize and other random functions. But i havent wrote anything in like 2 months and i am new to this whole fuction way your tellig me.

Are you saying i am retarded? sorry i dont know how to do this

I haven't said you were retarded. The link in your last post requires a login so your script is failing since it isn't actually logged in. You might be better off using _IEAttach to connect to an already open IE window that is logged in.

Share this post


Link to post
Share on other sites
Regency

No, i am already loggd in. It isnt reading correctly.

And i dont know how to work this functon and as you said, there is alot of topics. I need lot of help with my scripts, hence me asking on the forums alot....

Share this post


Link to post
Share on other sites
weaponx

You are experiencing the same thing as this guy:

http://www.autoitscript.com/forum/index.php?showtopic=70624

Just because you have an Internet Explorer window open with the game logged in doesn't mean the script has access to the same page. These are two seperate sessions. You will need to add the functionality to the script to login or use _IEAttach instead of _IECreate to access the page.

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  

×