11#RequireAdmin 
22#Region ;**** Directives created by AutoIt3Wrapper_GUI ****  
3+ #AutoIt3Wrapper_Outfile_x64= Build Tools 6.0.0.0 .exe
34#AutoIt3Wrapper_Res_Comment= This program helps IT professionals automate your work.
45#AutoIt3Wrapper_Res_Description= Automation Software By Jacob Stewart
56#AutoIt3Wrapper_Res_Fileversion= 5.1.0.2 
1112#AutoIt3Wrapper_Res_SaveSource= y
1213#AutoIt3Wrapper_Res_requestedExecutionLevel= requireAdministrator
1314#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****  
14- Global  $version = " 5.1.0.2" 
15+ Global  $version = " 6.0.0.0" 
16+ Global  $version_name = ' Build Tools 6 - Crunchy Packet' 
1517; VERSION 4 AND ABOVE IS NOW HOSTED ON GITHUB.COM
1618Global  $admin = 0 
1719If  FileExists (@ScriptDir & " \admin"  ) Then  $admin = 1 
@@ -36,13 +38,14 @@ Global $LinkGrabify="https://grabify.link/KQJ835" ; Tracking link for stats
3638; === Dir ===
3739Global  $DirBin = @ScriptDir & " \Build Tools" 
3840If  Not  FileExists ($DirBin ) Then  DirCreate ($DirBin )
39- Global  $DirInstallers = $DirBin & " \Installers" 
41+ Global  $DirInstallers = $DirBin & " \Installers"   ;  TODO No longer used 
4042Global  $DirOther = $DirBin & " \Other" 
4143Global  $dirLocalRoamCache = @LocalAppDataDir & " \Microsoft\Outlook\RoamCache" 
4244
4345; === File ===
44- Global  $fileLog  = $DirBin & " \Log.log" 
46+ Global  $FileLog  = $DirBin & " \Log.log" 
4547Global  $FileClipHistory = $DirBin & " \ClipBoardHistory.txt" 
48+ Global  $FileInstallers = $DirBin & " \installers.txt" 
4649_log(" ---running---"  ) ; Start the log file
4750
4851; SetDefaultBrowser.exe
@@ -79,6 +82,7 @@ Global $colorRED_dark=0x990000
7982Global  $colorRed = 0xff0000 
8083Global  $colorGreen = 0x478a00 
8184Global  $colorBlue = 0x000fb0 
85+ Global  $colorBlueLight = 0x027dc4 
8286Global  $colorBlack = 0x000000 
8387Global  $colorPink = 0xff54cf 
8488Global  $colorGray = 0xd1d1d1 
@@ -97,7 +101,7 @@ $SpacingButtons=25
97101Global  $ServerActive = 0 
98102Global  $ClientActive = 0 
99103Global  $ServerIP = @IPAddress1 
100- Global  $ServerPort = 65432 
104+ Global  $ServerPort = 3000 
101105
102106; === REG ===
103107Global  $regSearch [3 ] =  [" HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search"  ," SearchboxTaskbarMode"  ," REG_DWORD"  ]
@@ -226,22 +230,32 @@ EndIf
226230
227231;  --------------------------------------------------------------------------------------- TOP
228232$top = 5 
229- GUICtrlCreateLabel (' Build Tools 5 - Big Data '  ,5 ,$top ,$guiW - 10 ,17 ,0x01 )
233+ GUICtrlCreateLabel ($version_name ,5 ,$top ,$guiW - 10 ,17 ,0x01 )
230234	GUICtrlSetFont (- 1 ,11 ,600 )
231- 	GUICtrlSetBkColor (- 1 ,$colorRED_dark  )
235+ 	GUICtrlSetBkColor (- 1 ,$colorBlueLight  )
232236	GUISetBkColor ($colorGray )
233237
234238;  --------------------------------------------------------------------------------------- LEFT
235239$width = $guiW / 2 - 3 
236240$top += 20 
237241
238242; Software setup
239- Global  $SoftwareSearch = _FileListToArray($DirInstallers ," *.exe"  )
240- 
243+ Global  $SoftwareSearch = _FileListToArray($DirInstallers ," *.exe"  ) ;  TODO remove
244+ Global  $SoftwareInstallers [99 ][2 ]
245+ Global  $SoftwareCount = 0 
241246Global  $SoftwareError = 0 
242- If  Not  @error  Then 
243- 	For  $i = 1  To  $SoftwareSearch [0 ] step  1 
244- 		$CheckSoftware [$i ]= GUICtrlCreateCheckbox (StringTrimRight ($SoftwareSearch [$i ],4 ),5 ,$top ,$width ,15 )
247+ If  _FileCountLines($FileInstallers ) >  1  Then 
248+ 	For  $i  =  2  to  _FileCountLines($FileInstallers ) step  1 
249+ 		$SoftwareCount += 1 
250+ 		$temp  =  StringSplit (FileReadLine ($FileInstallers ,$i )," ,"  )
251+ 		If  $temp [0 ] <>  2  then 
252+ 			ProgressOff ()
253+ 			MsgBox (16 ,' ERROR Installers'  ,' There is a syntax error in the installers.txt file (line: ' & $i & ' )'   &  @CRLF  &  FileReadLine ($FileInstallers ,$i ))
254+ 			Exit 
255+ 		EndIf 
256+ 		$SoftwareInstallers [$i ][0 ] =  $temp [1 ]
257+ 		$SoftwareInstallers [$i ][1 ] =  $temp [2 ]
258+ 		$CheckSoftware [$i ]= GUICtrlCreateCheckbox ($temp [1 ],5 ,$top ,$width ,15 )
245259		GUICtrlSetBkColor (- 1 ,0xbdbdbd )
246260		$top += 20 
247261	Next 
@@ -473,14 +487,15 @@ While 1
473487				_log(" ERROR: " & $DirInstallers & "  Does not exist, this is because the program has not been fully installed/downloaded correctly."  )
474488			Else 
475489				ShellExecute ($DirInstallers )
476- 				MsgBox (0 ," Info"  ," Program will need to be reloaded."  ,3 )
490+ 				Sleep (1000 )
491+ 				MsgBox (0 ," Info"  ," NOTE: Build Tools will need to be reloaded if programs are added."  , 4 )
477492			EndIf 
478493
479494		Case  $ButtonUpdate 
480495			_Update()
481496
482497		; Case $ButtonLog
483- 			; ShellExecute($fileLog )
498+ 			; ShellExecute($FileLog )
484499
485500		Case  $ButtonPowerOptions 
486501			_PowerOptions()
@@ -947,6 +962,7 @@ Func _Server() ;----------------------------------------------------------------
947962		$SocketListen = TCPListen ($ServerIP ,$ServerPort ,5 )
948963		If  @error  Then 
949964			_log(" Error(" & @error & " ): Starting TCP Server, PORT: " & $ServerPort & "  IP: " & $ServerIP )
965+ 			MsgBox (16 ,' Server Error'  , ' Could not start the server: '   &  @error )
950966			GUICtrlSetColor ($ButtonServerOnOFF ,$colorRed )
951967			GUICtrlSetBkColor ($ButtonServerOnOFF ,14408667 )
952968			TCPShutdown ()
@@ -977,16 +993,20 @@ Func _Client() ;----------------------------------------------------------------
977993		MsgBox (16 ," Client"  ," You cant be a Client when you are a Server!"  )
978994		Return 
979995	EndIf 
980- 	$ServerIP = GUICtrlRead ($InputServerIP )
981- 	$ServerPort = GUICtrlRead ($InputServerPort )
982996
983- 	TCPStartup ()
997+ 	If  $ClientActive = 0  Then  ; start the client server for the first time
998+ 		$ClientActive  =  1 
999+ 		$ServerIP = GUICtrlRead ($InputServerIP )
1000+ 		$ServerPort = GUICtrlRead ($InputServerPort )
9841001
985- 	$iSocket = TCPConnect ($ServerIP ,$ServerPort )
986- 	If  @error  Then 
987- 		_log(" ERROR(" & @error & " ): TCP Server not found."  )
988- 		GUICtrlSetColor ($ButtonClientOnOFF ,$colorOrange )
989- 		Return 
1002+ 		TCPStartup ()
1003+ 
1004+ 		$iSocket = TCPConnect ($ServerIP ,$ServerPort )
1005+ 		If  @error  Then 
1006+ 			_log(" ERROR(" & @error & " ): TCP Server not found."  )
1007+ 			GUICtrlSetColor ($ButtonClientOnOFF ,$colorRed )
1008+ 			Return 
1009+ 		EndIf 
9901010	EndIf 
9911011
9921012	$recive = TCPRecv ($iSocket ,500 )
@@ -999,13 +1019,23 @@ EndFunc
9991019Func  _install() ; ------------------------------------------------------------------------------ Install Software
10001020
10011021	_log(" _install() called"  )
1022+ 	$SoftwareString  =   " " 
1023+ 	$InstallError  =  1 
10021024	If  $SoftwareError = 0  Then 
1003- 		For  $i = 1  To  $SoftwareSearch  [ 0 ]  step  1 
1025+ 		For  $i = 2  To  $SoftwareCount  + 2  step  1 
10041026			If  GUICtrlRead ($CheckSoftware [$i ])= 1  Then 
10051027				GUICtrlSetState ($CheckSoftware [$i ],4 )
1006- 				ShellExecute ($DirInstallers & " \" & $SoftwareSearch [$i ])
1028+ 				$InstallError  =  0 
1029+ 				; ShellExecute($DirInstallers&"\"&$SoftwareSearch[$i])
1030+ 				$SoftwareString  =  $SoftwareString  &  "  "   &  $SoftwareInstallers [$i ][1 ]
10071031			EndIf 
10081032		Next 
1033+ 		If  $InstallError  =  1  Then 
1034+ 			MsgBox (48 ," warning!"  ," Please select software to install."  )
1035+ 			Return 
1036+ 		EndIf 
1037+ 		_log(" _install() run command: "   &  " winget install -h --wait --verbose --disable-interactivity --no-upgrade"   &  $SoftwareString )
1038+ 		Run (" winget install -h --wait --verbose --disable-interactivity --no-upgrade"   &  $SoftwareString )
10091039
10101040	Else 
10111041		MsgBox (48 ,' Warning'  ,' Warning! There is no software to install!'  )
@@ -1037,7 +1067,7 @@ Func _TaskbarIconsToDefault()
10371067EndFunc 
10381068
10391069Func  _log($_logMSG ) ; ------------------------------------------------------------------------------ Log
1040- 	_FileWriteLog($fileLog  ,$_logMSG ,1 )
1070+ 	_FileWriteLog($FileLog  ,$_logMSG ,1 )
10411071EndFunc 
10421072
10431073Func  _exit($_exitCode ) ; ------------------------------------------------------------------------------ EXIT
0 commit comments