Sign in to follow this  
Followers 0
StormyKnight

Auto clicking link in java enabled page

3 posts in this topic

My script is for a guy who needed to automate a website to click a link that only intermittently comes up. The script works for a while then errors out with an error in the ie.au3 include. I suspect some kind of memory leak as it would initially run for 30 minutes or so, then it shortened to 20, and now he is complaining that it fails after 5 minutes.

If this is eating memory, how can I release it as this goes on: the script is designed to run forever. I used the "paste into browser window" method as he told me that sending F5 causes the session to log out very quickly, as he found when he was sitting in front of the site for hours at a stretch.

Please help. The website is not mine or I could rewrite it to accomodate him.

#include <IE.au3>
$i=0
While $i = 0
    $oIE = _IEAttach("Authorized_User", "Text")
    If @error = 5 Then
        MsgBox(4096,"", "You need to log in.")
    ; should never occur, but we will see...
        Exit
    ElseIf @error = 7 Then
        MsgBox(4096,"", "You need to log in.")
    ; ditto
        Exit
    EndIf
    $sMyString = "Desired/Search/Text"
        
    $oLinks = _IELinkGetCollection($oIE)
; I am getting a collection of every link on the web page
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innertext")
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
            SoundPlay ( "c:/MyAlarm/alarm.wav", 1 )
        ; There because I put it there
            Exit
        EndIf   
    Next    
;~      This For - Next loop iterates through the links. If the link is found, it sends a click.
;~      Then it plays the alarm and exits the program.
        Sleep ( 10000 )
;       If the link is not found, we wait 10 seconds...
        $Var = "C:\Documents and Settings\owner\Desktop\JavascriptEnabledWebsite.html"
    ; here is the address to paste, or it will be...Used dummy file to test
        Opt("WinTitleMatchMode", 2)
        ClipPut($Var)
        WinActivate ("TextInTitle");
        Send("^l")
        Send("^v")
        Send("{ENTER}")
    ; This set of commands will repaste the browser address, press enter and restart the whole cycle
WEnd 
Exit

Share this post


Link to post
Share on other sites

You'll need to post the error.

Also, look at _IELoadWait And _IEErrorHandlerRegister

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

Share this post


Link to post
Share on other sites

You'll need to post the error.

Also, look at _IELoadWait And _IEErrorHandlerRegister

Dale

I set up _IELoadWait and the _IELoadWaitTimeout and set it up on his system. It ran for an hour with no errors and I told him to let me know when it timed out (and get me a screenshot of the error when it happened). An hour later he emailed me to say it had run for 2 hours continuously with no errors. As of this morning I have had no contact or emails reporting further crashes. So I am going to say for now that the program is fixed.

Thank you very much!

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