star2 Posted April 30, 2007 Posted April 30, 2007 (edited) when I run my GUI it starts with an input box asking for password and I've set the password and a MsgBox to apear if password entered not correct but I can't just make it go back to the input box to make the user try again using [ OK & Cancel ] MsgBox if anyone can help this is the gui #include <GUIConstants.au3> GUICreate("test", 300, 250) GUISetFont(12) $pass = InputBox ("enter password", "please enter your password","","!",150,80) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $pass <> "my-pass" Then MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?") EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData () WEnd Func SendMyData() FileDelete('test.inf') $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) FileWrite('\test.inf', $data) MsgBox(0,'Info','Data written to test.inf') EndFunc Edited April 30, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]
Generator Posted April 30, 2007 Posted April 30, 2007 expandcollapse popup#include <GUIConstants.au3> Do $pass = InputBox ("enter password", "please enter your password","","*",150,80) If $pass<>"my-pass"Then $msgbox=MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?") If $msgbox=2 Then Exit EndIf EndIf Until $pass="my-pass" GUICreate("test", 300, 250) GUISetFont(12) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData () WEnd Func SendMyData() FileDelete('test.inf') $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) FileWrite('\test.inf', $data) MsgBox(0,'Info','Data written to test.inf') EndFunc Not Tested.
Dickb Posted April 30, 2007 Posted April 30, 2007 Is this maybe what you are looking for? #include <GUIConstants.au3> Do $pass = InputBox ("enter password", "please enter your password","","!",150,80) If $pass <> "my-pass" Then MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?") EndIf Until $pass == "my-pass" GUICreate("test", 300, 250) GUISetFont(12) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData () WEnd Func SendMyData() FileDelete('test.inf') $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) FileWrite('\test.inf', $data) MsgBox(0,'Info','Data written to test.inf') EndFunc
smashly Posted April 30, 2007 Posted April 30, 2007 expandcollapse popup#include <GUIConstants.au3> GUICreate("test", 300, 250) GUISetFont(12) $pass = InputBox ("enter password", "please enter your password","","!",150,80) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $pass <> "my-pass" Then $WrongPass = MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?") If $WrongPass = 1 Then $pass = InputBox ("enter password", "please enter your password","","!",150,80) ElseIf $WrongPass = 2 Then $Exting = MsgBox (0,"Exiting" , "Due to cancelation by user.." & @CRLF & "Now exiting test.") ExitLoop EndIf EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData () WEnd Func SendMyData() FileDelete('test.inf') $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) FileWrite('\test.inf', $data) MsgBox(0,'Info','Data written to test.inf') EndFunc
star2 Posted April 30, 2007 Author Posted April 30, 2007 Generator Dickb smashly thanks alot this is what I've beedn looking for thanks again [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]
enaiman Posted May 2, 2007 Posted May 2, 2007 I guess this is working fine if you dont' need a case-sensitive password. If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check. (case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... ) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
star2 Posted May 5, 2007 Author Posted May 5, 2007 I guess this is working fine if you dont' need a case-sensitive password.If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check.(case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... )thanks didn't try it yet but I will soonthank you [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]
arejae Posted July 20, 2008 Posted July 20, 2008 thanks for scripts. muttley additionally, i just add one line to trigger CANCEL button. $pass = InputBox ("enter password", "please enter your password","","*",150,80) if (@Error == 1) Then Exit ; *** new line added
TerarinKerowyn Posted July 21, 2008 Posted July 21, 2008 If you want a true password you use Encryption/Decryption on the input box while keeping it in RAM and never entering the real password decrypt onto the hard drive. Lookup _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1]) Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah
BrettF Posted July 21, 2008 Posted July 21, 2008 (edited) If you want a true password you use Encryption/Decryption on the input box while keeping it in RAM and never entering the real password decrypt onto the hard drive. Lookup _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])Look at the other 'more secure' examples, floating around the forum. There is MD5, SHA1, blowfish... Its all there muttley EDIT: Oh! And did I mention that this was a wonderful bump of an old topic? Edited July 21, 2008 by Bert 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!
mmavipc Posted July 21, 2008 Posted July 21, 2008 I guess this is working fine if you dont' need a case-sensitive password.If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check.(case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... muttley )You could just use == [size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N
enaiman Posted July 21, 2008 Posted July 21, 2008 You could just use ==Good point muttleyThanks SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
ProgrammerKid Posted November 30, 2011 Posted November 30, 2011 But I have 1 question: Can you insert more passwords?
water Posted November 30, 2011 Posted November 30, 2011 Wunderful bump. The last post in this thread is over 3 years old And no. The script as it now is can only save one password because it deletes the file before saving. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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