<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10206&amp;type=atom" />
	<updated>2014-12-04T17:57:38Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10206</id>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88885#p88885" />
			<content type="html"><![CDATA[<p>СПАСИБО!!! А я два часа промучался. И нафига эти му..ки добавили &quot;кбит в сек.&quot; ????</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2014-12-04T17:57:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88885#p88885</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88839#p88839" />
			<content type="html"><![CDATA[<p>Логично, он же возвращает текст &lt;№&gt; кбит в сек.&nbsp; &nbsp;&gt;&gt;&gt;<br /></p><div class="codebox"><pre><code>         If Mid(Split(bit)(0), 2) &lt; 400   Then</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2014-12-03T21:10:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88839#p88839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88837#p88837" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Flasher пишет:</cite><blockquote><div class="quotebox"><cite>griha09 пишет:</cite><blockquote><p>Почему?</p></blockquote></div><p>В 18-м элементе присутствует юникодный символ. Добавляем: ... True<strong><span style="color: red">, -1</span></strong>).</p></blockquote></div><p>Ой, спасибо, никогда б не догадался.</p><p>Еще вопрос:<br />при сравнении по видеобитрейту&nbsp; &nbsp; &nbsp; <br /></p><div class="codebox"><pre><code>
 bit = .GetDetail(282)
         if CInt(bit) &lt; 400   Then</code></pre></div><p>ругается &quot;Несоответствие типа: &#039;CInt&#039; код 800A000D<br />перебрал уже все функции преобразования типов данных.</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2014-12-03T20:56:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88837#p88837</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88836#p88836" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>griha09 пишет:</cite><blockquote><p>Почему?</p></blockquote></div><p>В 18-м элементе присутствует юникодный символ. Добавляем: ... True<strong><span style="color: red">, -1</span></strong>).</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2014-12-03T20:28:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88836#p88836</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88835#p88835" />
			<content type="html"><![CDATA[<p>Решил сделать вывод информации в файл из предыдущего скрипта<br /></p><div class="codebox"><pre><code>
Option Explicit
Dim oFileDetailsReader, sTmpStr, sValue, i, input, output, objFSO, TextStream
input = &quot;C:\test.avi&quot;        
output= &quot;otchet.txt&quot;    &#039;файл отчета


Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set TextStream = objFSO.OpenTextFile(output, 2, True)

TextStream.WriteLine &quot;----- &quot; &amp; Now &amp; &quot; -----&quot;

Set oFileDetailsReader = New cFileDetailsReader
With oFileDetailsReader
    .OpenFile input
    For i=1 to 288
        sValue = .GetDetail(i)
        if sValue &lt;&gt; &quot;&quot; Then
            sTmpStr = sTmpStr &amp; i &amp; &quot;) &quot; &amp; .GetDetailName(i) &amp; &quot; - &quot; &amp; sValue &amp; vbCrlf
        End if
    Next
    TextStream.Write(sTmpStr)
End With

TextStream.close

Class cFileDetailsReader
    Private oFSO, oShellApp, oFolder3, oFolderItem
    
    Private Sub Class_Initialize()
        Set oFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
        Set oShellApp = CreateObject(&quot;Shell.Application&quot;)
    End Sub
    
    Sub OpenFile(FilePath)
        With oFSO.GetFile(FilePath)
            Set oFolder3 = oShellApp.NameSpace(.ParentFolder.Path)
            Set oFolderItem = oFolder3.ParseName(.Name)
        End With
    End Sub
    
    Function GetDetail(Index)
        GetDetail = oFolder3.GetDetailsOf(oFolderItem,Index)
    End Function

    Function GetDetailName(Index)
        GetDetailName = oFolder3.GetDetailsOf(0,Index)
    End Function
End Class
</code></pre></div><p> но почему-то матерится &quot;Недопустимый вызов или аргумент процедуры&quot; код 800A0005<br /> на строку&nbsp; &nbsp; TextStream.Write(sTmpStr) <br />Почему?</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2014-12-03T19:47:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88835#p88835</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88831#p88831" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Xameleon пишет:</cite><blockquote><p><strong>griha09</strong>,<br />1) А вариант с <strong>GetDetailsOf</strong> не подходит ? В Win 7 ширина и высота кадра - 285-й и 283-й элемент коллекции.<br />2) Не понял, что мешает собрать всё на JS или VBS ?</p></blockquote></div><p>Оба варианта подходят, но мешает отсутствие знаний <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>СПАСИБО ЗА ПРИМЕР!!!<br />Буду разбираться.</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2014-12-03T16:56:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88831#p88831</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88824#p88824" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>В Win 7 ширина и высота кадра в 235-ом и 238-ом элементах коллекции.</p></blockquote></div><p>283/285. <br />For i=1 to 1000 - тут до 288 достаточно.<br />Вместо MsgBox лучше WScript.Echo, а то обрежет.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2014-12-03T11:21:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88824#p88824</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88822#p88822" />
			<content type="html"><![CDATA[<p><strong>griha09</strong>,<br />1) А вариант с <strong>GetDetailsOf</strong> не подходит ? В Win 7 ширина и высота кадра - 285-й и 283-й элемент коллекции.<br />2) Не понял, что мешает собрать всё на JS или VBS ?</p><p>В качестве пояснения о чём я говорю:<br /></p><div class="codebox"><pre><code>
Option Explicit
Dim oFileDetailsReader, sTmpStr, sValue, i
if WScript.Arguments.Count = 0 Then
    MsgBox &quot;Файл не выбран ! Для получения информации о файле, перетащите его на скрипт.&quot;, vbExclamation, &quot;VBScript&quot;
    WScript.Quit
End if
Set oFileDetailsReader = New cFileDetailsReader
With oFileDetailsReader
    .OpenFile WScript.Arguments(0)
    For i=1 to 288
        sValue = .GetDetail(i)
        if sValue &lt;&gt; &quot;&quot; Then
            sTmpStr = sTmpStr &amp; i &amp; &quot;) &quot; &amp; .GetDetailName(i) &amp; &quot; - &quot; &amp; sValue &amp; vbCrlf
        End if
    Next
    MsgBox sTmpStr
End With

Class cFileDetailsReader
    Private oFSO, oShellApp, oFolder3, oFolderItem
    
    Private Sub Class_Initialize()
        Set oFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
        Set oShellApp = CreateObject(&quot;Shell.Application&quot;)
    End Sub
    
    Sub OpenFile(FilePath)
        With oFSO.GetFile(FilePath)
            Set oFolder3 = oShellApp.NameSpace(.ParentFolder.Path)
            Set oFolderItem = oFolder3.ParseName(.Name)
        End With
    End Sub
    
    Function GetDetail(Index)
        GetDetail = oFolder3.GetDetailsOf(oFolderItem,Index)
    End Function

    Function GetDetailName(Index)
        GetDetailName = oFolder3.GetDetailsOf(0,Index)
    End Function
End Class
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2014-12-03T08:58:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88822#p88822</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBScript & JScript надо связать ширину видеокадра и перенос файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88821#p88821" />
			<content type="html"><![CDATA[<p>В видеоредакторе Avidemux 2.5 командная строка основана на ECMAScript 5. Для обработки видеофайлов я давно пользуюсь такой конструкцией из 2х файлов.</p><p>Avidemux.vbs<br /></p><div class="codebox"><pre><code>
input = &quot;f:\00\&quot;
output= input&amp;&quot;output_xvid\&quot;        
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set WSHShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
If not objFSO.FolderExists(output) Then objFSO.CreateFolder output         

RecursiveFolderScan input

&#039;Создаём процедуру рекурсивного обхода каталога
Sub RecursiveFolderScan(FolderPath)
    &#039;Получаем объектную модель текущего каталога
    Set Folder = objFSO.GetFolder(FolderPath)
    &#039;Перебираем все файлы в текущем каталоге
    For Each File in Folder.Files
WSHShell.Run &quot;&quot;&quot;C:\Program Files\Avidemux 2.5\avidemux2_cli.exe&quot;&quot;  --force-alt-h264  --force-unpack --load &quot;&quot;&quot; &amp; File &amp; &quot;&quot;&quot; --run xvid.js --save &quot;&quot;&quot; &amp; output &amp; File.Name &amp; &quot;&quot;&quot; --quit&quot;,2,True
    Next
End Sub

Set WSHShell = Nothing
</code></pre></div><p>xvid.js<br /></p><div class="codebox"><pre><code>
var app = new Avidemux();
var width, height;
        width = app.video.width;   // ширина видеокадра
        height = app.video.height; // высота видеокадра

    if (width &gt; 700)    // если ширина видеокадра больше 700px
    {
       различные видеофильтры итд
    }
         app.setContainer(&quot;AVI&quot;);


</code></pre></div><p>Сейчас захотелось отсортировать видеофайлы по ширине видеокадра т.е. если ширина видеокадра больше 700px то файл переносим в др.папку. Вот с переносом возникли проблемы. Попробовал так <br />xvid.js<br /></p><div class="codebox"><pre><code>
var app = new Avidemux();
var width, height;
  var sSrcFolderName = &quot;.&quot;;
    var sDstFolderName = &quot;f:\\000&quot;;
 var FSO = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;); 
    var file2  = FSO.GetFile(app); 
        width = app.video.width;   // ширина видеокадра
        height = app.video.height; // высота видеокадра
    if (width &gt; 700)    // если ширина видеокадра больше 700px
    {
  file2.Copy(sDstFolderName);
 file2.Delete();
    }
        app.setContainer(&quot;AVI&quot;);</code></pre></div><p>не работает. Пробовал так <br /></p><div class="codebox"><pre><code> app.Copy(sDstFolderName);
 app.Delete();</code></pre></div><p>тоже не работает. <br />Я вижу три возможных варианта решения<br />1.в js-файле перенести файлы. Как?<br />2.в vbs определить ширину видеокадра. Как?<br />3. в js-файле создать флаговую переменную, а потом в vbs ее прочитать и на основании ее значения переносить файл. Как? (но, по-моему, это извращение)</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2014-12-02T19:16:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88821#p88821</id>
		</entry>
</feed>
