Sign in to follow this  
Followers 0
krzyrice

Keep on getting Variable used without being declared error.

3 posts in this topic

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

Share this post


Link to post
Share on other sites



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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank you so much. That did the trick!

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