Sign in to follow this  
Followers 0
Invi

Why it appears only zero`s? :S

5 posts in this topic

I have been creating my own password generator, but I have had a problem.

I have next code:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Safe Password Generator [By Invisible_Hack]", 355, 72, 193, 125)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("Pass Generada", 8, 24, 71, 18)
GUICtrlSetFont(-1, 10, 400, 2, "MV Boli")
GUICtrlSetBkColor(-1, 0x00FF00)
$Blanco = GUICtrlCreateInput("", 96, 24, 121, 21)
$Generar = GUICtrlCreateButton("Generar", 240, 24, 81, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Segoe Script")
GUICtrlSetBkColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Generar
$Read_Char = GUICtrlRead($Blanco)
Random($Read_Char)
GUICtrlSetData($Blanco, Random($Read_Char) & @CRLF, "|")
    EndSwitch
WEnd

But when i click on the button, it doesnt generate random passwords, it appear one zero in the textbox each time i make clic on the button...

Why? ;)

I would be very gratefull if someone of you could give me a little help ^^

Share this post


Link to post
Share on other sites



You're just reading the data in the text field (empty) to a variable and writing that variable's value to the text field. You aren't really doing anything.

Share this post


Link to post
Share on other sites

Hi!

To generate a random char you need to use the number you get out of Random() in the Chr() function (it gives the corresponding char int the ascii table).

Example:

MsgBox(0,"Random char A-Z",Chr(Random(65,90,1)))

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

I have been creating my own password generator, but I have had a problem.

I have next code:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Safe Password Generator [By Invisible_Hack]", 355, 72, 193, 125)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("Pass Generada", 8, 24, 71, 18)
GUICtrlSetFont(-1, 10, 400, 2, "MV Boli")
GUICtrlSetBkColor(-1, 0x00FF00)
$Blanco = GUICtrlCreateInput("", 96, 24, 121, 21)
$Generar = GUICtrlCreateButton("Generar", 240, 24, 81, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Segoe Script")
GUICtrlSetBkColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Generar
$Read_Char = GUICtrlRead($Blanco)
Random($Read_Char)
GUICtrlSetData($Blanco, Random($Read_Char) & @CRLF, "|")
    EndSwitch
WEnd

But when i click on the button, it doesnt generate random passwords, it appear one zero in the textbox each time i make clic on the button...

Why? ;)

I would be very gratefull if someone of you could give me a little help ^^

Here you go=D

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Safe Password Generator [By Invisible_Hack]", 355, 72, 193, 125)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("Pass Generada", 8, 24, 71, 18)
GUICtrlSetFont(-1, 10, 400, 2, "MV Boli")
GUICtrlSetBkColor(-1, 0x00FF00)
$Blanco = GUICtrlCreateInput("", 96, 24, 121, 21)
$Generar = GUICtrlCreateButton("Generar", 240, 24, 81, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Segoe Script")
GUICtrlSetBkColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Generar
            ;$Read_Char = GUICtrlRead($Blanco)
            $pass = ""
            For $I = 1 to 10
                $pass &= Random(0, 9, 1)
            Next
            GUICtrlSetData($Blanco, $pass)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Using monoceres' suggestion:

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Safe Password Generator [By Invisible_Hack]", 355, 72, 193, 125)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("Pass Generada", 8, 24, 71, 18)
GUICtrlSetFont(-1, 10, 400, 2, "MV Boli")
GUICtrlSetBkColor(-1, 0x00FF00)
$Blanco = GUICtrlCreateInput("", 96, 24, 121, 21)
$Generar = GUICtrlCreateButton("Generar", 240, 24, 81, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Segoe Script")
GUICtrlSetBkColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Dim $Read_Char
$i = 1

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Generar
            GUICtrlSetData($Blanco,"")
            $Read_Char = ""
            For $i = 1 to 9
                $Read_Char = $Read_Char & Chr(Random(40,122,1))
            Next
            GUICtrlSetData($Blanco, $Read_Char)
    EndSwitch
WEnd

Edit: Forgot to clear $Read_Char when Generate (translated) is pressed.

Edited by dbzfanatic

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  
Followers 0