 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
flashmaniac Guest
|
Posted: Fri Dec 14, 2007 5:05 am Post subject: How To Create A Login Box? |
|
|
Hello All, Im Looking For A Way To Make A Login Box.
So When You Press Example:
Windows+ F3
It Asks For A Password And Username In A GUI Box And If The Password And Username Is Correct It Continues With Whatever You Are Doing?
How Would I Do This? |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Dec 14, 2007 12:25 pm Post subject: |
|
|
Read about...
inputbox or
gui,guicontrolget (or gui, submit),controlassociated variables
if and else |
|
| Back to top |
|
 |
phfjeld
Joined: 05 Nov 2006 Posts: 46 Location: Norway
|
Posted: Fri Dec 14, 2007 2:31 pm Post subject: |
|
|
You want to do something like this.
| Code: | ; Correct username and password.
cUsername = admin
cPassword = crashtestdummy
; Take user input.
InputBox, uUsername, Enter username, Please enter a valid username:, , 220, 120
InputBox, uPassword, Enter password, Please enter the users associated password:, Hide, 300, 120
; Basic logic.
If(uUsername == cUsername && uPassword == cPassword) ; == is case sensitive, = is case insensitive.
MsgBox, You are now logged in %uUsername%.
Else
MsgBox, You entered an invalid username and/or password. |
You should further look up topics on GUI, logic and cryptography. |
|
| Back to top |
|
 |
leggah
Joined: 14 Oct 2007 Posts: 44
|
Posted: Fri Dec 14, 2007 3:16 pm Post subject: |
|
|
| Indeed, but that input box would not be persistent. The user could simply ignore the inputbox and continue whatever he/she was doing. However, that is the basic logic behind it. |
|
| Back to top |
|
 |
Mkbailey755
Joined: 20 Aug 2007 Posts: 178
|
Posted: Fri Dec 14, 2007 6:06 pm Post subject: |
|
|
one problem though if you enter the wrong password it will continue running the of the script how about a go sub | Code: |
cUsername = admin
cPassword = crashtestdummy
; Take user input.
PWreturn:
InputBox, uUsername, Enter username, Please enter a valid username:, , 220, 120
InputBox, uPassword, Enter password, Please enter the users associated password:, Hide, 300, 120
; Basic logic.
If (uUsername == cUsername && uPassword == cPassword) ; == is case sensitive, = is case insensitive.
MsgBox, You are now logged in %uUsername%.
Else
{
MsgBox, You entered an invalid username and/or password
gosub,PWreturn
}
Run, mailto:test@test?subject=Mail subject&body=whatever , test2 :>
|
|
|
| Back to top |
|
 |
Dra_Gon
Joined: 25 May 2007 Posts: 316
|
Posted: Fri Dec 14, 2007 7:25 pm Post subject: |
|
|
You can also make it so it exits after a certain amount of attempts:
| Code: |
cUsername = admin
cPassword = crashtestdummy
nAttempt = 1 ; <--Sets the number of attempts
; Take user input.
PWreturn:
InputBox, uUsername, Enter username, Please enter a valid username:, , 220, 120
InputBox, uPassword, Enter password, Please enter the users associated password:, Hide, 300, 120
nAttempt += 1 ; <-- Adds 1 to nAttempt
if (nAttempt = 3)
exitapp
; Basic logic.
If (uUsername == cUsername && uPassword == cPassword) ; == is case sensitive, = is case insensitive.
MsgBox, You are now logged in %uUsername%.
Else
{
MsgBox, You entered an invalid username and/or password
gosub,PWreturn
}
Run, mailto:test@test?subject=Mail subject&body=whatever , test2 :>
|
You'll also, maybe, want a way to change the password. But then you'd need to keep it in a separate file and encrypted so only your program can decrypt it and see if the entered username/password match.
Dra'Gon _________________
For a good laugh {hopefully} >> megamatts.50megs.com
My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/ |
|
| Back to top |
|
 |
phfjeld
Joined: 05 Nov 2006 Posts: 46 Location: Norway
|
Posted: Sat Dec 15, 2007 8:10 am Post subject: |
|
|
My example was supplied to give the threadstarter a rough idea on how to do this, not to give him a perfect login system (does that even exist?).
If threadstarter (or anyone else) would like they can send me a PM and I'll hand 'em some real code. |
|
| Back to top |
|
 |
flashmaniac Guest
|
Posted: Sat Dec 15, 2007 9:34 am Post subject: Cool. |
|
|
| phfjeld wrote: | You want to do something like this.
| Code: | ; Correct username and password.
cUsername = admin
cPassword = crashtestdummy
; Take user input.
InputBox, uUsername, Enter username, Please enter a valid username:, , 220, 120
InputBox, uPassword, Enter password, Please enter the users associated password:, Hide, 300, 120
; Basic logic.
If(uUsername == cUsername && uPassword == cPassword) ; == is case sensitive, = is case insensitive.
MsgBox, You are now logged in %uUsername%.
Else
MsgBox, You entered an invalid username and/or password. |
You should further look up topics on GUI, logic and cryptography. |
This Is A Good Script... Thanks. Please Help More Though, Im A Newbie |
|
| Back to top |
|
 |
keroro Guest
|
Posted: Fri Mar 28, 2008 10:45 pm Post subject: |
|
|
hello,
I'm new to scripting, forgive me if I'm being stupid.
I'm trying to set up a hotkey to ask for user name and password. store it in memory, and can paste that information with an hotkey.
can someone give me a few pointers? or maybe a sample of the script if it is not too much trouble?
thanks  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|