AlmarM Posted November 15, 2007 Share Posted November 15, 2007 (edited) expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("Password Generator", 350, 255, -1, -1) $Label_1 = GUICtrlCreateLabel("Generated Password:", 10, 10, 130, 15) $Input_1 = GUICtrlCreateInput("", 10, 30, 100, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Button_1 = GUICtrlCreateButton("Generate Pass", 10, 61, 90, 30) $Button_2 = GUICtrlCreateButton("Clear", 100, 61, 40, 30) $Button_3 = GUICtrlCreateButton("Copy", 140, 61, 40, 30) $Credits = GUICtrlCreateButton("Credits", 120, 28, 60, 24) $Label_2 = GUICtrlCreateLabel("How many chars sould the password be?", 10, 95, 170, 30) $Input_2 = GUICtrlCreateInput("7", 10, 130, 170, 20) $Edit_1 = GUICtrlCreateEdit("", 190, 30, 150, 185, BitOR($ES_AUTOVSCROLL, $ES_READONLY)) $Label_3 = GUICtrlCreateLabel("History:", 190, 10, 50, 15) $Label_4 = GUICtrlCreateLabel("Include this special chars:", 10, 155) $Checkbox_1 = GUICtrlCreateCheckbox("!", 10, 170) $Checkbox_2 = GUICtrlCreateCheckbox("@", 10, 190) $Checkbox_3 = GUICtrlCreateCheckbox("#", 10, 210) $Checkbox_4 = GUICtrlCreateCheckbox("$", 10, 230) $Checkbox_5 = GUICtrlCreateCheckbox("%", 50, 170) $Checkbox_6 = GUICtrlCreateCheckbox("*", 50, 190) $Checkbox_7 = GUICtrlCreateCheckbox("(", 50, 210) $Checkbox_8 = GUICtrlCreateCheckbox(")", 50, 230) $Checkbox_9 = GUICtrlCreateCheckbox("-", 90, 170) $Checkbox_10 = GUICtrlCreateCheckbox("=", 90, 190) $Checkbox_11 = GUICtrlCreateCheckbox("+", 90, 210) $Checkbox_12 = GUICtrlCreateCheckbox("[", 90, 230) $Checkbox_13 = GUICtrlCreateCheckbox("]", 130, 170) $Checkbox_14 = GUICtrlCreateCheckbox("\", 130, 190) $Checkbox_15 = GUICtrlCreateCheckbox("/", 130, 210) $Checkbox_16 = GUICtrlCreateCheckbox("?", 130, 230) $Button_4 = GUICtrlCreateButton("Save History", 190, 221, 151) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button_1 $Read_Char = GUICtrlRead($Input_2) _Randomize($Read_Char) GUICtrlSetData($Edit_1, _Randomize($Read_Char) & @CRLF, "|") Case $nMsg = $Button_2 $Check_Yes_No = MsgBox(4, "Clear", "Really clear History?") If $Check_Yes_No = 6 Then GUICtrlSetData($Edit_1, "", "") EndIf Case $nMsg = $Button_3 $READ = GUICtrlRead($Input_1) ClipPut($READ) Case $nMsg = $Credits _Credits() Case $nMsg = $Button_4 $EDIT_READ = GUICtrlRead($Edit_1) IniWriteSection(@ScriptDir & "\History.ini", "History", $EDIT_READ) MsgBox(64, "Saved", "History has been saved at: " & @ScriptDir & "\History.ini") EndSelect WEnd Func _Randomize($Length) $AddSpecial = "" $SpecialChars = StringSplit("!@#$%*()-=+[]\/?", "") For $X = 1 to $specialChars[0] If GUICtrlRead(Eval("Checkbox_" & $X)) = 1 Then $AddSpecial &= $SpecialChars[$X] EndIf Next $Array = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" & $AddSpecial,"") $Pass = "" For $X = 1 to $Length $Pass &= $Array[Random (1, $Array[0], 1)] Next GUICtrlSetData($Input_1, $Pass) Return $Pass EndFunc Func _Credits() GUISetState(@SW_HIDE, $GUI) $AboutWindow = GUICreate("Credits", 250, 200) $ProgramName = GUICtrlCreateLabel("Password Generator", 85, 26) $ProgramDescription = GUICtrlCreateEdit("Credits:" & @CRLF & @CRLF & "Scripter: AlmarM" & @CRLF & "Idea: AlmarM" & @CRLF & "Small Example: Creator" & @CRLF & "Small Example: weaponx" & @CRLF & "Something I didn't knew: ashley", 20, 60, 210, 126, BitOR($ES_READONLY, $ES_WANTRETURN)) GUISetState(@SW_SHOW) While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($AboutWindow) GUISetState(@SW_SHOW, $GUI) EndFuncEDIT:Updated Script -Added Copy ButtonEDIT:Updated Script -Added Clear ButtonEDIT:Updated Script -Added Custom Length PartAdded Credits on TopicCredits:ashley - I didn't knew the BitOR()weaponx - For the _Randomize($Length)IDEA You will see what it was if its done ^^EDIT:Added IDEA.Updated script EDIT:Updated Script -Added HistoryEDIT:Updated ScriptAdded Special Char Check boxesCredit to: CreatorEDIT:Updated Script -Added Clear History Button.EDIT:Updated Script -Added Credits Button and GUIEDIT:Updated Script -Edited _Randomize($Length)EDIT:Updated Script -Added Save History Button. Edited November 18, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
sandman Posted November 15, 2007 Share Posted November 15, 2007 Cool idea, why not make a feature to generate an entire password at once, after asking the user for the number of characters they want? [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
AlmarM Posted November 15, 2007 Author Share Posted November 15, 2007 I can do that but can u PM me and help with it. Because I tought if you want a 7 char pass I need to make 7 times the $Pass1 $Pass2. And I'll Update my script (Added Copy Button) Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
weaponx Posted November 15, 2007 Share Posted November 15, 2007 Your _Randomize function is more complex than it needs to be: MsgBox(0,"", genPassword(8)) Func genPassword($length) $array = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789","") $newPassword = "" For $X = 1 to $length $newPassword &= $array[Random (1, $array[0], 1)] Next return $newPassword EndFunc Link to comment Share on other sites More sharing options...
AlmarM Posted November 15, 2007 Author Share Posted November 15, 2007 EDIT: Updated Script Look at the #1st post to see the new Script Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted November 15, 2007 Author Share Posted November 15, 2007 Sorry if the moderators think im spamming but I wanne let you guys know: SCRIPT UPDATED Watch it Watch the Credits too ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Creator Posted November 15, 2007 Share Posted November 15, 2007 (edited) expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("Password Generator", 190, 230, -1, -1) $Label_1 = GUICtrlCreateLabel("Generated Password:", 10, 10, 130, 15) $Input_1 = GUICtrlCreateInput("", 10, 30, 100, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Button_1 = GUICtrlCreateButton("Generate Pass", 10, 61, 90, 30) $Button_2 = GUICtrlCreateButton("Clear", 100, 61, 40, 30) $Button_3 = GUICtrlCreateButton("Copy", 140, 61, 40, 30) $Credits = GUICtrlCreateLabel("Credits:" & @CRLF & "AlmarM" & @CRLF & "weaponx" & @CRLF & "ashley", 130, 2) $Label_2 = GUICtrlCreateLabel("How many chars sould the password be?", 10, 95, 170, 30) $Input_2 = GUICtrlCreateInput("7", 10, 130, 170, 20) $chkLower = GUICtrlCreateCheckbox("Lowercase characters",10, 150) $chkUpper= GUICtrlCreateCheckbox("Uppercase characters",10, 170) $chkNumbers = GUICtrlCreateCheckbox("Numbers",10, 190) $chkSpecial = GUICtrlCreateCheckbox("Special characters",10, 210) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button_1 $Read_Char = GUICtrlRead($Input_2) _Randomize($Read_Char) Case $nMsg = $Button_2 GUICtrlSetData($Input_1, "", "") Case $nMsg = $Button_3 $READ = GUICtrlRead($Input_1) ClipPut($READ) EndSelect WEnd Func _Randomize($Length) $charactersets = "" $numbers = "0123456789" $lower = "abcdefghijklmnopqrstuvwxyz" $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" $special = "!@#$%^&*<>" $stateNumbers = GUICtrlRead($chkNumbers) $stateLower = GUICtrlRead($chkLower) $stateUpper = GUICtrlRead($chkUpper) $stateSpecial = GUICtrlRead($chkSpecial) If $stateNumbers = 1 Then $charactersets &= $numbers EndIf If $stateLower = 1 Then $charactersets &= $lower EndIf If $stateUpper = 1 Then $charactersets &= $upper EndIf If $stateSpecial = 1 Then $charactersets &= $special EndIf If $charactersets = "" Then msgbox(32,"Huh...", "You really expect me to make a password outta...well..NOTHING???") Return EndIf $Array = StringSplit($charactersets,"") $Pass = "" For $X = 1 to $Length $Pass &= $Array[Random (1, $Array[0], 1)] Next GUICtrlSetData($Input_1, $Pass) Return $Pass EndFunc I added userchoice for used charactersets in password generation. Its now flexible to generate any kind of password you need Nice work! Edited November 15, 2007 by Creator Link to comment Share on other sites More sharing options...
AlmarM Posted November 16, 2007 Author Share Posted November 16, 2007 (edited) expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("Password Generator", 190, 230, -1, -1) $Label_1 = GUICtrlCreateLabel("Generated Password:", 10, 10, 130, 15) $Input_1 = GUICtrlCreateInput("", 10, 30, 100, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) $Button_1 = GUICtrlCreateButton("Generate Pass", 10, 61, 90, 30) $Button_2 = GUICtrlCreateButton("Clear", 100, 61, 40, 30) $Button_3 = GUICtrlCreateButton("Copy", 140, 61, 40, 30) $Credits = GUICtrlCreateLabel("Credits:" & @CRLF & "AlmarM" & @CRLF & "weaponx" & @CRLF & "ashley", 130, 2) $Label_2 = GUICtrlCreateLabel("How many chars sould the password be?", 10, 95, 170, 30) $Input_2 = GUICtrlCreateInput("7", 10, 130, 170, 20) $chkLower = GUICtrlCreateCheckbox("Lowercase characters",10, 150) $chkUpper= GUICtrlCreateCheckbox("Uppercase characters",10, 170) $chkNumbers = GUICtrlCreateCheckbox("Numbers",10, 190) $chkSpecial = GUICtrlCreateCheckbox("Special characters",10, 210) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button_1 $Read_Char = GUICtrlRead($Input_2) _Randomize($Read_Char) Case $nMsg = $Button_2 GUICtrlSetData($Input_1, "", "") Case $nMsg = $Button_3 $READ = GUICtrlRead($Input_1) ClipPut($READ) EndSelect WEnd Func _Randomize($Length) $charactersets = "" $numbers = "0123456789" $lower = "abcdefghijklmnopqrstuvwxyz" $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" $special = "!@#$%^&*<>" $stateNumbers = GUICtrlRead($chkNumbers) $stateLower = GUICtrlRead($chkLower) $stateUpper = GUICtrlRead($chkUpper) $stateSpecial = GUICtrlRead($chkSpecial) If $stateNumbers = 1 Then $charactersets &= $numbers EndIf If $stateLower = 1 Then $charactersets &= $lower EndIf If $stateUpper = 1 Then $charactersets &= $upper EndIf If $stateSpecial = 1 Then $charactersets &= $special EndIf If $charactersets = "" Then msgbox(32,"Huh...", "You really expect me to make a password outta...well..NOTHING???") Return EndIf $Array = StringSplit($charactersets,"") $Pass = "" For $X = 1 to $Length $Pass &= $Array[Random (1, $Array[0], 1)] Next GUICtrlSetData($Input_1, $Pass) Return $Pass EndFunc I added userchoice for used charactersets in password generation. Its now flexible to generate any kind of password you need Nice work! 1st: I dont use Upper and Lower, because there will be more letters as numbers 2nd: I wanted to use specials but thats anoying at the typing of your pass. But anyway... Nice _Randomize() Func ^^ EDIT: Updated Script Added History Edited November 16, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted November 16, 2007 Author Share Posted November 16, 2007 Upated Script Added Credits to Creator for the example script. If someone knows how I can loop the Script (You will see what I meen ;D) I would be glad if you could help me. Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
weaponx Posted November 16, 2007 Share Posted November 16, 2007 What do you mean loop? It lets you generate as many as you want. Link to comment Share on other sites More sharing options...
AlmarM Posted November 16, 2007 Author Share Posted November 16, 2007 What do you mean loop? It lets you generate as many as you want. I ment I got this: expandcollapse popup$Read_1 = GUICtrlRead($Checkbox_1) $Read_2 = GUICtrlRead($Checkbox_2) $Read_3 = GUICtrlRead($Checkbox_3) $Read_4 = GUICtrlRead($Checkbox_4) $Read_5 = GUICtrlRead($Checkbox_5) $Read_6 = GUICtrlRead($Checkbox_6) $Read_7 = GUICtrlRead($Checkbox_7) $Read_8 = GUICtrlRead($Checkbox_8) $Read_9 = GUICtrlRead($Checkbox_9) $Read_10 = GUICtrlRead($Checkbox_10) $Read_11 = GUICtrlRead($Checkbox_11) $Read_12 = GUICtrlRead($Checkbox_12) $Read_13 = GUICtrlRead($Checkbox_13) $Read_14 = GUICtrlRead($Checkbox_14) $Read_15 = GUICtrlRead($Checkbox_15) $Read_16 = GUICtrlRead($Checkbox_16) If $Read_1 = 1 Then $AddSpecial &= $1 EndIf If $Read_2 = 1 Then $AddSpecial &= $2 EndIf If $Read_3 = 1 Then $AddSpecial &= $3 EndIf If $Read_4 = 1 Then $AddSpecial &= $4 EndIf If $Read_5 = 1 Then $AddSpecial &= $5 EndIf If $Read_6 = 1 Then $AddSpecial &= $6 EndIf If $Read_7 = 1 Then $AddSpecial &= $7 EndIf If $Read_8 = 1 Then $AddSpecial &= $8 EndIf If $Read_9 = 1 Then $AddSpecial &= $9 EndIf If $Read_10 = 1 Then $AddSpecial &= $10 EndIf If $Read_11 = 1 Then $AddSpecial &= $11 EndIf If $Read_12 = 1 Then $AddSpecial &= $12 EndIf If $Read_13 = 1 Then $AddSpecial &= $13 EndIf If $Read_14 = 1 Then $AddSpecial &= $14 EndIf If $Read_15 = 1 Then $AddSpecial &= $15 EndIf If $Read_16 = 1 Then $AddSpecial &= $16 EndIf And my question was. Can I make it shorter? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Nahuel Posted November 16, 2007 Share Posted November 16, 2007 MsgBox(4, "Clear", "Really clear History?") Link to comment Share on other sites More sharing options...
weaponx Posted November 16, 2007 Share Posted November 16, 2007 Here you go: Func _Randomize($Length) $AddSpecial = "" $specialChars = StringSplit("!@#$%*()-=+[]\/?", "") For $X = 1 to $specialChars[0] If GUICtrlRead(Eval("Checkbox_" & $X)) = 1 Then $AddSpecial &= $specialChars[$X] EndIf Next $Array = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" & $AddSpecial,"") $Pass = "" For $X = 1 to $Length $Pass &= $Array[Random (1, $Array[0], 1)] Next GUICtrlSetData($Input_1, $Pass) Return $Pass EndFunc Link to comment Share on other sites More sharing options...
AlmarM Posted November 16, 2007 Author Share Posted November 16, 2007 Here you go: Func _Randomize($Length) $AddSpecial = "" $specialChars = StringSplit("!@#$%*()-=+[]\/?", "") For $X = 1 to $specialChars[0] If GUICtrlRead(Eval("Checkbox_" & $X)) = 1 Then $AddSpecial &= $specialChars[$X] EndIf Next $Array = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" & $AddSpecial,"") $Pass = "" For $X = 1 to $Length $Pass &= $Array[Random (1, $Array[0], 1)] Next GUICtrlSetData($Input_1, $Pass) Return $Pass EndFunc Ty mate ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
ashley Posted November 17, 2007 Share Posted November 17, 2007 on the history pannel... add a vertial scroll bar. Free icons for your programs Link to comment Share on other sites More sharing options...
AlmarM Posted November 18, 2007 Author Share Posted November 18, 2007 on the history pannel... add a vertial scroll bar.You have any idea how I sould do that? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted November 18, 2007 Author Share Posted November 18, 2007 Updated Script:Added Save History ButtonTake a look at itashley brought me on the idea cus he said add a vertical scroll bar. And I didn't knew how to do it. So added Save History Button Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
FireLord Posted November 18, 2007 Share Posted November 18, 2007 nice. i like it. [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
thomaatje Posted November 18, 2007 Share Posted November 18, 2007 Just what i needed, very nice Link to comment Share on other sites More sharing options...
JustinReno Posted November 18, 2007 Share Posted November 18, 2007 I use it as a passphrase generator for my compiled scripts. Good work. 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