<?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=6187&amp;type=atom" />
	<updated>2011-09-08T04:09:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6187</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51304#p51304" />
			<content type="html"><![CDATA[<p>ну, и файл все же стоит закрыть в конце скрипта<br /></p><div class="codebox"><pre><code>tf.Close()</code></pre></div><p>либо открывать и закрывать при каждой записи</p>]]></content>
			<author>
				<name><![CDATA[GreyBear]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24465</uri>
			</author>
			<updated>2011-09-08T04:09:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51304#p51304</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51287#p51287" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Dron пишет:</cite><blockquote><p>... выдает ошибку...</p></blockquote></div><p>1. Какую именно ошибку и в какой строке?<br />2. Ключевое слово <strong><span style="color: blue">Time</span> нельзя</strong> использовать в качестве имени переменной, т.к. это имя одной из стандартных функций (возвращает текущее системное время).<br />Кроме того, использование промежуточной переменной здесь вообще излишне. Можно так:<br /></p><div class="codebox"><pre><code>tf.Write(Now)</code></pre></div><p>3. Что, уже изменились исходные условия задачи? Первоначально, кажется, речь шла о том, что запись в файл нужно выполнять лишь при изменении состояния подключения.</p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-09-07T11:11:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51287#p51287</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51280#p51280" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Dim fso, tf, time, CurrentStatus
CurrentStatus = false
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;) 
Const ForAppending = 8 
Set tf = fso.OpenTextFile(&quot;Тест интернет.txt&quot;, ForAppending, True) 
time = Now() 
tf.Write(time) 
Set oShell = WScript.CreateObject(&quot;WScript.Shell&quot;) 
strHost = &quot;www.google.ru&quot; 
strPingCommand = &quot;ping -n 1 -w 300 &quot; &amp; strHost 
ReturnCode = oShell.Run(strPingCommand, 0 , True) 
If ReturnCode = 0 Then 
  If (Not CurrentStatus) Then
    CurrentStatus = true    
    tf.WriteLine &quot;&quot; 
    tf.WriteLine &quot;Есть подключение.&quot; 
  End If  
Else 
  If CurrentStatus Then
    CurrentStatus = false
    tf.WriteLine &quot;&quot; 
    tf.WriteLine &quot;Нет подключения.&quot; 
  End If  
End If</code></pre></div>]]></content>
			<author>
				<name><![CDATA[GreyBear]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24465</uri>
			</author>
			<updated>2011-09-07T05:23:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51280#p51280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51244#p51244" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Dron</strong>, пожалуйста, используйте знаки препинания в предложениях. Это облегчает понимание.</span></p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2011-09-06T12:38:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51244#p51244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51242#p51242" />
			<content type="html"><![CDATA[<p>Не могли бы это написать в скрипте я в vbs не очень</p>]]></content>
			<author>
				<name><![CDATA[Dron]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27174</uri>
			</author>
			<updated>2011-09-06T11:59:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51242#p51242</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51241#p51241" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Dron пишет:</cite><blockquote><p>... на автомате запускался каждые 10 секунд ...</p></blockquote></div><p>Используйте какой-нибудь подходящий планировщик (стандартный не умеет работать с интервалами времени менее 1 мин.).<br /></p><div class="quotebox"><cite>Dron пишет:</cite><blockquote><p>... вместо того что бы выводить десять раз строку есть подключение надо что бы вывело только один раз до того момента пока подключение не исчезнет со строкой нет подключения аналогично.</p></blockquote></div><p>Один из вариантов: читайте весь текст и сравнивайте последнюю записанную в него строку с текущим диагностическим сообщением. Если строки совпадают - ничего не пишите, не совпадают пишите.</p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-09-06T11:57:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51241#p51241</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Тестирование интернет соединения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51240#p51240" />
			<content type="html"><![CDATA[<p>Сделал вот так не работает выдает ошибку че ему не хватает?</p><div class="codebox"><pre><code>Dim fso, tf, time 
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;) 
while 1=1 
Const ForAppending = 8 
Set tf = fso.OpenTextFile(&quot;Тест интернет.txt&quot;, ForAppending, True) 
time = Now() 
tf.Write(time) 
Set oShell = WScript.CreateObject(&quot;WScript.Shell&quot;) 
strHost = &quot;192.168.0.150&quot; 
strPingCommand = &quot;ping -n 1 -w 300 &quot; &amp; strHost 
ReturnCode = oShell.Run(strPingCommand, 0 , True) 
If ReturnCode = 0 Then 
tf.WriteLine &quot;&quot; 
tf.WriteLine &quot;Есть подключение.&quot; 
Else 
tf.WriteLine &quot;&quot; 
tf.WriteLine &quot;Нет подключения.&quot; 
End If 
WScript.Sleep 10000 
wend</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Dron]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27174</uri>
			</author>
			<updated>2011-09-06T11:23:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51240#p51240</id>
		</entry>
</feed>
