Sign in to follow this  
Followers 0
dusty071

_IE functions question

3 posts in this topic

Its pretty common for websites to log you out and end your session after some time. And in such cases or similar ones you need your script to recognize that the website isnt where its supposed to be. Ive come across this situation again and Im just wondering what is your way of detecting that the script is or isnt on the right track?

- like _IEDocReadHTML ($oIE) and then search the entire html source for "Enter password:" and that would indicate that the website requires me to login again, or if the result returned failure that the script was still working.

- _IEGetObjById ( $oIE, "usernameform") if that returns failure then the script is still on the right track

- etc,...

And after a while i have a bunch of these time consuming checks in the code, i am just wondering if there is a better way?

Share this post


Link to post
Share on other sites



My question would be what exactly are you doing where your script is sitting inactive for so long that the website times out? Typically you would open the page, do what you want to do, then log out.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I use this function to check if I'm at the right web page:

Func CheckPage($sWtext)

    $hWin = WinGetHandle($sWtext)
    $vErr = @error

    If $vErr <> 0 Then
        Return False
    Else
        Return True
    EndIf

EndFunc

In my code I call this function with

If CheckPage($aBrowserTitles[3]) = True Then

       ;bla bla bla

EndIf

The array $aBrowserTitles contains the webpage titles.

In your case I guess that would be the text of the login page and text of the page you land on after the login.

 

 


If you learn from It, it's not a mistake

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  
Followers 0