• RSS
  • Facebook
  • Twitter

One Center for all the Testing Need. OneTestingCenter is for all, for all QA, for all Automation. Automation is easy, fun and enriching experience. Happy Learning and Happy Testing!

  • Access to All QA

    At OneTestingCenter, you find lots of books,articles,blogs and detailed guides. Everyone has access to QA. Happy Learning, Happy Testing.

  • Global Trainings

    All the QA/Auotmation trainings are available at OneTestingCenter. QA, Automation, QTP/UFT, Selenium, LoadRunner, QC/ALM, Appium...

  • Automation Learning Fun

    Technology is always evolving. Automation is always challenging. To be frank, Automation is fun, enthusiastic and enrching experience.

    '**********************************************************************
    '    @    Creation and Modification Log:
     '   @    Date          By                    Notes                      
     '   @    ----------    -------             ---------
    '    @    #Date#        G A Reddy            Created
    '**********************************************************************
    '**********************************************************************

    '**********************************************************************
    ' @ Purpose of the script: To clear cache files / temp files
    '**********************************************************************
    '  @        To Clear the browser caches
    '  @        To Clear Temp files and folders
    '  @        To Clear APP caches files
    '  @        To Clear Java and other cache files.
    '**********************************************************************
    'Set WshShell = CreateObject("WScript.Shell")
    'Set WshSysEnv = WshShell.Environment("Process")
    'strHomeDrive = WshSysEnv("HOMEDRIVE")
    'strHomePath =  strHomeDrive + WshSysEnv("HOMEPATH")

    Set WshShell = CreateObject("WScript.Shell")
    strHomePath =  WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

    'strInternetPropPath = strHomePath
    'strJavaCachePath = strHomePath + "\Application Data\Sun\Java\Deployment\cache"
    'strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
    'strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
    'strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
    'strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temporary Internet Files"

    strInternetPropPath = strHomePath
    'strJavaCachePath = strHomePath + "\Application Data\Sun\Java"
    strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
    strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
    strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
    strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temp"
    strTemporaryInternetFilePath1 = strHomePath + "\Local Settings\Temporary Internet Files"

    'msgbox strHomePath
    'msgbox strTemporaryInternetFilePath

    Call ClearCaches

    Function ClearCaches

    ' Clear IE temporary file and cookies
    RemoveFolderAndFiles strTemporaryInternetFilePath, False, True
    'msgbox strTemporaryInternetFilePath

    RemoveFolderAndFiles strTemporaryInternetFilePath1, False, True
    ' Delete Java cache
    ' Because of issues with the version on the jre (could be mutliple versions)
    'and the different states of the control panel, it was decided to remove cache folders/files without using Java Control Panel.
    ' Engineering felt that it should not be a problem.
    'RemoveFolderAndFiles strJavaCachePath, True, True
    'msgbox strJavaCachePath

    'Delete the Browse and File Cache files
    RemoveFolderAndFiles strBrowseFileCacheLocation, True,True
    'msgbox strBrowseFileCacheLocation

    End Function

    '*********************************************************************
    ' Sub Name: RemoveFolderAndFiles
    ' Purpose: Removes Files and Folders
    ' Assumptions: None
    ' Inputs:  strFolder -  Folder to remove file/subfolders
    ' bLeaveFolder - Remove sub folders and all files but not main folder
    ' bForceDelete - Force delete
    ' Return Values:  Nothing
    '*********************************************************************
    Public Sub RemoveFolderAndFiles(strFolder,  bLeaveFolder,  bForceDelete)
    Dim Folder
    Dim Folders
    Dim Files
    Dim File
    Dim fso

    On error Resume Next
                    Set fso = CreateObject("Scripting.FileSystemObject")
        if (fso.folderExists(strFolder) = True and bLeaveFolder = False) then
            call fso.DeleteFolder(strFolder, bForceDelete)
        end if

        If (fso.folderExists(strFolder) = True and bLeaveFolder = True) then
              Set Folder = fso.GetFolder(strFolder)
              Set Files = Folder.Files
                For each File in Files
                      File.Delete
                Next

               Set Folders = Folder.SubFolders
                  For each Folder in Folders
                  call fso.DeleteFolder(strFolder + "\" + Folder.Name, bForceDelete)
                  Next
        end if

    On error goto 0

                    Set Folder = Nothing
                    Set Folders = Nothing
                    Set Files = Nothing
                    Set File = Nothing
                    Set fso = Nothing
    End Sub
    '********************************************************************
    '********************************************************************


    Reactions:

    QTP - Clear cache / temp files

    '**********************************************************************
    '    @    Creation and Modification Log:
     '   @    Date          By                    Notes                      
     '   @    ----------    -------             ---------
    '    @    #Date#        G A Reddy            Created
    '**********************************************************************
    '**********************************************************************

    '**********************************************************************
    ' @ Purpose of the script: To clear cache files / temp files
    '**********************************************************************
    '  @        To Clear the browser caches
    '  @        To Clear Temp files and folders
    '  @        To Clear APP caches files
    '  @        To Clear Java and other cache files.
    '**********************************************************************
    'Set WshShell = CreateObject("WScript.Shell")
    'Set WshSysEnv = WshShell.Environment("Process")
    'strHomeDrive = WshSysEnv("HOMEDRIVE")
    'strHomePath =  strHomeDrive + WshSysEnv("HOMEPATH")

    Set WshShell = CreateObject("WScript.Shell")
    strHomePath =  WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

    'strInternetPropPath = strHomePath
    'strJavaCachePath = strHomePath + "\Application Data\Sun\Java\Deployment\cache"
    'strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
    'strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
    'strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
    'strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temporary Internet Files"

    strInternetPropPath = strHomePath
    'strJavaCachePath = strHomePath + "\Application Data\Sun\Java"
    strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
    strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
    strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
    strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temp"
    strTemporaryInternetFilePath1 = strHomePath + "\Local Settings\Temporary Internet Files"

    'msgbox strHomePath
    'msgbox strTemporaryInternetFilePath

    Call ClearCaches

    Function ClearCaches

    ' Clear IE temporary file and cookies
    RemoveFolderAndFiles strTemporaryInternetFilePath, False, True
    'msgbox strTemporaryInternetFilePath

    RemoveFolderAndFiles strTemporaryInternetFilePath1, False, True
    ' Delete Java cache
    ' Because of issues with the version on the jre (could be mutliple versions)
    'and the different states of the control panel, it was decided to remove cache folders/files without using Java Control Panel.
    ' Engineering felt that it should not be a problem.
    'RemoveFolderAndFiles strJavaCachePath, True, True
    'msgbox strJavaCachePath

    'Delete the Browse and File Cache files
    RemoveFolderAndFiles strBrowseFileCacheLocation, True,True
    'msgbox strBrowseFileCacheLocation

    End Function

    '*********************************************************************
    ' Sub Name: RemoveFolderAndFiles
    ' Purpose: Removes Files and Folders
    ' Assumptions: None
    ' Inputs:  strFolder -  Folder to remove file/subfolders
    ' bLeaveFolder - Remove sub folders and all files but not main folder
    ' bForceDelete - Force delete
    ' Return Values:  Nothing
    '*********************************************************************
    Public Sub RemoveFolderAndFiles(strFolder,  bLeaveFolder,  bForceDelete)
    Dim Folder
    Dim Folders
    Dim Files
    Dim File
    Dim fso

    On error Resume Next
                    Set fso = CreateObject("Scripting.FileSystemObject")
        if (fso.folderExists(strFolder) = True and bLeaveFolder = False) then
            call fso.DeleteFolder(strFolder, bForceDelete)
        end if

        If (fso.folderExists(strFolder) = True and bLeaveFolder = True) then
              Set Folder = fso.GetFolder(strFolder)
              Set Files = Folder.Files
                For each File in Files
                      File.Delete
                Next

               Set Folders = Folder.SubFolders
                  For each Folder in Folders
                  call fso.DeleteFolder(strFolder + "\" + Folder.Name, bForceDelete)
                  Next
        end if

    On error goto 0

                    Set Folder = Nothing
                    Set Folders = Nothing
                    Set Files = Nothing
                    Set File = Nothing
                    Set fso = Nothing
    End Sub
    '********************************************************************
    '********************************************************************