Jump to content

Enhancing this clean temporary folders, recycle bin ...


Recommended Posts

Good afternoon!

Through searching in the forums, I found syntax to clean up the recycle bin and the clipboard and partial help on emptying folders. However, unlike some of the code I've found, which is beyond me as it's very complicated, I've found the type of structure that would work ... if I can translate it to proper AI syntax. Below would be an ideal script in structure:

;
; AutoIt v3.0
;

SoundSetWaveVolume(85)   ;  adjust volume up
SoundPlay(@ScriptDir & "\WAVS\Windows XP Recycle.wav")   ;  plays a wav file sound
Sleep(500)
SoundSetWaveVolume(15)   ;  adjust volume down

;__________________________________________________________________________________________________

FileRecycleEmpty()   ;  empties the Recycle Bin
;__________________________________________________________________________________________________
_ClipEmpty()   ; empties the clipboard

Func _ClipEmpty()
    Local $Success = 0
    DllCall('user32.dll', 'int', 'OpenClipboard', 'hwnd', 0)
    If @error = 0 Then
        DllCall('user32.dll', 'int', 'EmptyClipboard')
        If @error = 0 Then $Success = 1
        DllCall('user32.dll', 'int', 'CloseClipboard')
        If $Success Then Return 1
    EndIf
    DllCall('user32.dll', 'int', 'CloseClipboard')
    Return 0
EndFunc
;__________________________________________________________________________________________________

; EMPTY TEMPORARY FOLDERS, ETC.:
Delete folder contents (@HomeDrive & @HomePath & "\Recent")
Delete folder contents (@HomeDrive & @HomePath & "\Application Data\Microsoft\Office\Recent")
Delete folder contents (@HomeDrive & @HomePath & "\Local Settings\Temp")
Delete folder contents (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files")
Delete folder contents (@HomeDrive & @HomePath & "\Cookies")
Delete folder contents (@HomeDrive & @HomePath & "\Local Settings\History")

Delete folder contents (@HomeDrive & @HomePath & "\APPS\Firefox Portable\Data\profile\cookies.txt")


Delete folder contents ("C:\Temp")
Delete folder contents ("C:\Temp\Temporary Internet Files")

;__________________________________________________________________________________________________

Exit
; finished

The first 2 sections work and they're straightforward, so okay there. It's the last section that needs finetuning. It would be nice to have a script that one can use on any computer without having to fiddle with it each time when dealing with profiles and location of these folders. I do contract work and I have pretty much switched over everything to a 4-gig USB drive so I really only have to worry about cleaning up my computer periodically with a script such as this. That will allow me to keep the host computer free enough of my having been there thereby keeping it clean.

However, couldn't find the syntax for "Delete folder contents". Also, though I found @HomeDrive and @HomePath in these archives and I believe I am using it correctly, I'm not 100% sure.

Hope that someone can take a look at this and make recommendations to that part of the script on syntax that would work <g>.

Thanks! :)

p.s., the only error correction, or whatever it's called, I can think of, is to use an "if it exists" type of condition for each folder. To empty the folder if it exists, in other words. I might make that addition. Thx. :P

Link to comment
Share on other sites

It looks like you want FileDelete ()

From the Helpfile-

Note: If the "path" passed to FileDelete is a folder, the files therein will be deleted just as if you had used the *.* mask.

So correct me if I interpreted that wrong, but that should do the job :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...