Tyleo-Dev-AutoIT-Oldies/PATH Editor/PATH Adder.au3

63 lines
2.2 KiB
AutoIt
Raw Permalink Normal View History

2024-02-18 21:17:39 +00:00
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=PATHAdder.ico
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_ProductName=PATHAdder
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.0
#AutoIt3Wrapper_Res_CompanyName=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalCopyright=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalTradeMarks=Tyleo Softwares
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form2 = GUICreate("User Path Adder", 409, 72, 275, 238)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
Global $Loc = GUICtrlCreateInput("", 8, 8, 320, 24)
GUICtrlSetFont(-1,11,100, 0, "Consolas")
GUICtrlSetTip(-1,"Folder Location")
Global $Browse = GUICtrlCreateButton("📂", 376, 8, 25, 25)
GUICtrlSetFont(-1,14, 400, 0, "Segoe UI")
GUICtrlSetTip(-1,"Browse for Folder")
GUICtrlSetCursor(-1,0)
Global $Add = GUICtrlCreateButton(" Add This Folder to User Path (" & @UserName & ") ", 8, 40, 393, 25)
GUICtrlSetFont(-1,12, 400, 0, "Segoe UI")
GUICtrlSetTip(-1,"Add and Update Path Env")
GUICtrlSetCursor(-1,0)
Global $Paste = GUICtrlCreateButton("📫", 352, 8, 25, 25)
GUICtrlSetTip(-1,"Paste")
GUICtrlSetCursor(-1,0)
GUICtrlSetFont(-1,14, 400, 0, "Segoe UI")
Global $ClearUp = GUICtrlCreateButton("", 328, 8, 25, 25)
GUICtrlSetTip(-1,"Clear Up")
GUICtrlSetCursor(-1,0)
GUICtrlSetFont(-1,14, 400, 0, "Segoe UI")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Paste
$KeyPaste = ClipGet()
GUICtrlSetData($Loc,$KeyPaste)
Case $ClearUp
GUICtrlSetData($Loc,"")
Case $Browse
$FolderLoc = FileSelectFolder("Choose Folder",@MyDocumentsDir)
GUICtrlSetData($Loc,$FolderLoc)
Case $Add
$PathAddDir = GUICtrlRead($Loc)
Run('setx path %path%;' & $PathAddDir)
EnvUpdate()
MsgBox(0,"Success","Variable Path Updated" & @CRLF & $PathAddDir)
EndSwitch
WEnd