Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add run or cancel button to script? 1

Status
Not open for further replies.

dippncope

Technical User
Sep 22, 2008
88
US
Needs some help adding to script please.
I have users that get attachments in outlook on a daily basis. All of them have the exact same name. Once they hit the 100 attachment outlook gives an error and they cannot open any more with that name. Outlook stores the attachments in a randomly named folder.
After searching for a batch file or another script I found this script below and modified it so outlook 2003 and 2010 secure temp folders get deleted.

I don't like the idea of it just running with out a prompt to run or cancel. Can some one please help me add that option to the script

Code:
Set oWSH = CreateObject("WScript.Shell")		
Set oFSO = CreateObject("Scripting.FileSystemObject")

For Each sKey in Array("11.0","14.0")
sOutSecTmp = Empty
On Error Resume Next
sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
& sKey & "\Outlook\Security\OutlookSecureTempFolder")
If Len(sOutSecTmp) > 3 Then
oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
End If
Next

msgbox ("Outlook Secure Temp Folder has been cleaned.")
 
Code:
Check = MsgBox("Press OK to run or No to exit.",36,"OK to Proceed?")
If Check = vbYes Then 
	Set oWSH = CreateObject("WScript.Shell")        
	Set oFSO = CreateObject("Scripting.FileSystemObject")
	For Each sKey in Array("11.0","14.0")
		sOutSecTmp = Empty
		On Error Resume Next
		sOutSecTmp = oWSH.RegRead("HKCU\Software\Microsoft\Office\" _
		& sKey & "\Outlook\Security\OutlookSecureTempFolder")
		If Len(sOutSecTmp) > 3 Then
			oFSO.DeleteFile oFSO.BuildPath(sOutSecTmp,"*.*"), True
		End If
	Next
	MsgBox("Outlook Secure Temp Folder has been cleaned.")
Else
	WScript.Quit
End If

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thank you very much that is exactly what I was looking for. A Star for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top