'============================ VBS =============================
' Переименование базового имени субтитра под курсором в базовое
' имя одиночного видеофайла и подходящее языковое расширение
' Параметры: %V <маска расширений видео>
' Пример: %V *.avi;*.mkv;*.mp4
'==============================================================
Option Explicit: Dim Items, F, BN, Ext, sExt, Exts, E
With CreateObject("Scripting.FileSystemObject")
F = WSH.Arguments(0)
If .FileExists(F) Then
Set Items = CreateObject("Shell.Application")._
NameSpace(.GetParentFolderName(F)).Items
Items.Filter 8256, WSH.Arguments(1)
If Items.Count <> 1 Then WSH.Quit
BN = .GetBaseName(Items.Item(0).Path)
Ext = .GetExtensionName(F) : Set Items = Nothing
If InStr("|srt|sub|ass|ssa|", "|" & LCase(Ext) & "|") Then
If InStr("|.eng|.rus|", "|" & Right(LCase(BN), 4) & "|") = 0 Then
sExt = ".rus." : Exts = "srt sub ssa ass"
For Each E in Split(Exts)
If .FileExists(BN & sExt & E) Then sExt = ".eng." : Exit For
Next
If sExt = ".eng." Then
For Each E in Split(Exts)
If .FileExists(BN & sExt & E) Then WSH.Quit
Next
End If
.GetFile(F).Name = BN & sExt & Ext
End If
End If
End If
End With |