Jump to content

Am I thinking right?


Thu
 Share

Recommended Posts

I am fetching some data from a sometimes unreliable web page.

I want to keep on trying to load the page until it does not time out, with a 15 second timeout limit.

Is this a efficient way, or will I encounter problems?

Do
  _IELoadWait($oIE, 0, 15000)
  $iErrSav = @error
Until $iErrSav = 0

Edit: I sure wasn't... I had to wait a bit until it became unresponsive, but then I realised that it did not work. I need to trigger the actual loading of the page again, with a refresh I guess? Working on it right now, your input is still appreciated.

Edited by Thu
Link to comment
Share on other sites

you could read text from the page itself... and if it does not load correctly, then have it read the text it gives when it did not load.

that way, you can just reload it as soon as you detect the text that happens when the load fails.

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

Ah, I do have to read the text from the actual html, since the page is not actually showing all of the info I want. However, I have that part covered, and it's working pretty good right now. (Read: I did things my way, and can not do them any other way, since that would require even more thinking!)

However, THIS should be solid... I think... or at least hope:

Do
        _IELoadWait($oIE, 0, 15000)
        $iErrSav = @error
        ConsoleWrite("Error =" & $iErrSav)
        If $iErrSav = 6 Then
            _IEAction($oIE, "refresh")
        EndIf
Until $iErrSav = 0

Edit: Bad Paste

Edited by Thu
Link to comment
Share on other sites

After re-reading your post I see what you meant, t0ddie, and I think that might work better but seeing as I am none too familiar with AutoIt as of yet, I prefer doing it this way for now.

Anyways, my problem seems solved, but it lead to another (very minor but interesting) problem;

Even if the script is terminated, the ConsoleWrite("Error =" & $iErrSav) keeps on going even after the termination. What gives? I'm just curious, it doesn't really matter.

Link to comment
Share on other sites

After re-reading your post I see what you meant, t0ddie, and I think that might work better but seeing as I am none too familiar with AutoIt as of yet, I prefer doing it this way for now.

Anyways, my problem seems solved, but it lead to another (very minor but interesting) problem;

Even if the script is terminated, the ConsoleWrite("Error =" & $iErrSav) keeps on going even after the termination. What gives? I'm just curious, it doesn't really matter.

1. it would be faster and more efficient. instead of waiting a set time, it would reset as soon as a bad load was detected.

2. post script.

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

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