Windows Vista Default Folder Template Patch (AutoIT Script)

In 2008,I put together several solutions to prevent Windows Vista from automatically selecting a default view, which was generally inconsistent with the folder content. The purpose of this article is to take the first solution of that article that was found on vistax64.com and create a nice little utility using AutoIT.

Vista Default View

It hasn't been fully burned in but there may be something here for someone else to use.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Form1 = GUICreate("Microsoft Windows Vista Default Folder Template Patch v1.0", 615, 399, 1010, 386)
$Group1 = GUICtrlCreateGroup(" About ", 19, 16, 577, 305)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Registry Keys Removed", 43, 64, 138, 17)
$Label2 = GUICtrlCreateLabel("Registry Keys Added", 43, 192, 121, 17)
$Label3 = GUICtrlCreateLabel("[HKCU\Software\Microsoft\Windows\ShellNoRoam\BagMRU]", 43, 88, 303, 17)
$Label4 = GUICtrlCreateLabel("[HKCU\Software\Microsoft\Windows\ShellNoRoam\Bags]", 43, 104, 283, 17)
$Label5 = GUICtrlCreateLabel("[HKCU\Software\Microsoft\Windows\Shell\BagMRU]", 43, 120, 261, 17)
$Label6 = GUICtrlCreateLabel("[HKCU\Software\Microsoft\Windows\Shell\Bags]", 43, 136, 241, 17)
$Label7 = GUICtrlCreateLabel("[HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU]", 43, 152, 421, 17)
$Label8 = GUICtrlCreateLabel("[HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags]", 43, 168, 401, 17)
$Label9 = GUICtrlCreateLabel("[HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell]", 43, 216, 372, 17)
$Label10 = GUICtrlCreateLabel("BagMRU Size=dword:00004e20", 43, 232, 157, 17)
$Label11 = GUICtrlCreateLabel("[HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell]", 43, 256, 479, 17)
$Label12 = GUICtrlCreateLabel("FolderType=NotSpecified", 43, 272, 124, 17)
$Label13 = GUICtrlCreateLabel("This utility modifies the registry to resolve the default folder template problem in Windows Vista.", 43, 40, 446, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$OK = GUICtrlCreateButton("OK", 360, 344, 105, 33)
$Cancel = GUICtrlCreateButton("Cancel", 471, 344, 105, 33)
$Label14 = GUICtrlCreateLabel("Press OK to continue or Cancel to Cancel.", 40, 328, 203, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

		Case $OK
			RegDelete ("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\BagMRU")
			RegDelete ("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags")
			RegDelete ("HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\BagMRU")
			RegDelete ("HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags")
			RegDelete ("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU")
			RegDelete ("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags")
			RegWrite ("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell", "BagMRU Size", "REG_DWORD", "20000")
			RegWrite ("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell", "FolderType", "REG_SZ", "NotSpecified")
			ConsoleWrite("Done")
			MsgBox(0, "Message", "Complete.")
		Case $Cancel
			Exit
	EndSwitch
WEnd