Spoiler anzeigen
#include <GUIConstantsEx.au3>
;Reading Path of GMod 10
$Reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win dows\CurrentVersion\Uninstall\Steam App 4000", "InstallLocation")
$Installpath = $Reg & "\garrysmod\addons"
Opt('MustDeclareVars', 1)
_Install()
Func _Install()
;Declaring Variables
Local $Folder, $Install, $Msg, $Label, $Exit, $Foldername1, $Foldername2
;General settings
GUICreate("Addon Installer", 225, 100, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018)
$Label = GUICtrlCreateLabel("Enter the path to the folder of the mod (Drag'n'Drop enabled):", 10, 10, 200, 40)
$Folder = GUICtrlCreateInput("", 10, 40, 210, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
;Buttons
$Install = GUICtrlCreateButton("Install", 45, 65, 60, 20)
$Exit = GUICtrlCreateButton("Done!", 105, 65, 60, 20)
;Creating Windows
GUISetState()
$Msg = 0
While $Msg <> $GUI_EVENT_CLOSE
$Msg = GUIGetMsg()
Select
Case $Msg = $Install
ExitLoop
Case $Msg = $Exit
Exit
Case $Msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
$Foldername1 = StringInStr(GuiCtrlRead($Folder), "\", 0, -1)
$Foldername2 = StringTrimLeft(GuiCtrlRead($Folder), $Foldername1)
DirCopy(GuiCtrlRead($Folder), $Installpath & "\" & $Foldername2, 1)
MsgBox(64, "Addon installed", "Addon '" & $Foldername2 & "' installed successfully!")
Run(@ScriptFullPath)
Exit
EndFunc