Sign in to follow this  
Followers 0
youknowwho4eva

simple login

10 posts in this topic

I'm trying to create a simple log in. I'm going to change the user name to a drop down when I get it working, but right now I can't get it to say which account its logging into, it errors at the msgbox. I would also like for when you type the password for it to replace the text with * if thats simple, if not then I'm not to worried about it.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

GUICreate("Log In", 500, 200) 

GUICtrlCreateLabel("User Name", 10, 10)
$user = GUICtrlCreateInput("", 150, 10, 150, 20)
GUICtrlCreateLabel("Password", 10, 30)
$password = GUICtrlCreateInput("", 150, 30, 150, 20)

$ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()
  Select
      Case $msg = $acessbutton
        If guictrlread($user) = "Michael Williams" And GUICtrlRead($Password) = "password" Then
          MsgBox(0, "Logging in to power user account")
          Exit
        Else
          MsgBox(0, "Logging in to user account")
          Exit
          EndIf
    Case $msg = $GUI_EVENT_CLOSE
          MsgBox(0, "Exit", "Closing, you will not be logged in")
      ExitLoop
  EndSelect
WEnd

Giggity

Share this post


Link to post
Share on other sites



Not sure if this is a typo in your reproducer but your msgbox has the wrong # of arguments... needs to be, MsgBox(0, "TITLE", "TEXT")


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

I'm trying to create a simple log in. I'm going to change the user name to a drop down when I get it working, but right now I can't get it to say which account its logging into, it errors at the msgbox. I would also like for when you type the password for it to replace the text with * if thats simple, if not then I'm not to worried about it.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

GUICreate("Log In", 500, 200) 

GUICtrlCreateLabel("User Name", 10, 10)
$user = GUICtrlCreateInput("", 150, 10, 150, 20)
GUICtrlCreateLabel("Password", 10, 30)
$password = GUICtrlCreateInput("", 150, 30, 150, 20)

$ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()
  Select
      Case $msg = $acessbutton
        If guictrlread($user) = "Michael Williams" And GUICtrlRead($Password) = "password" Then
          MsgBox(0, "Logging in to power user account")
          Exit
        Else
          MsgBox(0, "Logging in to user account")
          Exit
          EndIf
    Case $msg = $GUI_EVENT_CLOSE
          MsgBox(0, "Exit", "Closing, you will not be logged in")
      ExitLoop
  EndSelect
WEnd
Look at GuiControlCreateInput about $ES_PASSWORD style.

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you both much. If I weren't so new at this I'd smack myself in the head for the typo being the reason thats not working. And Andreik, thank you I did not see that before. Now I'm trying to get it to login when you hit the enter hey. I've looked up different methods but can't get them to work for me. Here is what I have now, any suggestions?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
#include <EditConstants.au3>


GUICreate("Log In", 500, 200) 

GUICtrlCreateLabel("User Name", 10, 10)
$user = GUICtrlCreateInput("", 150, 10, 150, 20)
GUICtrlCreateLabel("Password", 10, 30)
$password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD)

$ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60)
GUISetState(@SW_SHOW)


 
While 1
  $msg = GUIGetMsg()
  Select
      Case $msg = $acessbutton
        If GUICtrlRead($Password) = "password" Then
            MsgBox(0, "Access Granted", "Logging in to power user account")
            Exit
        Else
          MsgBox(0, "Access Granted", "Logging in to user account")
          Exit
          EndIf
    Case $msg = $GUI_EVENT_CLOSE
          MsgBox(0, "Exit", "Closing, you will not be logged in")
      ExitLoop
  EndSelect
WEnd

of course after looking all day, I post this and 5 minutes later find my answer.

Edited by youknowwho4eva

Giggity

Share this post


Link to post
Share on other sites

Alright one last thing I would like to add to this script, and I know this one is a leap above my abilities. So far you alls help has progressed me in leaps and bounds but this one makes my eye twinge trying to figure it out (too much cafine this morning) As you can see I added two acceptable passwords to get into the two different levels of the system. I also added an incorrect password message. I want it, if the password is incorrectly entered 3 times, to close the program. I've seen some stuff on how to have it add stuff like that, but like I said, my eye twitches while trying to wrap my brain around it right now. I think I'll also have it make an ini so I can find out who forgot their password or who is trying to access it uninvited.

Here is what I have as of now, after this I can move on to my next step and find more questions for you all :-P

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>


GUICreate("Log In", 500, 200) 

