Minecraft Portable + AutoLogin + AutoDownload

polluxtroy0

Aventurier
15 Mars 2011
36
0
1
[MàJ] Petite mise à jour qui permet de desactiver l'autologin et améliorations du script.

Voici un petit script AutoIt que j'ai créer et dont je me sert et que je souhaite vous faire partager.
Il s'agit d'un petit éxécutable qui permet d'emporter Minecraft partout avec vous (ex. Clef USB).
Vous le lancer, et il s'occupe de télécharger la dernière version de minecraft et la lance automatiquement.
Vous avez également la possibilité de lui spécifiez vos logins minecraft afin qu'il se connecte automatiquement. Laissez vide pour desactiver cette fonction. En espérant que cela vous soit utile. Renommez le fichier Minecraft Launcher.exe.zip en enlevant simplement le .zip à la fin.

Vous trouverez le code du programme ci-dessous.

HTML:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Minecraft Launcher - AutoLogin", 346, 77)
$Label1 = GUICtrlCreateLabel("Login", 8, 8, 30, 17)
$inputlogin = GUICtrlCreateInput("", 8, 24, 161, 21)
$Label2 = GUICtrlCreateLabel("Password", 176, 8, 50, 17)
$inputpassword = GUICtrlCreateInput("", 176, 24, 161, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Button1 = GUICtrlCreateButton("OK", 288, 48, 51, 25)
$Label3 = GUICtrlCreateLabel("If you don't want to use AutoLogin, leave cells blank.", 8, 56, 253, 17)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###

If FileExists(@ScriptDir & "\AppData\config.ini") Then
    $login = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Login", "")
    $password = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Password", "")
    _DownloadOrRun()
Else
    GUISetState(@SW_SHOW, $Form1)
EndIf

Func _DownloadOrRun()
    If FileExists(@ScriptDir & "\AppData\Minecraft.exe") Then
        EnvSet("APPDATA", @ScriptDir & "\AppData\")
        $login = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Login", "")
        $password = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Password", "")
        Run(@ScriptDir & "\AppData\Minecraft.exe " & $login & " " & $password & "", @ScriptDir & "\AppData\")
        Exit
    Else
        DirCreate(@ScriptDir & "\AppData")
        InetGet("https://s3.amazonaws.com/MinecraftDownload/launcher/Minecraft.exe", @ScriptDir & "\AppData\Minecraft.exe", 1)
        EnvSet("APPDATA", @ScriptDir & "\AppData\")
        $login = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Login", "")
        $password = IniRead(@ScriptDir & "\AppData\config.ini", "AUTO_LOGIN", "Password", "")
        Run(@ScriptDir & "\AppData\Minecraft.exe " & $login & " " & $password & "", @ScriptDir & "\AppData\")
        Exit
    EndIf
EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            GUISetState(@SW_HIDE, $Form1)
            DirCreate(@ScriptDir & "\AppData")
            FileWrite(@ScriptDir & "\AppData\config.ini", "[AUTO_LOGIN]" & @CRLF & "Login=" & GUICtrlRead($inputlogin) & @CRLF & "Password=" & GUICtrlRead($inputpassword) & "")
            _DownloadOrRun()

    EndSwitch
WEnd
 

Fichiers joints