Jump to content
Sign in to follow this  
JesuZ

How to check _IEAttach status?

Recommended Posts

JesuZ

I'm building little form-filler script, that should place information in form fields...

I've got it working, IF, I've attached script to IE in right time...

Is there way to check out, that script is correctly attached into browser, before starting to run form fill functions...?

I was thinking about some kind of of function:

Func checkBrowsetStatus()
    if _IE_Attached_Properly Then
        Return True
    Else
        $var = Try to attach script correctly
        if $var Then
            Return True
        Else
            Return False
        EndIf
    EndIf
EndFunc

And then I could check out easily before trying to fill form,

If checkBrowserStatus() Then
     ; Go ahead, let's fill the form!
Else
     MsgBox(0,"Information", "Sorry, but couldn't attach script to IE properly. Please try again." )
EndIf

Share this post


Link to post
Share on other sites
Juvigy

$oIE = _IEAttach("Microsoft.com", "url")

If IsObj($oIE) = 0 Then ;ieattach has failed

Share this post


Link to post
Share on other sites
PsaltyDS

If there are multiple instances available, and you might be connected to the wrong one, test for a known property like the document title or a form with a unique name:

If _IEPropertyGet($oIE, "title") == "The Right Page" Then
     ; Note this is the document title in HTML, not the window title
EndIf

$oForm = _IEFormGetObjByName($oIE, "SomeUniqueFormName")
If @error = 0 Then
     ; Got the right page, because it contains the right form
EndIf

:idea:


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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.