Sign in to follow this  
Followers 0
Shawndt

Disclean up

3 posts in this topic

Good Morning Gents

The code below I found here for Disk clean, Regclean and Defrag.

I run the code and i recieve. I am not sure what this mean. Can someone shed some light on this or no of a better script to run. Thank you for your kind attention.

C:\PossibleCleanUp.au3(93,32) : ERROR: AdlibEnable(): undefined function.

AdlibEnable("_WindowSearch", 10)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\PossibleCleanUp.au3(97,14) : ERROR: AdlibDisable(): undefined function.

AdlibDisable()

AutoIt Version: 3.3.4.0
 Author: 
 Script Function:
    AutoIt script Automate Diskclean up ; Reg Cleaner ; Disk Defragmentor.

#ce ----------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=ClnMgr.ico
#AutoIt3Wrapper_outfile=..\DiskCleanup.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=Automated and Silent execution of the Windows Disk Cleanup utility.
#AutoIt3Wrapper_Res_Fileversion=1.0.0.14
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Field=.Active Setup Temp Folders|Enabled
#AutoIt3Wrapper_Res_Field=.Compress old files|Enabled
#AutoIt3Wrapper_Res_Field=.Content Indexer Cleaner|Enabled
#AutoIt3Wrapper_Res_Field=.Downloaded Program Files|Enabled
#AutoIt3Wrapper_Res_Field=.Internet Cache Files|Enabled
#AutoIt3Wrapper_Res_Field=.Memory Dump Files|Enabled
#AutoIt3Wrapper_Res_Field=.Old ChkDsk Files|Enabled
#AutoIt3Wrapper_Res_Field=.Recycle Bin|Enabled
#AutoIt3Wrapper_Res_Field=.Remote Desktop Cache Files|Enabled
#AutoIt3Wrapper_Res_Field=.Setup Log Files|Enabled
#AutoIt3Wrapper_Res_Field=.Temporary Files|Enabled
#AutoIt3Wrapper_Res_Field=.WebClient and WebPublisher Cache|Enabled
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <File.au3>
#include <String.au3>
#Include <Misc.au3>
_Singleton("Global\CleanDisk", 2)


;## CleanMgr

Dim Const $RegPath    = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\"
Dim Const $StateFlag    = "StateFlags0064"
Dim Const $REGDWORD  = "REG_DWORD"

Dim Const $Process    = "CleanMgr.exe"
Dim Const $RunCmd      = $Process & " /sageset: n"
Dim Const $WindTitle    = "Disk Cleanup"
Dim Const $LogPath    = "C:\SetupLogs\DiskClean.log"

Dim Const $Enabled    = 2
Dim Const $Disabled  = 0

Global $Status[3]

_FileWriteLog($LogPath, " ********* Start Disk Cleanup *********")

If ProcessExists($Process) Then
    _FileWriteLog($LogPath, "Utility is allready running.")
    _FileWriteLog($LogPath, "Operation Interupted RC=514")
    _FileWriteLog($LogPath, " ********* End HRA-O Disk Cleanup *********" & @CRLF & _StringRepeat("*", 80))
    Exit 514
EndIf

_FileWriteLog($LogPath, "Adding Registry entries to automate CleanMgr.exe")

AddHandler_FireFox();   <== Add FireFox Support

