Avisynth
Select messages from
# through # FAQ
[/[Print]\]
Goto page Previous  1, 2  :| |:
Total Commander -> Автоматизация Total Commander

#16:  Author: FlasherLocation: Москва PostPosted: Mon Dec 19, 2016 21:10
    —
Давай конкретно.
Было
Code:
A = FFAudioSource("путь")
V = FFVideoSource("путь")
В 3-м параметре FFVideoSource.
Что на выходе? А если AviSource?

#17:  Author: Dimsok PostPosted: Mon Dec 19, 2016 21:15
    —
Если в параметре кнопки FFVideoSource, то будет просто FFVideoSource("путь") (видео без звука), ну и AviSource("путь") соответственно во втором случае. Формировать фильтры с переменными не надо, только их заменять.

#18:  Author: FlasherLocation: Москва PostPosted: Mon Dec 19, 2016 21:21
    —
Когда переходят к конкретике и спрашивают "что на выходе?", предполагают текст кода, а не описание того, как должно быть. Иначе возникает куча доп. вопросов. В частности, касаемо необходимости сохранять элементы присвоения или перезаписывать строки целиком, как запрошено в исходном посте.

#19:  Author: Dimsok PostPosted: Mon Dec 19, 2016 21:26
    —
A = FFAudioSource("путь")
V = FFVideoSource("путь")

Параметр: FFVideoSource

Итог: FFVideoSource("путь")

Параметр: AviSource

Итог: AviSource("путь")

Строки перезаписываются полностью. Никаких "A =" не сохраняется.

#20:  Author: FlasherLocation: Москва PostPosted: Mon Dec 19, 2016 21:56
    —
Code:
'========================================== VBS =========================================
' Добавление/замена сверху содержимого AVS-скрипта команд(ы) фильтра с путём к видеофайлу
' Параметры: "<путь к avs>" "<путь к видео>" <команда фильтра>
' Пример: %V %T%M AviSource
'========================================================================================
With WSH.Arguments
  If .Count <> 3 Then MsgBox "Укажите 3 параметра!", 4144, " Правка (создание) AVS" : WSH.Quit
  AVS = .Item(0) : Video = .Item(1) : Pref = .Item(2)
End With : Str = Pref & "(""" & Video & """)"
Exs = "|asf|avi|divx|flv|mkv|mov|mp4|mpg|ts|"
With CreateObject("Scripting.FileSystemObject")
  If .FileExists(Video) And InStr(Exs, "|" & LCase(.GetExtensionName(Video) & "|")) Then
    If .FileExists(AVS) And LCase(.GetExtensionName(AVS)) = "avs" Then
      If .GetFile(AVS).Size <> 0 Then
        With .OpenTextFile(AVS)
          For i = 1 to 3
            Execute "Str" & i & " = .ReadLine" : If .AtEndOfStream Then Exit For
          Next : If Not .AtEndOfStream Then All = .ReadAll End If : .Close
        End With
        With New Regexp
          .IgnoreCase = True : .Pattern = "\w+Source\(.+\)" : L = vbNewLine
          If .Test(Str1) Then
            If Not .Test(Str2) Then Str = Str & L & Str2
            .Pattern = "^AudioDub *\( *V, *A\)$"
            If Not .Test(Str3) Then Str = Str & L & Str3
          End If
        End With : If Not IsEmpty(All) And InStr(All, L) <> 1 Then All = L & All
      End If :  .OpenTextFile(AVS, 2).Write Str & All
    Else nAVS = .GetParentFolderName(AVS) & "\" & .GetBaseName(Video) & ".avs"
         If Not .FileExists(nAVS) Then .CreateTextFile(nAVS).Write Str
    End If
  End If
End With


Last edited by Flasher on Tue Dec 20, 2016 15:57; edited 7 times in total

#21:  Author: Dimsok PostPosted: Mon Dec 19, 2016 22:08
    —
Почему-то для некоторых avs ошибку выдаёт.

Line:18
Char:56
Input past end of file

Например, для такого вида:
AviSource("asdfa")
Trim(1668,1831)

Добавлено спустя 2 минуты:

Я так понимаю, в avs должно быть 3 или более строк, тогда ошибки нет.

#22:  Author: FlasherLocation: Москва PostPosted: Mon Dec 19, 2016 22:14
    —
Исправил.
+ добавку лишних переводов строк убрал.

#23:  Author: Dimsok PostPosted: Mon Dec 19, 2016 22:26
    —
Благодарю.
Ну и если не сложно, добавь, чтобы искал в третьей строке AudioDub(V, A), и при нахождении удалял.

#24:  Author: FlasherLocation: Москва PostPosted: Mon Dec 19, 2016 22:51
    —
Добавил.



Total Commander -> Автоматизация Total Commander


output generated using printer-friendly topic mod. All times are GMT + 4 Hours

Goto page Previous  1, 2  :| |:
Page 2 of 2

Powered by phpBB © 2001, 2005 phpBB Group