Jump to content

Why it appears only zero`s? :S


Invi
 Share

Recommended Posts

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 ^^

Link to comment
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.

Link to comment
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!

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...