Jump to content

Recommended Posts

Posted

Apologies if this has appeared before, but I've searched and cannot find what I'm looking for.

 

In this included example:

#include <IE.au3>


Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetObjByName($oIE, "f")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

It waits for http://www.google.com to fully load before the text are input and searched - how to make it so that it inputs the text and searches as soon as that search box and the 'Google Search' button has appeared - rather than waiting for it to fully load?

 
Posted

The elements are created while the ie is getting created. You can't handle the window if it isn't "filly loaded" because it doesn't respond.

With the above script there is nothing you can do. You can though set all the elements and then load the page, server or whatever else with the fields completed as you want.

Posted (edited)

As soon as it is created you can handle the window but not its content if not loaded

You can try something like this

#include <IE.au3>

Global $g_eventerror = 0 
_IEErrorHandlerRegister("MyErrFunc")

Local $oIE = _IECreate("http://www.google.com", 0, 1, 0)
; msgbox(0,"", _IEPropertyGet($oIE, "hwnd"))

Do
  $g_eventerror = 0
  $input = _IEGetObjByName($oIE, "q")
  ConsoleWrite($g_eventerror & @crlf)
Until $g_eventerror = 0

Local $oForm = _IEFormGetObjByName($oIE, "f")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

Func MyErrFunc() 
   $g_eventerror = 1 
Endfunc

This is just an example so be aware to put the right target inside the loop

Edited by mikell
Posted

  On 10/26/2013 at 9:06 AM, mikell said:

As soon as it is created you can handle the window but not its content if not loaded

You can try something like this

#include <IE.au3>

Global $g_eventerror = 0 
_IEErrorHandlerRegister("MyErrFunc")

Local $oIE = _IECreate("http://www.google.com", 0, 1, 0)
; msgbox(0,"", _IEPropertyGet($oIE, "hwnd"))

Do
  $g_eventerror = 0
  $input = _IEGetObjByName($oIE, "q")
  ConsoleWrite($g_eventerror & @crlf)
Until $g_eventerror = 0

Local $oForm = _IEFormGetObjByName($oIE, "f")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

Func MyErrFunc() 
   $g_eventerror = 1 
Endfunc
This is just an example so be aware to put the right target inside the loop

Well i haven't tested it but even if you can handle the window, in case it responds, you will never be able to fill the fields with data if they are not created.

I don't even know why you posted that example and what it has to do with what the op is asking...

Posted

  On 10/27/2013 at 1:20 AM, AutID said:

Well i haven't tested it but even if you can handle the window, in case it responds, you will never be able to fill the fields with data if they are not created.

I don't even know why you posted that example and what it has to do with what the op is asking...

Looks like a valid attempt, to address the OP to me.

Granted, it's probably better used after loadwait, but is certainly relevant to question.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

  On 10/27/2013 at 1:44 AM, JohnOne said:

Looks like a valid attempt, to address the OP to me.

Granted, it's probably better used after loadwait, but is certainly relevant to question.

It doesn't. That actually shows that the window can be handled even if the IECreate isn't "fully loaded".

And what you are suggesting isn't necessary.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...