?
Solved

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

Posted on 2014-09-25
1
Medium Priority
?
384 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 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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?
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

764 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