'===================================================================
' Выделение в панелях одноимённых файлов и/или папок
' Файлы могут быть выделены в т.ч. в режиме без подкаталогов
' Параметры: "%P" "%T" <файлы/каталоги/всё: 1/2/3>
' Автор: Flasher ©
'====================== Путь к утилите TCFS2 =======================
TCFS2 = """%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe"""
'===================================================================
With WScript.Arguments
If .Count < 3 Then MsgBox "Укажите все требуемые параметры!", 48,_
Space(13) & "Выделение элементов в панели" : WScript.Quit
P = .Item(0) : T = .Item(1) : C = .Item(2)
End With
If P = T Then CreateObject("WScript.Shell")._
Run TCFS2 & " /ef tcm(536)" : WScript.Quit
Select Case C : Case 1 Tp = 192 : Case 2 Tp = 160 : Case 3 Tp = 224 : End Select
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Dict = CreateObject("Scripting.Dictionary")
Set Col1 = CreateObject("Scripting.Dictionary")
Set Col2 = CreateObject("Scripting.Dictionary")
Set Col3 = CreateObject("Scripting.Dictionary")
Set ShA = CreateObject("Shell.Application")
Recursion P : Test = 1 : Recursion T
If Col1.Count And Col2.Count Then
With CreateObject("WScript.Shell")
TempFile = ShA.NameSpace(.ExpandEnvironmentStrings("%TEMP%"))._
Self.Path & "\" & FSO.GetTempName
FSO.CreateTextFile(TempFile, 1, True).Write vbCr & Join(Col1.Keys, vbNewLine)
.Run "%comspec% /c clip <""" & TempFile & """",0,True
.Run TCFS2 & " /ef msg($0B,0) tcm(2033,0) send({TAB})",,True
FSO.CreateTextFile(TempFile, 1, True).Write vbCr & Join(Col2.Keys, vbNewLine)
.Run "%comspec% /c clip <""" & TempFile & """",0,True
.Run TCFS2 & " /ef tcm(2033,0) send({TAB}) msg($0B,1) redraw()",,True
.Run "%comspec% /c type|clip",0
End With : FSO.DeleteFile TempFile, 1
End If
Sub Recursion(Fd)
Set Items = ShA.NameSpace(Fd).Items : Items.Filter Tp, "*"
If Test <> 1 Then
For Each F in Items
Dict.Add "\" & Mid(F.Path, Len(P) + 1) & "\", ""
Next
Else
For Each F in Items
Mass = Filter(Dict.Keys, "\" & F & "\")
If Ubound(Mass) >= 0 Then
S = "" : N = 2 : If C > 1 And F.IsFolder Then N = 1 : S = "\"
If Not Col3.Exists(CStr(F)) Then
For Each Fl in Mass : Col1.Add Mid(Fl, 2, Len(Fl) - N), "" : Next
Col3.Add CStr(F), ""
End If : Col2.Add Mid(F.Path, Len(T) + 1) & S, ""
End If
Next
End If
If C = 1 Then
Items.Filter 160, "*"
For Each F in Items
If InStr(F.Type, "ZIP") = 0 Then Recursion F.Path
Next
End If
End Sub |