Jump to content

<IE.au3> _IELoadWait


 Share

Recommended Posts

_IECreate() , _IENavigate() and some _IE* functions have _IELoadWait option. _IELoadWait so good but I'm having problem with it. I don't want to wait for image load.

question: how can I use _IELoadWait functions (in _IECreate(), _IENavigate()) and don't need to wait image load?

thanks. :)

Link to comment
Share on other sites

_IECreate() , _IENavigate() and some _IE* functions have _IELoadWait option. _IELoadWait so good but I'm having problem with it. I don't want to wait for image load.

question: how can I use _IELoadWait functions (in _IECreate(), _IENavigate()) and don't need to wait image load?

thanks. :)

Dog ate your help file? Look at the $f_wait parameter for those functions in the help file.

:)

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

maybe u don't understand my question.

I read about $f_wait but if set $f_wait = 1 ~> wait for load image

if set $i_wait = 0 ~> no wait anything, ~> sometime the source of site is nothing too.

I'm talking about the option, if set $f_wait = -1 then ~> wait load source but dont wait load image?

p/s:what do u mean, "Dog ate your help file" >"<?

Link to comment
Share on other sites

Link to comment
Share on other sites

maybe u don't understand my question.

I read about $f_wait but if set $f_wait = 1 ~> wait for load image

Exactly.

if set $i_wait = 0 ~> no wait anything, ~> sometime the source of site is nothing too.

I don't understand what you mean here.

I'm talking about the option, if set $f_wait = -1 then ~> wait load source but dont wait load image?

Where did you see an option for $f_wait = -1? That will be exactly the same as $f_wait = 1 (both True, wait for page to finish).

Dale Hohm did post a solution somewhere for turning images off when loading the page. I don't remember how it worked, but if you use the Search function, you should be able to find it.

p/s:what do u mean, "Dog ate your help file" >"<?

It was meant to be funny by reference to "My dog ate my homework."

:)

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

There is another way... turn off the wait in _IECreate and then monitor the readystate yourself with _IEPropertyGet(object, "readystate")

Object can be the browser object (e.g. $oIE), document (e.g. $oDoc = $oIE.document) or any DOM element. Readystate values unfortunately are either strings or constants, depending on the object.

0 = uninitialized

1 = loading

2 = loaded

3 = interactive

4 = complete

_IELoadWait uses this property and checks for the numeric or string value. You typically will not want to continue before 3, interactive.

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

Link to comment
Share on other sites

Thank Dale, and here is my way.

While Not ($o_object.readyState = 3 Or $f_About)
    If (TimerDiff($IELoadWaitTimer) > $i_timeout) Then
        $i_ErrorStatusCode = $_IEStatus_LoadWaitTimeout
        $f_About = True
    EndIf
    Sleep(100)
WEnd

While Not (IsObj($o_object.document.body) Or $f_About)
    If (TimerDiff($IELoadWaitTimer) > $i_timeout) Then
        $i_ErrorStatusCode = $_IEStatus_LoadWaitTimeout
        $f_About = True
    EndIf
    Sleep(100)
    WEnd

I still have problem with _IECreateNew(). I want to invisible IE instance with _IECreateNew and here is my way

Local $s_random, $h_IEhandle, $o_IE
    Local $result, $f_mustUnlock = 0

    $s_random = "about:blank-" & Random(1000000, 9999999, 1)
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $s_random)

    If Not WinWait($s_random, "", 60) Then; Expected IE window did not appear
        Return SetError(1, 0, 0)
    EndIf
    
    If Not $f_visible Then $f_takeFocus = 0; Force takeFocus to 0 for hidden window
    
    If Not $f_visible Then
        $result = __IELockSetForegroundWindow(1)
        If $result Then $f_mustUnlock = 1
    EndIf
    
;If Not $f_visible Then WinSetTrans($s_random, '',0)

    $h_IEhandle = WinGetHandle($s_random, "")
    $o_IE = _IEAttach($h_IEhandle, "hwnd")

    If Not IsObj($o_IE) Then; attach failed
        Return SetError(2, 0, 0)
    EndIf
    
    $o_IE.visible = $f_visible
    
    If $f_mustUnlock Then
        $result = __IELockSetForegroundWindow($LSFW_UNLOCK)
    If Not $result Then __IEErrorNotify("Warning", "_IECreate", "", "Foreground Window Unlock Failed!")
; If the unlock doesn't work we may have created an unwanted modal window
    EndIf

    _IENavigate($o_IE, $s_url)
    Return $o_IE

It does not work well as my expected. if i set $f_visible= 0 , IE instance will be invisible but when one IE instance is created, it will take focus of the current activate windows. And it still visible in a short time

I want it don't appear, don't take focus. How to do that?

thanks for read.

trandatnh

Edited by trandatnh
Link to comment
Share on other sites

You're doing everything I would suggest. IE8 appears to have a "newprocess" flag so there may be some new options comming -- but I have not tested with it yet.

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

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