Jump to content
Sign in to follow this  
Didonet

check the username and the password are filled

Recommended Posts

Didonet

I'm making one form and I want to check are the filled

This is my script for now

While 1
                If $username <> "" or $password <> "" Then
                RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "uname", "REG_SZ", encrypt(1, $username))
                RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "passwd", "REG_SZ", encrypt(1, $password))
                ExitLoop
                EndIf
                If $username = "" or $password = "" Then
                MsgBox(0, "Info", "Please enter username and password!")
                EndIf
            WEnd

But if the user or pass are empty the message shows up and it don't want to hide...

how to hide the message and start again the While?

Share this post


Link to post
Share on other sites
dbzfanatic

Use a loop.

While 1
    Do
        If $username = "" or $password = "" Then
            MsgBox(0, "Info", "Please enter username and password!")
        EndIf
    Until $username <> "" And $password <> ""
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "uname", "REG_SZ", encrypt(1, $username))
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "passwd", "REG_SZ", encrypt(1, $password))
    ExitLoop
WEnd

and I cleaned up your code a bit too.

Edited by dbzfanatic

Share this post


Link to post
Share on other sites
Didonet

No, the msg is still looping...

Share this post


Link to post
Share on other sites
Danny35d

No, the msg is still looping...

You need to add the inputbox asking for username and password inside the While loop, so when the username or password is blank you have the chance the reenter username and password again.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites
dbzfanatic

lol wow i need sleep, i did something like that not more than 3 weeks ago and did the inputbox thing and everything...he's right, just do something like

While 1
do
if $username = "" then
$username = Inputbox("Username", "Input the username: ")
endif
until $username <> ""
do
if $password = "" then
$password = Inputbox("Password", "Input the password: ", "", "*")
endif
until $password <> ""
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "uname", "REG_SZ", encrypt(1, $username))
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CTLogin", "passwd", "REG_SZ", encrypt(1, $password))
    ExitLoop
WEnd

something like that

Edited by dbzfanatic

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  

×