Jump to content

Recommended Posts

Posted

I am trying to set up so that I can do a lookup via HTTP on an email address if that email address exists I would then like to proceed to the create a password

Also I would like to make it so that if this has been done previously that it will not ask again for 90 days

I am currently using a basic local password as shown below. Does anyone have any suggestions?

Password()

Func Password()

Local $Password, $Password_Check, $times, $uname

$times = 3

$Password_Check = "Test!"

$current = @UserName

while $times > 0

$uname = InputBox("Username", "Please enter your username.")

If @error = 1 then exit

$Password = InputBox("Security Check", "Enter your password.", "", "*")

If @error = 1 then exit

If $current = $uname Then

If $Password_Check = $Password Then

MsgBox(0, "Correct Password", "You have entered the correct password!")

;Put in the function to go to when adding in your script.

$times = 0 ;delete this line when adding to main script.

EndIf

If $Password_Check <> $Password Then

MsgBox(0, "Invalid password", "You have entered the wrong password. Remaining tries: " & $times)

$times = $times - 1

EndIf

EndIf

If $current <> $uname Then

MsgBox(0, "Invalid username", "You have entered the wrong username. Remaining tries: " & $times)

$times = $times - 1

EndIf

WEnd

EndFunc

MsgBox(0, "THE END", "End of script") ;comment this out when adding to script, used for testing purposes.

Exit

Posted

Just one page back someone asked something like this:

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

Manadar,

Thank you I am going in the right direction now!

First off I must say that I am not (yet) a programmer, so Autoit is a great teaching tool, I am learning much from the Help file and the Forum you have simplified things so that anyone can use it and be productive.

So I have made a login script that allows me to log into a web site. What I want to do is if a person can effectively log in then and have an active session then the script can continue if it cant then the script will exit

Below is the code, I was wondering if you might be able to tell me what I am doing wrong or a better way to do it? Currently my Dialog box comes up I enter my user name and then password it goes to the url and logs in then quits on me.

;Begin Script

#include <IE.au3>

Local $User, $Url, $Pwd, $session, $msg

$User = InputBox("Question", "UserID?", "JohnDoe@Gmail.com", "", -1, -1, 0, 0)

$Url = 'www.gmail.com'

$Pwd = InputBox("Password", "Enter your password.", "", "*")

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

Goes to URL opens user input box then password

Func _IEAutoLogin($sUrl, $sUsername, $sPwd)

$oIE = _IECreate($sUrl)

_IEErrorNotify(False)

_IEErrorHandlerRegister()

$oForms = _IEFormGetCollection($oIE)

If @error Then

Return SetError(1, _IEErrorHandlerDeRegister(), $oIE)

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

_IEFormSubmit($oForm, 0)

_IELoadWait($oIE)

Else

For $i = $IndexElement + 1 To $IndexElement + 10

$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)

$session = InetGet("http://mail.google.com/mail/?ui=2&shva=1#")

If $session = 0 Then Exit

EndFunc

Exit

It would then continue to my next segment

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
×
×
  • Create New...