Jump to content

IE check if already logged


 Share

Recommended Posts

I'm doing a script to login and check my grades for college and some other useful things. But how can I check if i'm already logged in.

What I have tried is to _IEDocReadHTML and then try to read the string with my username or anything that indicates I am logged. But it never returns the actually real html that I am seeing on my browser. It only returned a logged out html version. Anyway I can find out when I am logged or not. Thanks.

Link to comment
Share on other sites

Hi.

Do you attach to an existing browser window or do you create one new? Maybe you have some code for us? In my experience errors often are inside code.

Regards, Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

In the past, I've done this by using _IEFormElementGetObjByName to look for a specific field. If it's there, then I know that I can proceed.

In your case, you could look for the login elements. If they are present, then proceed to login. Otherwise, assume that you are already logged in and skip that step.

Link to comment
Share on other sites

3 hours ago, Simpel said:

Hi.

Do you attach to an existing browser window or do you create one new? Maybe you have some code for us? In my experience errors often are inside code.

Regards, Conrad

I use _IECreate for this. 

Local $Username = GUICtrlRead($User)
    ;MsgBox(0,"", $Username)
    Local $Password = GUICtrlRead($Pass)
    ;MsgBox(0,"", $Password)
    Local $Nickname = GUICtrlRead($Nickname_)
    ;MsgBox(0,"", $Nickname)

Local $oIE = _IECreate("https://procesos.intec.edu.do", 0, 1, 1, 1)

Local $DocRead = _IEDocReadHTML($oIE)
FileWrite("Document.html", $DocRead)

If StringInStr($DocRead, $Nickname) Then
    GUICtrlSetData($Status, "Successful !")
Else
    GUICtrlSetData($Status, "Failed")
EndIf

 

Link to comment
Share on other sites

2 hours ago, Danp2 said:

In the past, I've done this by using _IEFormElementGetObjByName to look for a specific field. If it's there, then I know that I can proceed.

In your case, you could look for the login elements. If they are present, then proceed to login. Otherwise, assume that you are already logged in and skip that step.

I tried   "_IEFormElementGetObjByName" but it still found it even logged.

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

×
×
  • Create New...