Special Folders: Recycle Bin
It creates a columnar list of your recycle bin contents. Eg. File Name, Size, Type, Date Deleted. You can easily add more items such as original location, etc. Place this script in a Text Object then click it to generate the list.
Const MY_RECENT_DOCUMENTS = &H8&
Const RECYCLE_BIN = &Ha&
'Const MY_COMPUTER = &H11&
'Const NETHOOD = &H13&
Const DATE_DEL = 2
Const FILE_SIZE = 3
Const FILE_TYPE = 4
'Constants for size
Const inBYTE = 1
Const inKILO = 1024 ' 2^10
Const inMEGA = 1048576 ' 2^20
Const inGIGA = 1073741824 ' 2^30
Const inTERA = 1099511627776 ' 2^40
Const inPETA = 1.12589990684262E+15 ' 2^50
Const inEXA = 1.15292150460685E+18 ' 2^60
Const inZETTA = 1.18059162071741E+21 ' 2^70
Const inYOTTA = 1.20892581961463E+24 ' 2^80
Set objShell = CreateObject("Shell.Application")
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
'Call CreateList
Call BuildArray
End If
End Function
Dim arrData( )
' Build MultiDimensional Array
Function BuildArray
Set objFolder = objShell.Namespace(RECYCLE_BIN)
Set objFolderItem = objFolder.Self
Set colItems = objFolder.Items
objCount=colItems.Count
intRows=objCount-1
r=0 ' Rows
For Each objItem In colItems
strName=objItem.Name
strSize = objFolder.GetDetailsOf(objItem, FILE_SIZE)
strType = objFolder.GetDetailsOf(objItem, FILE_TYPE)
dtmDel = objFolder.GetDetailsOf(objItem, DATE_DEL)
arrSize = Split(strSize, " ")
intSize = CLng(arrSize(0))
ReDim Preserve arrData(intRows,4)'rows,columns
arrData(r,0)=strName
arrData(r,1)=intSize
arrData(r,2)=strType
arrData(r,3)=dtmDel
r=r+1
'intSize=intSize*inKILO
'intTotal=intTotal+intSize ' Running Total
'Object.Text=Object.Text&objItem.Name&vbtab&intSize&vbtab&strType&vbtab&dtmDel&vbcrlf
Next
object.text=""
Call DisplayData
End Function
Function FileSize(intSize)
If intSize < inKILO Then
fSize = (intSize/inBYTE)
FileSize = FormatNumber(fSize,,,,0) & " Bytes"
ElseIf intSize < inMEGA Then
fSize = (intSize/inKILO)
FileSize = FormatNumber(fSize,,,,0) & " KB"
ElseIf intSize < inGIGA Then
fSize = (intSize/inMEGA)
FileSize = FormatNumber(fSize,,,,0) & " MB"
ElseIf intSize < inTERA Then
fSize = (intSize/inGIGA)
FileSize = FormatNumber(fSize,,,,0) & " GB"
End If
End Function
'Called when the script is executed
Sub Object_OnScriptEnter
object.text="Click Here for ultimate sexyness!"
End Sub
' Reads & formats multidimensional array data
Sub DisplayData
' Lame work around since VBScript has pathetic sort options
arrColPos=Array(100,100,100,100)
' Column Header
Object.Text="File Name"&String(26,Chr(160))&_
"File Size"&String(26,Chr(160))&_
"File Type"&String(26,Chr(160))&_
"Date Deleted"&String(23,Chr(160))&_
vbcrlf
For r=0 To UBound(arrData) ' Rows Statement
For c=0 To 4 ' Nested Columns Statement
If c = 1 Then
intSize=FileSize(arrData(r, c)*inKILO)
'intSize =arrData(r, c)*inKILO
intTotal=intTotal+(arrData(r, c)*inKILO) ' Running Total
strData=intSize
ElseIf c<>1 Then
strData=arrData(r, c)
End If
' Count Characters
lngColDim=Len(strData)
lngTCol=35'arrColPos(c)
iValue=lngTCol-lngColDim
If lngColDim<lngTCol Then strSpaces=String(iValue,Chr(160))
Object.Text=Object.Text&strData&strSpaces
Next
Object.Text=Object.Text&strData&vbcrlf
Next
intTotal=FileSize(intTotal)
Object.Text=Object.Text&"TOTAL: "&UBound(arrData)+1&" items, "&intTotal
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
object.text=""
End Sub