Jump to content

_IE functions question


 Share

Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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

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