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: Tue Aug 06, 2019 03:52    Post subject: Reply with quote

Тестируй:
Code:
'============================ 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

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


Last edited by Flasher on Tue Aug 06, 2019 04:54; edited 6 times in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group