GUICtrlCreateLabel("User Name", 10, 10)
$user = GUICtrlCreateInput("", 150, 10, 150, 20)
GUICtrlCreateLabel("Password", 10, 30)
$password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD)

$ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60, "", $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)


While 1
  $msg = GUIGetMsg()
  Select
      Case $msg = $acessbutton
        If GUICtrlRead($Password) = "password" Then
            MsgBox(0, "Access Granted", "Logging in to power user account")
            Exit
        ElseIf GUICtrlRead($Password) = "user123" Then
          MsgBox(0, "Access Granted", "Logging in to user account")
          Exit
      Else
          MsgBox(0, "Access Denied", "Incorrect Passowrd")
          EndIf
    Case $msg = $GUI_EVENT_CLOSE
          MsgBox(0, "Exit", "Closing, you will not be logged in")
      ExitLoop
      EndSelect
WEnd

Giggity

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If I have some more time I'll post an example, but its really just nesting If statements. Obviously this isn't correct, but should help;

If GUICtrlRead($Password) = "password" Then
            $var = MsgBox(0, "Access Granted", "Logging in to power user account")
            If $var = "your password" ;whatever return value Then
                ; right
            Else
                ;wrong
                ;do msgbox again
Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Alright one last thing I would like to add to this script, and I know this one is a leap above my abilities. So far you alls help has progressed me in leaps and bounds but this one makes my eye twinge trying to figure it out (too much cafine this morning) As you can see I added two acceptable passwords to get into the two different levels of the system. I also added an incorrect password message. I want it, if the password is incorrectly entered 3 times, to close the program. I've seen some stuff on how to have it add stuff like that, but like I said, my eye twitches while trying to wrap my brain around it right now. I think I'll also have it make an ini so I can find out who forgot their password or who is trying to access it uninvited.

Here is what I have as of now, after this I can move on to my next step and find more questions for you all :-P

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>


GUICreate("Log In", 500, 200) 

GUICtrlCreateLabel("User Name", 10, 10)
$user = GUICtrlCreateInput("", 150, 10, 150, 20)
GUICtrlCreateLabel("Password", 10, 30)
$password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD)

$ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60, "", $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)


While 1
  $msg = GUIGetMsg()
  Select
      Case $msg = $acessbutton
        If GUICtrlRead($Password) = "password" Then
            MsgBox(0, "Access Granted", "Logging in to power user account")
            Exit
        ElseIf GUICtrlRead($Password) = "user123" Then
          MsgBox(0, "Access Granted", "Logging in to user account")
          Exit
      Else
          MsgBox(0, "Access Denied", "Incorrect Passowrd")
          EndIf
    Case $msg = $GUI_EVENT_CLOSE
          MsgBox(0, "Exit", "Closing, you will not be logged in")
      ExitLoop
      EndSelect
WEnd

i have a nice TCP login if you want.

Share this post


Link to post
Share on other sites

Sure, Whats a TCP Login?

And for "someone" I used $error = 0 then I used

If GUICtrlRead($user) = "Michael Williams" Then

If GUICtrlRead($Password) = "password" Then

MsgBox(0, "Access Granted", "Logging in to power user account")

#include <power.au3>

Exit

Else

MsgBox(0, "Access Denied", "Incorrect Passowrd")

>notice here, it adds one then if it equals 3 it closes the program :-D $error += 1

If $error = 3 Then

MsgBox(0, "Failed Login", "Incorrect Password entered 3 times event being logged exiting program")

ExitLoop

EndIf

EndIf

EndIf

Wasnt as difficult as I first though/made it.


Giggity

Share this post


Link to post
Share on other sites

Hi this is very very cool muttley

But i want to get when i push button log in to get navigate to some link. Look that one i find on page to .

When u type in window username and password and click log in u will be navigate to webpage and this username and password will be insert into login form.

I copy some code from page look it: (pleas help me)

This code will help u!

#include <IE.au3>

$sURL = "www.nexopia.com"
$sUserName = "Username"
$sPassword = "Password"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oFrame = _IEFrameGetCollection($oIE, 1)
_IELoadWait($oFrame)
$oForm = _IEFormGetObjByName($oFrame, "login")
$oUserName = _IEFormElementGetObjByName($oForm, "username")
$oPassword = _IEFormElementGetObjByName($oForm, "password")

_IEFormElementSetValue($oUserName, $sUserName)
_IEFormElementSetValue($oPassword, $sPassword)

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