Solved

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

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

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.
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?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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