Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now