Jump to content

IE Read from <span>


Recommended Posts

im trying to get my script to look at

<h6>Please wait <strong><span id="timmer" style="display:inline;">0</span></strong> seconds</h6>

this is a timer that counts down from 30.0 to 0 taking 0.1 each 100 milliseconds

i currently am using

$timmer=_IEGetObjById($iee,"timmer")
        Do
            $timmer=_IEGetObjById($iee,"timmer")
            consolewrite($timmer)
        Until $timmer = 0.1

but autoit doesn't pick up the time left.

how can i get autoit to read the seconds left and display it with consolewrite()?

Edited by rvbfreak
Link to comment
Share on other sites

Try this. Be sure to read the comments. If you format your valiables like the example it's easier to keep the different variable types apart.

(aVar for array, oVar for object, sVar for string, nVar for number, iVar for incrementing value etc.)

$oTimmer =_IEGetObjById($iee,"timmer") ;this should return an onbject type variable for the element
Do
 $sTimeLeft = _IEPropertyGet ($oTimmer, "innertext") ;This should return a string with the displayed text in an element.
 ConsoleWrite($sTimeLeft & @CRLF)
 Sleep(100) ;reduce cpu load.
Until $sTimeLeft = 0.1 ;be carefull here (see below)
;You're comparing a string to a number which usually works, but can supprise you.
;Does the timer keep displaying "0.1", or does it continue to for instance 0.0?
;Try "Number($sTimeLeft) <= 0.1" instead

edit: added a sleep and took the _IEGetObjById out of the loop.

Edited by Tvern
Link to comment
Share on other sites

that seems to have worked. thanks.

one more question:

the script is supposed to download a file from a site. the site counts down (which you just helped me with), and then a download button is displayed. the problem is, the download button doesnt use a link to download. instead, it uses what im guessing is a javascript class

this is the html

<a style="" class="slower_download_btn" id="regularBtn2">Download</a>

i tried using inetget,but when i used consolewrite to check the progress using inetgetinfo it just gave me 0's.

i noticed this html was inside form tags (that might help)

Edited by rvbfreak
Link to comment
Share on other sites

It would help if you had a link, or atleast the page source. Either the page header, or a CSS file probably contains a download link, but it might only be usable after some form of javascript has been activated. This should all be possible to automate, but it's very dependent on the setup of the page.

Link to comment
Share on other sites

It would help if you had a link, or atleast the page source. Either the page header, or a CSS file probably contains a download link, but it might only be usable after some form of javascript has been activated. This should all be possible to automate, but it's very dependent on the setup of the page.

im making an autodownloader that will download from multiple sites(basically a clone of jdownloader). so far i have support for rapidshare, and now im attempting fileserve

heres the file im attempting to download

http://www.fileserve.com/file/4VCfhs8

Link to comment
Share on other sites

I've got this working to create a normal download, but I am unable to get a url that will work with inetget.

#include <ie.au3>
$oIE = _IECreate("http://www.fileserve.com/file/4VCfhs8")
$oLink = _IEGetObjById($oIE,"regularBtn")
_IEAction($oLink,"click")
_IELoadWait($oIE,500,5000)
$oTimmer =_IEGetObjById($oIE,"timmer")
While 1;wait untill the timer starts
    If _IEPropertyGet ($oTimmer, "innertext") <> 0 Then ExitLoop
    Sleep(100)
WEnd
Do
    $sTimeLeft = _IEPropertyGet ($oTimmer, "innertext")
    ConsoleWrite($sTimeLeft & @CRLF)
    Sleep(100)
Until Number($sTimeLeft) <= 0.1
Sleep(3000) ;you can remove this if you formulate some kind of check to see if the button is visible
$oLink = _IEGetObjById($oIE,"regularBtn2")
_IEAction($oLink,"click")

The source refers to scripts in a file called download_captcha.js which seems to handle the behavior of the buttons, timer and captcha, but it get's way too complicated for me.

I also think going any further than this is stretching the forum rules (if not breaking them) so I'm leaving it at this.

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