Jump to content

Recommended Posts

Posted (edited)

So I have this gui set up and whenever i run the function for this button:

Func Button1()
$copy1 = FileCopy ( "C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Versionsminecraft 1.0.0 modsminecraft.jar", "C:UsersAdamAppDataRoaming.minecraftbin", 1 )
If $copy1 = 1 Then MsgBox ( 0, "Success", "The version transfer was a success" )
If $copy1 = 0 Then $fail1 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail1 = 6 Then Button1()
EndFunc

I get this error:

C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Launcher2.au3 (48) : ==> Variable used without being declared.:

If $fail1 = 6 Then Button1()

If ^ ERROR

What's wrong with this?

If needed, my entire current script is here:

#include <INet.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$YourIP = _GetIP()#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Minecraft Launcher", 372, 242, 192, 123)
GUISetBkColor(0x00FFFF)
$Checkbox1 = GUICtrlCreateCheckbox("Default Minecraft", 8, 8, 153, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Minecraft Cracked", 8, 40, 161, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Private Server", 8, 72, 137, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Main Server", 8, 104, 153, 17)
$Input1 = GUICtrlCreateInput("Input1", 8, 200, 193, 21)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetTip(-1, "IP Address")
$Label1 = GUICtrlCreateLabel("IP Address", 72, 176, 55, 17)
$Button2 = GUICtrlCreateButton("Go", 144, 80, 49, 25)
$Button3 = GUICtrlCreateButton("Get IP", 208, 200, 57, 25)
$Button1 = GUICtrlCreateButton("1.0.0 Mods", 232, 8, 121, 33)
$Button4 = GUICtrlCreateButton("1.1.0", 232, 56, 121, 33)
$Button5 = GUICtrlCreateButton("1.0.0 No Mods", 232, 104, 121, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
IF $nMsg = $Button1 Then Button1()
If $nMsg = $Button2 Then Button2()
If $nMsg = $Button3 Then Button3()
If $nMsg = $Button4 Then Button4()
If $nMsg = $Button5 Then Button5()
WEndFunc Button1()
$copy1 = FileCopy ( "C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Versionsminecraft 1.0.0 modsminecraft.jar", "C:UsersAdamAppDataRoaming.minecraftbin", 1 )
If $copy1 = 1 Then MsgBox ( 0, "Success", "The version transfer was a success" )
If $copy1 = 0 Then $fail1 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail1 = 6 Then Button1()
EndFunc
Func Button2()
EndFunc
Func Button3()
GUICtrlSetData( $Input1, $YourIP )
EndFunc
Func Button4()
EndFunc
Func Button5()
EndFunc
Edited by cheeseandcereal
Posted

it says the variable is used without declaring just Declare variable as Global $fail1 after adding all the include files this will resolve your problem...

To avoid these kind of issues in future add the below line in your code..

[autoit]

Opt(MustDeclareVars,1)

[/autoit]

all clear?

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Posted (edited)

it says the variable is used without declaring just Declare variable as Global $fail1 after adding all the include files this will resolve your problem...

To avoid these kind of issues in future add the below line in your code..

[autoit]

Opt(MustDeclareVars,1)

[/autoit]

all clear?

Ok thanks. Im sorta new to this whole coding thing... obviously. That fixed my problem and I would gladly include that code in my script but when I do I get this error:

C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Launcher.au3(9,20) : ERROR: syntax error

Opt(MustDeclareVars,

~~~~~~~~~~~~~~~~~^

C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Launcher.au3 - 1 error(s), 0 warning(s)

P.S. How do I delete posts on this forum?

Edited by cheeseandcereal
Posted

Ok thanks. Im sorta new to this whole coding thing... obviously. That fixed my problem and I would gladly include that code in my script but when I do I get this error:

C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Launcher.au3(9,20) : ERROR: syntax error

Opt(MustDeclareVars,

~~~~~~~~~~~~~~~~~^

C:UsersAdamDocumentsAdam's file'sMinecraft LauncherMinecraft Launcher.au3 - 1 error(s), 0 warning(s)

P.S. How do I delete posts on this forum?

Never mind, I just needed some quotation marks. Thanks for the help!

Posted

Never mind, I just needed some quotation marks. Thanks for the help!

:) Welcome!

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

  • Moderators
Posted

To all those who replied:

$Checkbox1 = GUICtrlCreateCheckbox("Default Minecraft", 8, 8, 153, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Minecraft Cracked", 8, 40, 161, 17) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Please look at what you are helping to fix - this is not the sort of topic we want to encourage. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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