<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Работа с файлом]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5557&amp;type=atom" />
	<updated>2011-03-01T18:05:28Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5557</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Работа с файлом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=45733#p45733" />
			<content type="html"><![CDATA[<p><strong>Starley25</strong>, примерно так:<br /></p><div class="codebox"><pre><code>Option Explicit

Const ForReading = 1

Dim strPath


With WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)
    strPath = &quot;c:\MyFile.txt&quot;
    
    If .FileExists(strPath) Then
        With .OpenTextFile(strPath, ForReading)
            Select Case Trim(UCase(.ReadLine()))
                Case UCase(&quot;error&quot;)
                    WScript.Echo &quot;Error&quot;
                Case UCase(&quot;ok&quot;)
                    WScript.Echo &quot;OK&quot;
                Case Else
                    WScript.Echo &quot;Other content&quot;
            End Select
            
            .Close
        End With
    Else
        WScript.Echo &quot;File [&quot; &amp; strPath &amp; &quot;] not found&quot;
    End If
End With

WScript.Quit 0</code></pre></div><p>Чтение производится только из первой строки файла.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-03-01T18:05:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=45733#p45733</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Работа с файлом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=45627#p45627" />
			<content type="html"><![CDATA[<p>Стоит задача: есть текстовый файл, необходимо в зависимости от содержимого в этом файле (error или ок) производить действие - скажем вывод сообщения на экран, то есть если error, то одно сообщение, если ok, то другое. Все это на vbs.</p>]]></content>
			<author>
				<name><![CDATA[Starley25]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25241</uri>
			</author>
			<updated>2011-02-28T09:09:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=45627#p45627</id>
		</entry>
</feed>
