Jump to content
Sign in to follow this  
Jussip

Password Dialog

Recommended Posts

Jussip

Hey, im new at autoit, and i need bit help.

How i can set a password, if you type it wrong, it send msg like "Wrong password",

and if i type it right it sends "Right Password"?

This is the script:

#include <GUIConstants.au3>

$Form1 = GUICreate("Enter Password", 283, 112, -1, -1)

GUISetIcon("D:\008.ico")

$PasswordEdit = GUICtrlCreateInput("password", 9, 34, 251, 22, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))

$ButtonOk = GUICtrlCreateButton("&OK", 93, 69, 80, 27, 0)

$ButtonCancel = GUICtrlCreateButton("&Cancel", 180, 69, 81, 27, 0)

$EnterPassLabel = GUICtrlCreateLabel("Enter password ", 9, 13, 93, 18, BitOR($SS_CENTERIMAGE,$SS_RIGHTJUST))

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Share this post


Link to post
Share on other sites
Andreik

Hey, im new at autoit, and i need bit help.

How i can set a password, if you type it wrong, it send msg like "Wrong password",

and if i type it right it sends "Right Password"?

This is the script:

#include <GUIConstants.au3>

$Form1 = GUICreate("Enter Password", 283, 112, -1, -1)

GUISetIcon("D:\008.ico")

$PasswordEdit = GUICtrlCreateInput("password", 9, 34, 251, 22, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))

$ButtonOk = GUICtrlCreateButton("&OK", 93, 69, 80, 27, 0)

$ButtonCancel = GUICtrlCreateButton("&Cancel", 180, 69, 81, 27, 0)

$EnterPassLabel = GUICtrlCreateLabel("Enter password ", 9, 13, 93, 18, BitOR($SS_CENTERIMAGE,$SS_RIGHTJUST))

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Try this:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Enter Password", 283, 112, -1, -1)
$PasswordEdit = GUICtrlCreateInput("password", 9, 34, 251, 22, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$ButtonOk = GUICtrlCreateButton("&OK", 93, 69, 80, 27, 0)
$ButtonCancel = GUICtrlCreateButton("&Cancel", 180, 69, 81, 27, 0)
$EnterPassLabel = GUICtrlCreateLabel("Enter password ", 9, 13, 93, 18, BitOR($SS_CENTERIMAGE,$SS_RIGHTJUST))
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $ButtonOk
        If GUICtrlRead($PasswordEdit) = "password" Then
            MsgBox(0,"","Correct password")
        Else
            MsgBox(0,"","Wrong password")
            Exit
        EndIf
    Case $ButtonCancel
        Exit
    Case $GUI_EVENT_CLOSE
        Exit
EndSwitch
WEnd

When the words fail... music speaks

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.