Jump to content

Recommended Posts

So I've been making this code and after I complete a button function that changes the $Version variable, I want it to update on the GUI.

Here is my code:

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Fun Stuff\Pictures\minecraft2.ico
#AutoIt3Wrapper_Outfile=Custom Minecraft Launcher.exe
#AutoIt3Wrapper_Res_Comment=Made by me, so it better be helpful! :)
#AutoIt3Wrapper_Res_Description=This is my custom minecraft launcher built specifically for me
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <INet.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt ( "MustDeclareVars", 1 )
Global $Button1
Global $Button2
Global $Button3
Global $Button4
Global $Button5
Global $Button6
Global $Check1
Global $Check2
Global $Check3
Global $Check4
Global $Check5
Global $Check6
Global $Checkbox1
Global $Checkbox2
Global $Checkbox3
Global $Checkbox4
Global $Checkbox5
Global $Checkbox6
Global $copy1
Global $copy2
Global $copy3
Global $copy4
Global $fail1
Global $fail2
Global $fail3
Global $fail4
Global $file
Global $Form1
Global $Input1
Global $Label1
Global $Label2
Global $Label3
Global $Label4
Global $nMsg
Global $restart
Global $Version
Global $Version1
Global $Version2
Global $Version3
Global $Version4
Global $YourIP
$YourIP = _GetIP()
$Version = "There was an error finding the current minecraft version"
$Version1 = FileExists ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$Version2 = FileExists ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
$Version3 = FileExists ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
$Version4 = FileExists ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
If $Version1 = 1 Then $Version = "Current Version is Minecraft 1.1.0"
If $Version2 = 1 Then $Version = "Current Version is Minecraft 1.0.0 with mods"
If $Version3 = 1 Then $Version = "Current Version is Minecraft 1.0.0 with no mods"
If $Version4 = 1 Then $Version = "Current Version is Minecraft 1.8.1 Beta"
#Region ### START Koda GUI section ### Form=C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Launcher gui.kxf
$Form1 = GUICreate("Minecraft Launcher", 373, 263, 280, 285)
GUISetIcon("C:\Users\Adam\Downloads\New\Minecraft\Minecraft.exe", -1)
GUISetBkColor(0x3399FF)
$Label1 = GUICtrlCreateLabel("IP Address", 168, 216, 55, 17)
$Label2 = GUICtrlCreateLabel("Minecraft Version", 168, 64, 173, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Arial Narrow")
$Label3 = GUICtrlCreateLabel("Adam's Custom Minecraft Launcher", 16, 0, 341, 33)
GUICtrlSetFont(-1, 18, 800, 0, "Arial Narrow")
$Label4 = GUICtrlCreateLabel($Version, 16, 40, 348, 20)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("Default Minecraft", 8, 72, 105, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Minecraft Cracked", 8, 96, 113, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Private Server", 8, 120, 89, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Main Server", 8, 144, 81, 17)
$Checkbox5 = GUICtrlCreateCheckbox("SplEditor", 8, 168, 65, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Wamp Server", 8, 192, 89, 17)
$Button1 = GUICtrlCreateButton("1.0.0 Mods", 144, 112, 97, 33)
$Button2 = GUICtrlCreateButton("Go", 8, 224, 73, 33)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Get IP", 304, 232, 57, 25)
$Button4 = GUICtrlCreateButton("1.1.0", 144, 168, 97, 33)
$Button5 = GUICtrlCreateButton("1.0.0 No Mods", 264, 112, 97, 33)
$Button6 = GUICtrlCreateButton("1.8.1 Beta", 264, 168, 97, 33)
$Input1 = GUICtrlCreateInput("", 96, 232, 193, 21)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
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()
If $nMsg = $Button6 Then Button6()
If GUICtrlRead($Checkbox1) = 1 Then
        $Check1 = "CHECK"
    Else
        $Check1 = "UNCHECK"
    EndIf
If GUICtrlRead($Checkbox2) = 1 Then
        $Check2 = "CHECK"
    Else
        $Check2 = "UNCHECK"
    EndIf
If GUICtrlRead($Checkbox3) = 1 Then
        $Check3 = "CHECK"
    Else
        $Check3 = "UNCHECK"
    EndIf
If GUICtrlRead($Checkbox4) = 1 Then
        $Check4 = "CHECK"
    Else
        $Check4 = "UNCHECK"
    EndIf
If GUICtrlRead($Checkbox5) = 1 Then
        $Check5 = "CHECK"
    Else
        $Check5 = "UNCHECK"
    EndIf
If GUICtrlRead($Checkbox6) = 1 Then
        $Check6 = "CHECK"
    Else
        $Check6 = "UNCHECK"
    EndIf
WEnd
Func Button1()
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$copy1 = FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.0.0 mods\minecraft.jar", "C:\Users\Adam\AppData\Roaming\.minecraft\bin", 1 )
FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.0.0 mods\1.0.0mods.txt", "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion", 1 )
If $copy1 = 1 Then $Version = "Current Version is Minecraft 1.0.0 with mods" And MsgBox ( 0, "Success", "The version transfer to Minecraft 1.0.0 with mods 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()
If $Check1 = "CHECK" Then Run ( "cmd /c start C:\Users\Adam\Downloads\New\Minecraft\Minecraft.exe", "", @SW_HIDE )
If $Check2 = "CHECK" Then Run ( "cmd /c start C:\Users\Adam\AppData\Roaming\.minecraft\MC.exe", "", @SW_HIDE )
If $Check3 = "CHECK" Then Run ( "cmd /c start C:\Users\Adam\Podcasts\MinecraftServer\MinecraftServer.exe" )
If $Check4 = "CHECK" Then Run ( "cmd /c start C:\Users\Adam\Downloads\New\Minecraft\MinecraftServer\MinecraftServer.exe" )
If $Check5 = "CHECK" Then Run ( "cmd /c start C:\Users\Adam\Downloads\New\Minecraft\SplEditor.exe", "", @SW_HIDE )
If $Check6 = "CHECK" Then Run ( "cmd /c start C:\wamp\wampmanager.exe", "", @SW_HIDE )
Exit
EndFunc
Func Button3()
GUICtrlSetData( $Input1, $YourIP )
EndFunc
Func Button4()
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$copy2 = FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.1.0\minecraft.jar", "C:\Users\Adam\AppData\Roaming\.minecraft\bin", 1 )
FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.1.0\1.1.0.txt", "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion", 1 )
If $copy2 = 1 Then $Version = "Current Version is Minecraft 1.1.0" And MsgBox ( 0, "Success", "The version transfer to Minecraft 1.1.0 was a success" )
If $copy2 = 0 Then $fail2 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail2 = 6 Then Button4()
EndFunc
Func Button5()
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$copy3 = FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.0.0\minecraft.jar", "C:\Users\Adam\AppData\Roaming\.minecraft\bin", 1 )
FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.0.0\1.0.0.txt", "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion", 1 )
If $copy3 = 1 Then $Version = "Current Version is Minecraft 1.0.0 with no mods" And MsgBox ( 0, "Success", "The version transfer to Minecraft 1.0.0 without mods was a success" )
If $copy3 = 0 Then $fail3 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail3 = 6 Then Button5()
EndFunc
Func Button6()
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$copy4 = FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.8.1\minecraft.jar", "C:\Users\Adam\AppData\Roaming\.minecraft\bin", 1 )
FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.8.1\1.8.1Beta.txt", "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion", 1 )
If $copy4 = 1 Then $Version = "Current Version is Minecraft 1.8.1 Beta" And MsgBox ( 0, "Success", "The version transfer to Minecraft 1.8.1 Beta was a success" )
If $copy4 = 0 Then $fail4 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail4 = 6 Then Button6()
EndFunc

As you can see on a function like this button:

Func Button6()
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0mods.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.0.0.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.8.1Beta.txt" )
FileDelete ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion\1.1.0.txt" )
$copy4 = FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.8.1\minecraft.jar", "C:\Users\Adam\AppData\Roaming\.minecraft\bin", 1 )
FileCopy ( "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\minecraft 1.8.1\1.8.1Beta.txt", "C:\Users\Adam\Documents\Adam's file's\Minecraft Launcher\Minecraft Versions\CurrentVersion", 1 )
If $copy4 = 1 Then $Version = "Current Version is Minecraft 1.8.1 Beta" And MsgBox ( 0, "Success", "The version transfer to Minecraft 1.8.1 Beta was a success" )
If $copy4 = 0 Then $fail4 = MsgBox ( 4+48, "Failure", "The version transfer was a failure would you like to try again?" )
If $fail4 = 6 Then Button6()
EndFunc

If the file transfer was a success, I have it change the $Version variable, however this does not update on the GUI (under label4 code here:)

$Label4 = GUICtrlCreateLabel($Version, 16, 40, 348, 20)

The only time this updates is when i completely restart the code. Any help so i can refresh the gui to show my new $Version variable after the file transfer is complete?

Any help would be greatly appreciated

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...