AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How To Create A Login Box?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
flashmaniac
Guest





PostPosted: Fri Dec 14, 2007 5:05 am    Post subject: How To Create A Login Box? Reply with quote

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






PostPosted: Fri Dec 14, 2007 12:25 pm    Post subject: Reply with quote

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

PostPosted: Fri Dec 14, 2007 2:31 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
leggah



Joined: 14 Oct 2007
Posts: 44

PostPosted: Fri Dec 14, 2007 3:16 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Mkbailey755



Joined: 20 Aug 2007
Posts: 178

PostPosted: Fri Dec 14, 2007 6:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dra_Gon



Joined: 25 May 2007
Posts: 316

PostPosted: Fri Dec 14, 2007 7:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
phfjeld



Joined: 05 Nov 2006
Posts: 46
Location: Norway

PostPosted: Sat Dec 15, 2007 8:10 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
flashmaniac
Guest





PostPosted: Sat Dec 15, 2007 9:34 am    Post subject: Cool. Reply with quote

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





PostPosted: Fri Mar 28, 2008 10:45 pm    Post subject: Reply with quote

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 Embarassed
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group