'========================================================================================
' Выделение в панелях одноимённых файлов с разными расширениями
' Условие: помимо наличия TCFS2 должен быть установлен плагин TCFS2Tools
' Параметры: "%P" "%T" <расширение для активной панели> <расширение для пассивной панели>
' Пример: "%P" "%T" txt lst
'================================= Путь к утилите TCFS2 =================================
TCFS2 = "%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe"
'========================================================================================
With WScript.Arguments
If .Count < 4 Then MsgBox "Укажите все требуемые параметры!", 48,_
Space(13) & "Выделение элементов в панели" : WScript.Quit
P = .Item(0) : T = .Item(1) : Ext1 = .Item(2) : Ext2 = .Item(3)
End With : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim WSH : Set WSH = CreateObject("WScript.Shell")
Set D = CreateObject("Scripting.Dictionary")
Set G = CreateObject("Scripting.Dictionary")
Set SHA = CreateObject("Shell.Application")
Set Path = SHA.NameSpace(P) : Set Targ = SHA.NameSpace(T)
Set Items = Path.Items : Items.Filter 192, "*." & Ext1
For Each F in Items : D.Add FSO.GetBaseName(F), "" : Next
Set Items = Targ.Items : Items.Filter 192, "*." & Ext2
For Each F in Items : G.Add FSO.GetBaseName(F), "" : Next
For Each F in D.Keys
If G.Exists(F) Then
List1 = List1 & vbnewline & F & "." & Ext1
List2 = List2 & vbnewline & F & "." & Ext2
End If
Next
With CreateObject("InternetExplorer.Application")
.Navigate("about:blank")
Clip = .Document.ParentWindow.ClipboardData.GetData("text")
.Document.ParentWindow.ClipboardData.SetData "text", Mid(List1,1)
WSH.Exec TCFS2 & " /ef msg($0B,0) tcm(2033,0) send({TAB})"
.Document.ParentWindow.ClipboardData.SetData "text", Mid(List2,1)
WSH.Exec TCFS2 & " /ef tcm(2033,0) send({TAB}) msg($0B,1) redraw()"
.Document.ParentWindow.ClipboardData.SetData "text", String(1,Clip)
.ExecWB 45, 2 : .Quit
End With : D.RemoveAll : G.RemoveAll : Set D = Nothing : Set G = Nothing : Set F = Nothing
Set Path = Nothing : Set Targ = Nothing : Set Items = Nothing : Set WSH = Nothing : Set FSO = Nothing |