Jump to content

How To Use _IELoadWait() Properly


Recommended Posts

#include <Process.au3>

#include <IE.au3>

$text = ""

$oIE = _IECreate("about:blank")

WinsetState($oIE,"",@SW_MAXIMIZE)

_IENavigate($oIE,"Http://www.yahoo.com/login.jsp")

_IELoadWait($oIE)

$oForm = _IEFormGetObjByName ($oIE, "login")

$loginName = _IEFormElementGetObjByName ($oForm, "username")

$loginPass = _IEFormElementGetObjByName ($oForm, "password")

If @error Then

MsgBox(48,"error",@error)

EndIf

_IEFormElementSetValue ($loginName, "XXX")

_IEFormElementSetValue ($loginPass, "XXX")

send("{tab 8}")

sleep(1000)

send("{Enter}")

send("{Enter}")

$oIE.visible =0

_IELoadWait($oIE)

_IENavigate($oIE, "https://yahoo.com/500?fcf=00B60000004R87z")

$text = _IEBodyReadHTML($oIE)

$fileName = "C:\test.csv"

Link to comment
Share on other sites

I'm not quite sure if that's the example I'm looking for..

Is it possible do to something like the following:

If _IELoadWait($oIE) @error Then
    SomeFunc()
EndIf

Meaning, if it loads.. it continues.. if it timeout's then it runs SomeFunc()

Possible?

Link to comment
Share on other sites

I'm not quite sure if that's the example I'm looking for..

Is it possible do to something like the following:

If _IELoadWait($oIE) @error Then
    SomeFunc()
EndIf

Meaning, if it loads.. it continues.. if it timeout's then it runs SomeFunc()

Possible?

You're talking about a script of maybe 10 lines. What happens when you try it? Seriously, you're asking for other people to do something you could test in two minutes and learn more from anyway.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You're talking about a script of maybe 10 lines. What happens when you try it? Seriously, you're asking for other people to do something you could test in two minutes and learn more from anyway.

:D

There's no need to be an ass about it. I was simply asking because I've already tried to recreate a scenario where my IE would timeout and the page wouldn't load correctly.. however I can't seem to toggle that on demand. Why try and setup the scenario where it does that and waste 30-40 minutes, when someone could just tell me and save me the trouble and time?

It's a simple question, and I'm not that familiar with Autoit anymore..

Link to comment
Share on other sites

_IELoadWaitTimeout will change the length of the timeout. The default is 5 minutes - set it lower. Look at the @error values for _IELoadWait to find the value returned after a timeout and test for it.

Regarding PsaltyDS's comment... yes, I would rather you spend 30-40 minutes figuring this out on your own. Please remember that this is a very busy forum and anything that gets posted may be read by hundreds of people... do the math. And it may have taken me 3 minutes to write this reply, but who is to say that my 3 minutes isn't more valuable than your 30-40 (actually, I already know that it is - to me. I only spend my time here replying in hopes that you will learn from it and ask better questions in the future... if not, I'll keep my 3 minutes next time).

Dale

Edited by DaleHohm

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

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