RegWrite($RegPath & "Active Setup Temp Folders"         , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Compress old files"                , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Content Indexer Cleaner"           , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Downloaded Program Files"          , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Internet Cache Files"              , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Memory Dump Files"                 , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Old ChkDsk Files"                  , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Recycle Bin"                       , $StateFlag, $REGDWORD, $Disabled)
RegWrite($RegPath & "Remote Desktop Cache Files"        , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Setup Log Files"                   , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "Temporary Files"                   , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "WebClient and WebPublisher Cache"  , $StateFlag, $REGDWORD, $Enabled)
RegWrite($RegPath & "FireFox Cache"                     , $StateFlag, $REGDWORD, $Enabled)

Dim $Drives = DriveGetDrive("FIXED")

For $i = 1 to $Drives[0]
    _FileWriteLog($LogPath, "Free Drive Space on Drive " & StringUpper($Drives[$i]) & " = " & DriveSpaceFree( $Drives[$i] & "\" ) & " MB")
Next

_FileWriteLog($LogPath, "Executing Disk Cleanup Utility")

Local $PID = Run($RunCmd, "", @SW_HIDE)
ProcessSetPriority($Process, 1)

_FileWriteLog($LogPath, "Disk Cleanup Utility PID=" & $PID)

AdlibEnable("_WindowSearch", 10)
    While ProcessExists($Process)
        Sleep(1000)
    WEnd
AdlibDisable()

_FileWriteLog($LogPath, "Disk Cleanup Utility operation completed")

For $i = 1 to $Drives[0]
    _FileWriteLog($LogPath, "Free Drive Space on Drive " & StringUpper($Drives[$i]) & " = " & DriveSpaceFree( $Drives[$i] & "\" ) & " MB")
Next

_FileWriteLog($LogPath, "Operation Completed RC=512" )
_FileWriteLog($LogPath, " ********* End Disk Cleanup *********" & @CRLF & _StringRepeat("*", 80))
Exit 512

Func _WindowSearch()
    Local $TempText = WinGetText($WindTitle)
    If WinExists($WindTitle) Then
        Local $Data
       
        If Bitand(WinGetState($WindTitle), 2) Then
            WinSetState($WindTitle, "", @SW_HIDE)
        EndIf
       
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static2]")
        If $Data <> "" Then
            If $Data <> $Status[0] Then
                $Status[0] = $Data
                _FileWriteLog($LogPath, "Status: " & $Data)
            EndIf
        EndIf
       
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static3]")
        If $Data <> "" Then
            If $Data <> $Status[1] Then
                $Status[1] = $Data
                _FileWriteLog($LogPath, "Status: " & @TAB & $Data)
            EndIf
        EndIf
       
        $Data = ControlGetText($WindTitle, "", "[CLASSNN:Static4]")
        If $Data <> "" Then
            If $Data <> $Status[2] Then
                $Status[2] = $Data
                _FileWriteLog($LogPath, "Status: " & @TAB & @TAB & $Data)
            EndIf
        EndIf
    EndIf
   
    If WinExists("Recycle Bin", " is corrupted. Do") Then
        ControlClick("Recycle Bin", " is corrupted. Do", 6)
    EndIf
EndFunc

Func AddHandler_FireFox()
    Local Const $KeyPath            = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\FireFox Cache"
    Local Const $Default            = "{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}"
    Local Const $Display            = "FireFox Cache"
    Local Const $Description        = "Cleans the firefox cache (FIREFOX MUST BE CLOSED)"
    Local Const $FileList           = "*.*"
    Local Const $CSIDL              = 0x1C
    Local Const $StateFlags0064     = 0x2
    Local Const $StateFlags         = 0x1
    Local Const $IconPath           = "%ProgramFiles%\Mozilla Firefox\firefox.exe,2"
    Local Const $LastAccess         = 0x0
    Local Const $DWORD              = "REG_DWORD"
    Local Const $EXPANDSZ           = "REG_EXPAND_SZ"
    Local Const $SZ                 = "REG_SZ"
   
    ;## Get the Path to the Firefox Cache folder
        Local $Folder = GetSpecialFolder(0x1C) & "\Mozilla\Firefox\Profiles\"
        Local $Search = FileFindFirstFile($Folder & "*.default")
       
        $Folder = "Mozilla\Firefox\Profiles\" & FileFindNextFile($Search) & "\Cache"
   
    ;## Add new Disk Cleanup Handler to the registry
        RegWrite($KeyPath, "",              $SZ,        $Default)
        RegWrite($KeyPath, "CSIDL",         $DWORD,     $CSIDL)
        RegWrite($KeyPath, "Display",       $SZ,        $Display)
        RegWrite($KeyPath, "Description",   $SZ,        $Description)
        RegWrite($KeyPath, "FileList",      $SZ,        $FileList)
        RegWrite($KeyPath, "Folder",        $SZ,        $Folder)
        RegWrite($KeyPath, "IconPath",      $EXPANDSZ,  $IconPath)
        RegWrite($KeyPath, "LastAccess",    $DWORD,     $LastAccess)
        RegWrite($KeyPath, "StateFlags",    $DWORD,     $StateFlags)
EndFunc

Func GetSpecialFolder($CSIDL)

    Local $Path = DllStructCreate("char Path[" & 0x104 & "]")
    Local $Dll = DllOpen("Shell32.dll")
   
    $result = DllCall($Dll, "int", "SHGetSpecialFolderPath", "hwnd", 0, "ptr", DllStructGetPtr($Path), "Long", $CSIDL, "int", 0)
   
    #cs http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx
        SHGetSpecialFolderPath Function

        Retrieves the path of a special folder, identified by its CSIDL.

        Syntax

            BOOL SHGetSpecialFolderPath(     
                HWND hwndOwner,
                LPTSTR lpszPath,
                int csidl,
                BOOL fCreate
            );

        Parameters

            hwndOwner
                Reserved.
            lpszPath
                [out] A pointer to a null-terminated string that receives the drive and path of the specified folder. This buffer must be at least MAX_PATH characters in size.
            csidl
                [in] A CSIDL that identifies the folder of interest. If a virtual folder is specified, this function will fail.
            fCreate
                [in] Indicates whether the folder should be created if it does not already exist. If this value is nonzero, the folder will be created. If this value is zero, the folder will not be created.

        Return Value

            TRUE if successful; otherwise, FALSE.

        Remarks

            The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.
            With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll.
    #ce
   
    DllClose($Dll)

    If $result[0] = True Then Return DllStructGetData($Path, "Path")
   
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Probably you have AutoIT < ver. 3.3.4.0 History

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Probably you have AutoIT < ver. 3.3.4.0 History

So those lines referencing should be removed?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0