Solved

i need help with some code to purge the temp files that outlook webaccess makes

Posted on 2014-09-25
1
370 Views
Last Modified: 2014-09-29
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.
#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

Open in new window

0
Comment
Question by:bbimis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
matrixnz earned 500 total points
ID: 40347671
You could use CCleaner portable silently to clean all known browser cache, you can still use autoit as a wrapper, but have it call CCleaner instead of looking for the correct temp directories, a good tutorial on creating a template .ini file can be found here: http://www.scriptingsimon.com/2012/02/advanced-customisation-of-ccleaner/

If you only wish to target Chrome and Firefox directories below store the cache:

Chrome Cache files can be found here:
%LocalAppData%\Google\Chrome\User Data\Default directory

Firefox Cache files can be found here:
%LocalAppData%\Mozilla\Firefox\Profiles\*.default directory
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question