Sign in to follow this  
Followers 0

Website-AutoLogin with Internet Explorer

15 posts in this topic

Posted (edited)

This is a script for automatic login on websites using the Internet Explorer

#include <IE.au3>

$Url = 'http://www.autoitscript.com/forum/index.php?app=core&module=global&section=login'
$User = 'user'
$Pwd = 'pwd'

$test = _IEAutoLogin($Url, $User, $Pwd)

Func _IEAutoLogin($sUrl, $sUsername, $sPwd)
 ;funkey 09.09.09
 $oIE = _IECreate($sUrl)
 _IEErrorNotify(False)
 _IEErrorHandlerRegister()
 $oForms = _IEFormGetCollection($oIE)
 If @error Then
  Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'
 Else
  $Index = 0
  For $oForm In $oForms
   $oFormElements = _IEFormElementGetCollection($oForm)
   If IsObj($oFormElements) Then
    $IndexElement = 0
    For $oElement In $oFormElements
     If $oElement.Type = 'password' Then
      $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)
      _IEFormElementSetValue($oPwd, $sPwd)
      For $i = $IndexElement - 1 To 0 Step -1
       $oUser = _IEFormElementGetCollection($oForm, $i)
       If $oUser.Type = 'text' Then
        _IEFormElementSetValue($oUser, $sUsername)
        ExitLoop
       EndIf
      Next
      If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then  ;submit
       _IEFormSubmit($oForm, 0)
       _IELoadWait($oIE)
      Else  ;click
       For $i = $IndexElement + 1 To $IndexElement + 10 ;check the next 10 elements
        $oButton = _IEFormElementGetCollection($oForm, $i)
        If $oButton.Type = 'submit' Then
         _IEAction($oButton, "click")
         ExitLoop
        EndIf
       Next
      EndIf
      Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)
     EndIf
     $IndexElement += 1
    Next
   EndIf
   $Index += 1
  Next
 EndIf
 Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) ;no password-field found
EndFunc   ;==>_IEAutoLogin

Have fun!

Tell me, if there are any sites you could not log in. Thank you.

Edit: Better version of the script should work on far more websites.

Edited by funkey

Share this post


Link to post
Share on other sites



Posted

thank you for this script but

ı need only user no password inthe site

exam

site

then

send "aaratratarata" enter

like it

this code hospital appointment record

#include <IE.au3>

$Url = 'http://www.fffffffffffffffffffffffff.html

$oIE = _IECreate($Url)

sleep(200)

Send("0000000000000") "user number" ?????

sleep(20)

Send("{ENTER}")thank you help me

Share this post


Link to post
Share on other sites

Posted

New version of my script in post#1.

It should now work on far more websites. Tell me, if there are any sites you could not log in. Thank you.

mesale0077: Without link I can't help you.

Also remember: This is not a general support forum! :D

Share this post


Link to post
Share on other sites

Posted

thank you

Share this post


Link to post
Share on other sites

Posted

slick, i like it.

Share this post


Link to post
Share on other sites

Posted

Kudos!

Share this post


Link to post
Share on other sites

Posted

Very slick! Good job. :D

Share this post


Link to post
Share on other sites

Posted

This is a script for automatic login on websites using the Internet Explorer

#include <IE.au3>

$Url = 'http://www.autoitscript.com/forum/index.php?app=core&module=global&section=login'
$User = 'user'
$Pwd = 'pwd'

$test = _IEAutoLogin($Url, $User, $Pwd)

Func _IEAutoLogin($sUrl, $sUsername, $sPwd)
 ;funkey 09.09.09
 $oIE = _IECreate($sUrl)
 _IEErrorNotify(False)
 _IEErrorHandlerRegister()
 $oForms = _IEFormGetCollection($oIE)
 If @error Then
  Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'
 Else
  $Index = 0
  For $oForm In $oForms
   $oFormElements = _IEFormElementGetCollection($oForm)
   If IsObj($oFormElements) Then
    $IndexElement = 0
    For $oElement In $oFormElements
     If $oElement.Type = 'password' Then
      $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)
      _IEFormElementSetValue($oPwd, $sPwd)
      For $i = $IndexElement - 1 To 0 Step -1
       $oUser = _IEFormElementGetCollection($oForm, $i)
       If $oUser.Type = 'text' Then
        _IEFormElementSetValue($oUser, $sUsername)
        ExitLoop
       EndIf
      Next
      If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then  ;submit
       _IEFormSubmit($oForm, 0)
       _IELoadWait($oIE)
      Else  ;click
       For $i = $IndexElement + 1 To $IndexElement + 10 ;check the next 10 elements
        $oButton = _IEFormElementGetCollection($oForm, $i)
        If $oButton.Type = 'submit' Then
         _IEAction($oButton, "click")
         ExitLoop
        EndIf
       Next
      EndIf
      Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)
     EndIf
     $IndexElement += 1
    Next
   EndIf
   $Index += 1
  Next
 EndIf
 Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) ;no password-field found
