<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7197&amp;type=atom" />
	<updated>2012-05-11T21:09:08Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7197</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60226#p60226" />
			<content type="html"><![CDATA[<p>И специалиста — тоже <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />.</p><p><a href="http://msdn.microsoft.com/en-us/library/zw39ybk8(v=vs.85).aspx">With Statement (VBScript)</a>.</p><p>Причём кому-то он так сильно не нравился, что в PoSH его убрали: <a href="http://technet.microsoft.com/en-us/library/ee177030.aspx">Converting VBScript&#039;s With Statement</a>, что довольно-таки странно.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-05-11T21:09:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60226#p60226</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60201#p60201" />
			<content type="html"><![CDATA[<p>С точки зрения неспециалиста — отличная конструкция <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Позволяет «не таскать по скрипту экземпляр объекта» <br />.Close пишется потому как действие сие применяется к объекту указанному в аргументе With</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-05-11T15:29:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60201#p60201</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60190#p60190" />
			<content type="html"><![CDATA[<p>Извините за назойливость, но что это за конструкция With ......End With? В поиске не могу найти описания, если есть дайте ссылку. И почему пишется&nbsp; &quot;.Close&quot;, а не например &quot;File.Close&quot;?</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2012-05-11T13:48:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60190#p60190</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60159#p60159" />
			<content type="html"><![CDATA[<p><strong>griha09</strong>, общий принцип примерно таков:<br /></p><div class="codebox"><pre><code>&#039; IOMode Enum
Const ForReading   = 1
Const ForWriting   = 2
Const ForAppending = 8

Dim objFSO
Dim objFile

Dim boolFound
…


Set objFSO = WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)

For Each objFile In objFSO.GetFolder(strSource).Files
    With objFSO.OpenTextFile(objFile, ForReading)
        boolFound = False
        
        Do Until .AtEndOfStream
            strLine = .ReadLine()
            
            If InStr(1, strLine, word) &lt;&gt; 0 Then
                boolFound = True
                
                Exit Do
            End If
        Loop
        
        .Close
    End With
    
    If boolFound Then
        With objFSO.OpenTextFile(objFile, ForAppending)
            .WriteLine(&quot;&lt;!--OK--&gt;&quot;)
            .Close
        End With
    End If
Next</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-05-11T08:10:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60159#p60159</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60150#p60150" />
			<content type="html"><![CDATA[<p>закрыл вот так(по другому вроде никак) </p><div class="codebox"><pre><code>If InStr(1, sw, word) &lt;&gt; 0 Then
file1.close
Set file1 = objFSO.OpenTextFile(objFile, 8, False)
file1.WriteLine(&quot;&lt;!--OK--&gt;&quot;)</code></pre></div><p>все равно ругается &quot;Недопустимый режим файла &quot;</p>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2012-05-11T03:47:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60150#p60150</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60135#p60135" />
			<content type="html"><![CDATA[<p>Закройте текстовый файл перед повторным открытием для дополнения.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-05-10T19:58:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60135#p60135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: AtEndOfStream не дает дописывать. Как быть?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=60134#p60134" />
			<content type="html"><![CDATA[<p>Что хочу сделать, пробегаюсь по файлам если есть искомая строка добавляю пометку, но AtEndOfStream не дает дописывать. Как быть?</p><div class="codebox"><pre><code>Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set file2 = objFSO.OpenTextFile(file, 2, True) 

For Each objFile In objFSO.GetFolder(strSource).Files        
Set file1 = objFSO.OpenTextFile(objFile, 1, False)

While Not file1.AtEndOfStream
sw = file1.ReadLine()

If InStr(1, sw, word) &lt;&gt; 0 Then
Set file1 = objFSO.OpenTextFile(objFile, 8, False)
file1.WriteLine(&quot;&lt;!--OK--&gt;&quot;)
End If
  
Wend

file1.close
Next</code></pre></div>]]></content>
			<author>
				<name><![CDATA[griha09]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27540</uri>
			</author>
			<updated>2012-05-10T19:45:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=60134#p60134</id>
		</entry>
</feed>
