Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Удаление файлов из корзины 
Author Message
Flasher



PostPosted: Fri Jul 20, 2018 18:15    Post subject: Reply with quote

Lisabon
Тогда так:
Code:
'====== VBS ======
' Очистить корзину
'===== Flasher © =
Option Explicit: Dim RBin, Old, Par, Str, i, L, Title, A
Set RBin = CreateObject("Shell.Application").NameSpace(10)
With CreateObject("Scripting.FileSystemObject")
  Old = .GetFileVersion(.GetSpecialFolder(1) & "\shell32.dll") < "6.0.6"
  If Old Then Par = 625 : Str = 6 Else Par = 1050 : Str = 8
  If RBin.Items.Count = 1 Then
    If .FileExists(RBin.Items.Item(0).Path) Then
      If Old Then Par = 1042 : Str = 9 Else Par = 1055 : Str = 13
    Else
      If Old Then Par = 1043 : Str = 3 Else Par = 1056 : Str = 4
    End If
  End If
End With
RBin.Self.InvokeVerb "Empty"
With CreateObject("CDO.Message").AddAttachment("res://shell32.dll/6/" & Par).GetDecodedContentStream
  .Type = 1
  For i = 0 To Str
    L = AscB(.Read(2)) * 2 : If L > 0 Then Title = CStr(.Read(L))
  Next
End With
With CreateObject("WScript.Shell")
  Do : A = .AppActivate(Title) : Loop Until A
  WSH.Sleep 10 : .SendKeys "~"
End With
While RBin.Items.Count : WSH.Sleep 400 : Wend
Set RBin = Nothing
Либо:
Code:
'=================
' Очистить корзину
'=================
Set RBin = CreateObject("Shell.Application").Namespace(10)
With CreateObject("Scripting.FileSystemObject")
  While RBin.Items.Count
    Path = .GetParentFolderName(RBin.Items.Item(0).Path)
    .DeleteFolder Path & "\*", 1 : .DeleteFile Path & "\*", 1
  Wend
End With
Set RBin = Nothing

_________________
Автору сборки TC Image (Andrey_A) настоятельно рекомендуется не распространять на иных ресурсах любую предоставленную мной где-либо техническую информацию по автоматизации и оптимизации в работе с ТС и системой.


Last edited by Flasher on Sat Jul 21, 2018 16:26; edited 2 times in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group