'Set Default Save Attachments in Outlook Express
'© Kelly's Korner - 7/16/03

Dim myShell, OE_ID, OE_ID2, OE_SA_Key, p1, cn, t, attPath, strCopy

Set myShell = CreateObject("WScript.Shell")

strCopyright = vbCR & vbCR & "Copyright 2003 - Kelly Theriot" & vbCR & "http://www.kellys-korner-xp.com"

On Error Resume Next
OE_ID = "HKEY_CURRENT_USER\Identities\Default User ID"
OE_ID2 = myShell.RegRead(OE_ID)

p1="HKEY_CURRENT_USER\Identities\" & OE_ID2 & "\Software\Microsoft\Outlook Express\5.0\Save Attachment Path"

Dim bffShell
	Dim bff
	Set bffShell = WScript.CreateObject("Shell.Application")
	Set bff = bffShell.BrowseForFolder(0, "Select the default folder wanted.", 1)
	attPath = bff.ParentFolder.ParseName(bff.Title).Path
	cn = attPath & 	"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"

If Err.Number = 424 Then

	MsgBox "You clicked Cancel, no changes were made." & strCopyright,  vbInformation, "User Cancelled"

	WScript.Quit

Elseif Err.Number = 0 Then

	Err.Clear

	MyShell.RegWrite p1, cn, "REG_SZ"

	If Err.Number <> 0 Then

		MsgBox "Error writing to the Registry!" & strCopyright, vbokonly + vbInformation,"Error!"	
		
		Wscript.Quit
	Else

		MsgBox "Save Attachment Path has been changed to " & attPath & strCopyright,  vbInformation, "Finished"
		
	End If

End If