EndFunc   ;==>_IEAutoLogin

Have fun!

Tell me, if there are any sites you could not log in. Thank you.

Edit: Better version of the script should work on far more websites.

Nice job... What about a version working with Mozilla Firefox ?

Share this post


Link to post
Share on other sites

Posted (edited)

Nice job... What about a version working with Mozilla Firefox ?

This function here is based on the FireFox version:

http://www.autoitscript.com/forum/index.php?showtopic=102133

Edited by Stilgar

Share this post


Link to post
Share on other sites

Posted (edited)

Very nice.

Any way to configure if a site runs ActiveX?

Thanks

Edited by Cowhead

Share this post


Link to post
Share on other sites

Posted

This function needs a lot of improvement. When I have time I will do it.

@Cowhead : Do you have an url with activex login for testing?

Share this post


Link to post
Share on other sites

Posted

When you do, keep in mind that forms may be contained inside a frame and won't be directly accessible through _IEFormGetCollection.

Share this post


Link to post
Share on other sites

Posted

Thanks man!

That was what I needed. I wanted something like that for our Outlook Webmail for work. All I had to change was the web address and user/password. I prefer Firefox, but this is fine :huh2:

This is a script for automatic login on websites using the Internet Explorer

#include <IE.au3>

$Url = 'http://www.autoitscript.com/forum/index.php?app=core&module=global&section=login'
$User = 'user'
$Pwd = 'pwd'

$test = _IEAutoLogin($Url, $User, $Pwd)

Func _IEAutoLogin($sUrl, $sUsername, $sPwd)
 ;funkey 09.09.09
 $oIE = _IECreate($sUrl)
 _IEErrorNotify(False)
 _IEErrorHandlerRegister()
 $oForms = _IEFormGetCollection($oIE)
 If @error Then
  Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'
 Else
  $Index = 0
  For $oForm In $oForms
   $oFormElements = _IEFormElementGetCollection($oForm)
   If IsObj($oFormElements) Then
    $IndexElement = 0
    For $oElement In $oFormElements
     If $oElement.Type = 'password' Then
      $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)
      _IEFormElementSetValue($oPwd, $sPwd)
      For $i = $IndexElement - 1 To 0 Step -1
       $oUser = _IEFormElementGetCollection($oForm, $i)
       If $oUser.Type = 'text' Then
        _IEFormElementSetValue($oUser, $sUsername)
        ExitLoop
       EndIf
      Next
      If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then  ;submit
       _IEFormSubmit($oForm, 0)
       _IELoadWait($oIE)
      Else  ;click
       For $i = $IndexElement + 1 To $IndexElement + 10 ;check the next 10 elements
        $oButton = _IEFormElementGetCollection($oForm, $i)
        If $oButton.Type = 'submit' Then
         _IEAction($oButton, "click")
         ExitLoop
        EndIf
       Next
      EndIf
      Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)
     EndIf
     $IndexElement += 1
    Next
   EndIf
   $Index += 1
  Next
 EndIf
 Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) ;no password-field found
EndFunc   ;==>_IEAutoLogin

Have fun!

Tell me, if there are any sites you could not log in. Thank you.

Edit: Better version of the script should work on far more websites.

Share this post


Link to post
Share on other sites

Posted

Help Me!

https://id.vnn.vn/login?service=http://tv.vnn.vn/LoginSSO.aspx

Thank

Share this post


Link to post
Share on other sites

Posted

You fail at forums. Go away. Things you've done wrong:
  • Used the report feature in an attempt to post to this thread.
  • You didn't read the rules before posting or you would see that discussion of auto-login methods is not allowed (this thread was created before that rule and hasn't been locked as a result).
  • You revived an old thread.
Thread locked. Now leave and don't come back.

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.