Solved

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

Posted on 2014-09-25
1
352 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

791 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