bbimis
asked on
i need help with some code to purge the temp files that outlook webaccess makes
I am trying to purge the temp files that outlook web access makes. this needs to be done when the user closes either the tab, browser or logs out.
it needs to run in the background and purge only when needed.
here is the code I have so far.. I need help with it purging chrome, and firefox. it appears the temp files are stored in different default places.
it needs to run in the background and purge only when needed.
here is the code I have so far.. I need help with it purging chrome, and firefox. it appears the temp files are stored in different default places.
#Include <File.au3>
#Include <Array.au3>
$Debug=0
Func EmptyFolder($FolderToDelete)
$AllFiles=_FileListToArray($FolderToDelete,"*",0)
If $Debug Then ConsoleWrite("-->" & $FolderToDelete & @CRLF )
If IsArray($AllFiles) Then
If $Debug Then
_ArrayDisplay( $AllFiles,$FolderToDelete)
EndIf
For $i = 1 To $AllFiles[0]
$delete = FileDelete($FolderToDelete & "\" & $AllFiles[$i])
If $Debug Then
ConsoleWrite($FolderToDelete & "\" & $AllFiles[$i]& " =>"&$delete & @CRLF )
EndIf
DirRemove($FolderToDelete & "\" & $AllFiles[$i], 1)
Next
EndIf
EndFunc
while 1
;The code will run in the background and will execute only when the Outlook Web App is closed
;It will sleep for 10 seconds and then check and repeat
if Not WinExists("Outlook Web App") then
EmptyFolder (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files\Content.IE5")
EmptyFolder (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files")
EmptyFolder (@HomeDrive & @HomePath & "\Cookies")
EmptyFolder (@HomeDrive & @HomePath & "\Local Settings\History")
EmptyFolder (@HomeDrive & "\Temp\Temporary Internet Files")
EmptyFolder (@WindowsDir & "\Temp")
EmptyFolder (@HomeDrive & "\Temp")
EmptyFolder (@HomeDrive & @HomePath & "\Recent")
EmptyFolder (@HomeDrive & @HomePath & "\Application Data\Microsoft\Office\Recent")
EmptyFolder (@HomeDrive & @HomePath & "\Local Settings\Temp")
ShellExecuteWait("RunDll32.exe"," InetCpl.cpl,ClearMyTracksByProcess 255")
EndIf
sleep(100)
WEnd
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.