Jump to content

Keep on getting Variable used without being declared error.


Recommended Posts

I like to make this password generator work from this thread: http://www.autoitscript.com/forum/index.php?showtopic=43794

Here is the code I'm trying to get work. Somehow it has a bug in it that keeps saying:

Posted Image

#include <GuiConstants.au3>

GuiCreate("", 180, 100,-1, -1 , $WS_POPUP)

GUiSetBkColor(0x00000)

$Input_2 = GuiCtrlCreateInput("1", 120, 20, 60, 20)

GUICtrlCreateUpdown(-1,$UDS_NOTHOUSANDS)

$Input_1 = GuiCtrlCreateInput("", 0, 20, 120, 20)

$label = GUICtrlCreateLabel("",0,0,180,20,$SS_CENTER ,$GUI_WS_EX_PARENTDRAG)

GUICtrlSetColor(-1,0xffffff)

$Button_2 = GuiCtrlCreateButton("Copy to clipboard", 00, 40, 180, 20)

$Button_3 = GuiCtrlCreateButton("Create password", 0, 60, 180, 20)

$Button_4 = GuiCtrlCreateButton("Exit", 0, 80, 180, 20)

GuiSetState()

do

$msg = GuiGetMsg()

if $msg = $Button_2 then ClipPut(GUICtrlRead($Input_1))

if $msg = $Button_4 then Exit

if $msg = $Button_3 Then passcreate()

until $msg = $GUI_EVENT_CLOSE

func passcreate()

GUICtrlSetData($label,"Working")

GUICtrlSetData($Input_1,"")

for $iCC = 1 to GUICtrlRead($Input_2)

if Random(1,3,1) = 1 Then

GUICtrlSetData($Input_1,GUICtrlRead($Input_1) & chr(random(48,57,1)))

Elseif Random(1,3,1) = 2 then

GUICtrlSetData($Input_1,GUICtrlRead($Input_1) & chr(random(65,90,1)))

Else

GUICtrlSetData($Input_1,GUICtrlRead($Input_1) & chr(random(97,122,1)))

EndIf

Next

GUICtrlSetData($label,"Done!")

EndFunc

Link to comment
Share on other sites

  • Developers

Add these at the top of your script in stead of "#include <GuiConstants.au3>"

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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