Spaldy Posted July 25, 2008 Share Posted July 25, 2008 (edited) Hey I can't seem to get my edit box to use the $ES_PASSWORD style however the additional style ($ES_CENTER) does work and i can't figure out how to get the password style to work but i got it right because the center works so i'm confused and need some help Opt("GUIOnEventMode", 1); Change to OnEvent mode $mainwindow = GUICreate("Password Please", 200, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton = GUICtrlCreateButton("Check Password", 50, 100, 100, 30) GUICtrlSetOnEvent($okbutton, "Checkpassword") $Edit = GUICtrlCreateEdit(""& @CRLF, 25, 20, 150, 60,$ES_PASSWORD+$ES_CENTER) GUISetState(@SW_SHOW) While 1 Sleep(2000); Idle around WEnd Func Checkpassword() GUICtrlRead($Edit) $Password = "password";Note: could make password anything here If GUICtrlRead($Edit) = $Password Then;password is correct ;Note: at this point @GUI_CtrlId would equal $okbutton, ;And @GUI_WinHandle would equal $mainwindow ;Note: option to put other func here Exit Else;Pasword is incorrect ;Note: option to put other func here MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2) EndIf EndFunc Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $mainwindow Exit EndFunc Sorry if it's a bit messy but i only started using Autoit a month ago Edited July 25, 2008 by Spaldy Why is it that Poilitics is made up of the word poli meaning many and tics being blood sucking creatures? Link to comment Share on other sites More sharing options...
Andreik Posted July 25, 2008 Share Posted July 25, 2008 Hey I can't seem to get my edit box to use the $ES_PASSWORD style however the additional style ($ES_CENTER) does work and i can't figure out how to get the password style to work but i got it right because the center works so i'm confused and need some help Opt("GUIOnEventMode", 1); Change to OnEvent mode $mainwindow = GUICreate("Password Please", 200, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton = GUICtrlCreateButton("Check Password", 50, 100, 100, 30) GUICtrlSetOnEvent($okbutton, "Checkpassword") $Edit = GUICtrlCreateEdit(""& @CRLF, 25, 20, 150, 60,$ES_PASSWORD+$ES_CENTER) GUISetState(@SW_SHOW) While 1 Sleep(2000); Idle around WEnd Func Checkpassword() GUICtrlRead($Edit) $Password = "password";Note: could make password anything here If GUICtrlRead($Edit) = $Password Then;password is correct ;Note: at this point @GUI_CtrlId would equal $okbutton, ;And @GUI_WinHandle would equal $mainwindow ;Note: option to put other func here Exit Else;Pasword is incorrect ;Note: option to put other func here MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2) EndIf EndFunc Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $mainwindow Exit EndFunc Sorry if it's a bit messy but i only started using Autoit a month ago #include <EditConstants.au3> or $ES_PASSWORD = 0x0020 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Andreik Posted July 25, 2008 Share Posted July 25, 2008 I changed some things #include <EditConstants.au3> #include <GUIConstantsEx.au3> $mainwindow = GUICreate("Password Please", 200, 110) $okbutton = GUICtrlCreateButton("Check Password", 50, 70, 100, 30) $INPUT = GUICtrlCreateInput("", 25, 20, 150, 20,BitOR($ES_PASSWORD,$ES_CENTER)) GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Select Case $MSG = $okbutton Checkpassword() Case $MSG = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func Checkpassword() GUICtrlRead($INPUT) $Password = "password";Note: could make password anything here If GUICtrlRead($INPUT) = $Password Then;password is correct MsgBox(0,"Check Password","Correct password") ;Note: at this point @GUI_CtrlId would equal $okbutton, ;And @GUI_WinHandle would equal $mainwindow ;Note: option to put other func here Exit Else;Pasword is incorrect ;Note: option to put other func here MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2) EndIf EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Spaldy Posted July 25, 2008 Author Share Posted July 25, 2008 Hey thanks but that still doesn't get the Edit to replace characters to an asterix (*) it just changes the edit to a Input but it works and you can't argue with results! Why is it that Poilitics is made up of the word poli meaning many and tics being blood sucking creatures? Link to comment Share on other sites More sharing options...
Andreik Posted July 25, 2008 Share Posted July 25, 2008 (edited) Hey thanks but that still doesn't get the Edit to replace characters to an asterix (*) it just changes the edit to a Input but it works and you can't argue with results!I run the script from post#3 Edited July 25, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
BrettF Posted July 25, 2008 Share Posted July 25, 2008 $ES_MULTILINE does not appear to be compatible with $ES_PASSWORD. I can't see a reason why you need a password protected edit box..... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
rasim Posted July 25, 2008 Share Posted July 25, 2008 SpaldyUse GuiEdit.au3 UDFexpandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode $mainwindow = GUICreate("Password Please", 200, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $okbutton = GUICtrlCreateButton("Check Password", 50, 100, 100, 30) GUICtrlSetOnEvent($okbutton, "Checkpassword") $hEdit = _GUICtrlEdit_Create($mainwindow, "", 25, 20, 150, 60, BitOR($ES_PASSWORD, $ES_CENTER)) GUISetState(@SW_SHOW) While 1 Sleep(2000); Idle around WEnd Func Checkpassword() $EditText = _GUICtrlEdit_GetText($hEdit) ConsoleWrite("!> Edit text: " & $EditText & @LF) $Password = "password";Note: could make password anything here If $EditText = $Password Then;password is correct ;Note: at this point @GUI_CtrlId would equal $okbutton, ;And @GUI_WinHandle would equal $mainwindow ;Note: option to put other func here Exit Else;Pasword is incorrect ;Note: option to put other func here MsgBox(48,"Oops!", "Wrong Password! Try Again...", 2) EndIf EndFunc Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $mainwindow Exit EndFunc Link to comment Share on other sites More sharing options...
Spaldy Posted July 26, 2008 Author Share Posted July 26, 2008 Thanks for all the help I can't see a reason why you need a password protected edit box.....this is just a small addition to a larger project of mine and i needed to add security to it Why is it that Poilitics is made up of the word poli meaning many and tics being blood sucking creatures? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now