Jump to content

check the username and the password are filled


Didonet
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...