<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBScript: В случае успешного пинга выполнить действие]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=4070</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=4070&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBScript: В случае успешного пинга выполнить действие».]]></description>
		<lastBuildDate>Mon, 18 Oct 2010 15:15:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=40547#p40547</link>
			<description><![CDATA[<p>Я второй день как ковыряюсь в скриптах. Поэтому мог не правильно сформулировать вопрос. Уже сам нашел решение. не спорю могут быть и другие решения, но я додумался только до этого. Главное работает остальное не&nbsp; так важно<br />Что бы было понятно что я хотел приведу часть кода<br /></p><div class="codebox"><pre><code> Do

        Set collSWbemObjectSet = objSWbemServicesEx.ExecQuery(&quot;SELECT * FROM Win32_PingStatus WHERE Address = &#039;&quot; &amp; strAddress &amp; &quot;&#039;&quot;)
        For Each objSWbemObjectEx In collSWbemObjectSet
        If IsNull(objSWbemObjectEx.StatusCode) Or objSWbemObjectEx.StatusCode  &lt;&gt; 0 Then
            X = false
        else
            X = true
              
        End If
    Next
    Wscript.Sleep 15000


        If oAutoIt.ProcessExists(MonitorProcess) then
           Y = True
        Else 
           Y = False 
        End If
    Wscript.Sleep 1000
    

        If X Or Y Then
        IsLimited = SetLimitsTrue(IsLimited)    
        Else 
        IsLimited = SetLimitsFalse(IsLimited)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (as_lan)]]></author>
			<pubDate>Mon, 18 Oct 2010 15:15:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=40547#p40547</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=40545#p40545</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>правда*ложь=правда</p></blockquote></div><p>Булева алгебра не поддерживает такую логику <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. К тому же, «Правдой» не оперируют; правильно — «Истина» и «Ложь».</p><p>Вопрос какой-то бессмысленный.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Mon, 18 Oct 2010 15:10:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=40545#p40545</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=40544#p40544</link>
			<description><![CDATA[<p>И еще такой вопрос. Немного нубское построение будет, но попытаюсь объяснить как могу.&nbsp; <br />Допустим скрипт при выполнении должен сравнить два случая. (в итоге даст &quot;правда&quot; или &quot;ложь&quot;). Только могут быть случаи когда одно сравнение даст нам &quot;правда&quot; а другое &quot;ложь&quot; и наоборот. Так вот, как сделать так чтоб было следующим образом правда*правда=правда, ложь*правда=правда, правда*ложь=правда, ложь*ложь=ложь. Просто решил переделать скрипт и столкнулся с такой проблемой</p>]]></description>
			<author><![CDATA[null@example.com (as_lan)]]></author>
			<pubDate>Mon, 18 Oct 2010 13:17:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=40544#p40544</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=40513#p40513</link>
			<description><![CDATA[<p>Добрый день. кто бы смог написать скрип который при удачном пинге выполнял бы определенную команду, как только комп перестает быть доступен(выключается) выполняется другая программа. В сети два комп, главный и ноут. На главном периодически запускается торрент который отъедает весь канал. В наличии есть скрипт который следит за определенный процессом( в данном случае это опера) и как только этот процесс найдет выполняется команда для снижения скорости. Как только выключается опера выполняется другая команда для восстановления. Можно ли в этот скрипт дописать строки чтоб кроме как слежения за процессом было слежением и за доступностью сетевого комп. Вот содержимое скрипта. <br />&nbsp; <br /></p><div class="codebox"><pre><code>&#039;Версия 1.5  (Final)
&#039;Настройки&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;

Public Const InstallPath = &quot;C:\Program Files\uTorrent\&quot;         &#039; - путь к папке, где лежит &quot;utspeed.exe&quot; [Str]
Public Const MonitorProcess = &quot;opera.exe&quot;                       &#039; - название отслеживаемого процесса [Str]
Public Const Mode = 0                                           &#039; - режимы: 0 - лимиты, 1 - расписание, 2 - ipfilter [0/1/2]
Public Const FileNameOn = &quot;UT Limiter [on].vbs&quot;                 &#039; - имя файла при включенном скрипте [Str]
Public Const FileNameOff = &quot;UT Limiter [off].vbs&quot;               &#039; - имя файла при выключенном скрипте [Str]
Public Const DownloadDefault = 60                               &#039; - нормальная скорость скачки [кб/c]
Public Const UploadDefault = 60                                 &#039; - нормальная скорость отдачи [кб/c]
Public Const DownloadLimit = 5                                  &#039; - ограничение скорости скачки при обнаруж. процесса [кб/c]
Public Const UploadLimit = 20                                   &#039; - ограничение скорости отдачи при обнаруж. процесса [кб/c]
Public Const IdleTime = 15                                      &#039; - время простоя до частичного восстановл. скорости [сек.]
Public Const IdleDownSpeed = 50                                 &#039; - скорость скачки во время простоя [кб/c]
Public Const IdleUpSpeed = 50                                   &#039; - скорость отдачи во время простоя [кб/c]
Public Const AwayTime = 50                                      &#039; - время отсутствия до полного восстановл. скорости [сек.]
Public Const AwayDownSpeed = 50                                 &#039; - скорость скачки во время отсутствия [кб/c]
Public Const AwayUpSpeed = 50                                   &#039; - скорость отдачи во время отсутствия [кб/c]

&#039;Инициализация&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;

IsLimited = 2

Set objShell = CreateObject(&quot;Shell.Application&quot;)
Set Fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f = Fso.GetFile(Wscript.ScriptFullName)
Set oAutoIt = WScript.CreateObject(&quot;AutoItX3.Control&quot;)

If Fso.FileExists(InstallPath &amp; &quot;utspeed.exe&quot;) = false then
Msgbox &quot;Сначала укажите путь к папке!   &quot;, vbInformation + vbOKOnly, &quot;UT Limiter&quot;
ExitScript
End if

If f.Name = FileNameOn then
ExitScript
else
f.Name = FileNameOn
End if

&#039;Мониторинг&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;

Do

 If oAutoIt.ProcessExists(MonitorProcess) then
 IsLimited = SetLimitsTrue(IsLimited)
 else
 IsLimited = SetLimitsFalse(IsLimited)
 End if

 If Fso.FileExists(FileNameOn) = false then
 IsLimited = SetLimitsFalse(IsLimited)
 ExitScript
 End if

  PrevMpos = 0
  
  Do while oAutoIt.ProcessExists(MonitorProcess) and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;)
  
   If Fso.FileExists(FileNameOn) = false then
   IsLimited = SetLimitsFalse(IsLimited)
   ExitScript
   End if
   
   CurMpos = oAutoIt.MouseGetPosX
   StartTime = Timer
    Do while CurMpos = PrevMpos
     If Timer - StartTime &gt; IdleTime then
     IsLimited = SetIdleLimits(IsLimited)
     End if
     If Timer - StartTime &gt; AwayTime then
     IsLimited = SetAwayLimits(IsLimited)
     End if
     Wscript.Sleep 200
     CurMpos = oAutoIt.MouseGetPosX
    Loop
    If IsLimited = 3 or IsLimited = 4 then
    IsLimited = SetLimitsTrue(IsLimited)
    End if
   PrevMpos = CurMpos
   Wscript.Sleep 500
  Loop
 
Wscript.Sleep 500
Loop

&#039;Функции&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;

Function SetLimitsTrue (IsLimited)
 If IsLimited &lt;&gt; 1 and Mode = 0 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/max_dl_rate &quot; &amp; DownloadLimit &amp; &quot; /max_ul_rate &quot; &amp; UploadLimit, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 1
 End if
 If IsLimited &lt;&gt; 1 and Mode = 1 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/sched_enable 1&quot;, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 1
 End if
 If IsLimited &lt;&gt; 1 and Mode = 2 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/ipfilter.enable 1&quot;, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 1
 End if 
 SetLimitsTrue = IsLimited
End Function

Function SetLimitsFalse (IsLimited)
 If IsLimited &lt;&gt; 0 and Mode = 0 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/max_dl_rate &quot; &amp; DownloadDefault &amp; &quot; /max_ul_rate &quot; &amp; UploadDefault, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 0
 End if
 If IsLimited &lt;&gt; 0 and Mode = 1 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/sched_enable 0&quot;, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 0
 End if
 If IsLimited &lt;&gt; 0 and Mode = 2 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/ipfilter.enable 0&quot;, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 0
 End if
 SetLimitsFalse = IsLimited
End Function

Function SetIdleLimits (IsLimited)
 If IsLimited &lt;&gt; 3 and IsLimited &lt;&gt; 4  and Mode = 0 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then   
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/max_dl_rate &quot; &amp; IdleDownSpeed &amp; &quot; /max_ul_rate &quot; &amp; IdleUpSpeed, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 3
 End if
 SetIdleLimits = IsLimited
End Function

Function SetAwayLimits (IsLimited)
 If IsLimited &lt;&gt; 4  and Mode = 0 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then   
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/max_dl_rate &quot; &amp; AwayDownSpeed &amp; &quot; /max_ul_rate &quot; &amp; AwayUpSpeed, InstallPath
  oAutoIt.ProcessWaitClose &quot;utspeed.exe&quot;
  IsLimited = 4
 End if
 If IsLimited &lt;&gt; 4  and Mode = 1 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then   
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/sched_enable 0&quot;, InstallPath
  IsLimited = 4
 End if
 If IsLimited &lt;&gt; 4  and Mode = 2 and oAutoIt.ProcessExists(&quot;utorrent.exe&quot;) then   
  objShell.ShellExecute &quot;utspeed.exe&quot;, &quot;/ipfilter.enable 0&quot;, InstallPath
  IsLimited = 4
 End if
 SetAwayLimits = IsLimited
End Function

Function ExitScript
on error resume next
f.Name = FileNameOff
Wscript.Quit
End Function</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (as_lan)]]></author>
			<pubDate>Sun, 17 Oct 2010 12:08:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=40513#p40513</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=39745#p39745</link>
			<description><![CDATA[<p>Не в курсе. Нет ни «windows 7», ни «Tmeter».</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 29 Sep 2010 12:42:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=39745#p39745</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=39744#p39744</link>
			<description><![CDATA[<p>Служба должна запускать и останавливаться на локальном компьютере. В общем, есть интрнет через модем на две машины, скорость общая 2мб. Программой (эта программа имеет свою службу, которую предполагается запускать-останавливать), которая стоит на обоих машинах траффик ограничевается пополам (так как модем не настраивается на такое). Нужно чтоб служба запускалась когда вторая машина включается и наоборот.</p><p>Вот это нуно организовать в windows 7. Запускал от имени администратора - ничего не происходит. Я думаю может все дело в правах??? Служба программы Tmeter.</p>]]></description>
			<author><![CDATA[null@example.com (nyevgen)]]></author>
			<pubDate>Wed, 29 Sep 2010 10:05:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=39744#p39744</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=39735#p39735</link>
			<description><![CDATA[<div class="quotebox"><cite>nyevgen пишет:</cite><blockquote><p>…как этот скрипт…</p></blockquote></div><p>Хотя бы для приличия стоит указывать явно — какой именно; их в этой теме несколько. Если Вы про <a href="http://forum.script-coding.com/viewtopic.php?pid=36261#p36261">#32</a>, то, для начала, проверьте «ручками», существует ли вообще служба «Messenger»: если мне не изменяет память, то ли в Vista, то ли в Windows 7 её убрали в принципе.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Tue, 28 Sep 2010 13:02:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=39735#p39735</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=39731#p39731</link>
			<description><![CDATA[<p>Скажите пожалуйста, как этот скрипт реализовать в Windows 7? Запускаю, ничего не происходит, скорее всего дело в правах? Запускал от имени администратора - то же самое.</p>]]></description>
			<author><![CDATA[null@example.com (nyevgen)]]></author>
			<pubDate>Tue, 28 Sep 2010 10:07:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=39731#p39731</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=37933#p37933</link>
			<description><![CDATA[<p>В чём?)&nbsp; да вот я&nbsp; сам не&nbsp; вкурсе. <br />давайте&nbsp; ещё появне&nbsp; напишу, может непонятно.<br />Стоит комп ( серв )&nbsp; &nbsp;у него есть доступ&nbsp; в инет&nbsp; через&nbsp; &nbsp;модем и доступ&nbsp; &nbsp;в сеть локальную. посредством инета&nbsp; серв&nbsp; постоянно качает&nbsp; из торрента utorrent клиентом.&nbsp; на&nbsp; серваке&nbsp; стоит&nbsp; &nbsp;прокси, который&nbsp; раздаёт интернет. в то время как&nbsp; серв&nbsp; качает&nbsp; торрентом,&nbsp; то&nbsp; у других&nbsp; , да и&nbsp; у него самого,&nbsp; виснут&nbsp; страницы в браузерах, потому что&nbsp; торрент&nbsp; на&nbsp; себя&nbsp; всё&nbsp; забирает...<br />так вот&nbsp; мне бы&nbsp; такой&nbsp; скриптик,&nbsp; который&nbsp; автоматом&nbsp; снижает активность торрента&nbsp; &nbsp;при&nbsp; активности&nbsp; другого&nbsp; &nbsp;софта&nbsp; на серваке или&nbsp; на&nbsp; &nbsp;клиентах.</p>]]></description>
			<author><![CDATA[null@example.com (smy)]]></author>
			<pubDate>Fri, 23 Jul 2010 12:49:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=37933#p37933</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=37922#p37922</link>
			<description><![CDATA[<p>И в чём проблема? Для меня неясно одно — как сделать «скорость&nbsp; у торрента ограничивалась». Вы знаете как?</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Fri, 23 Jul 2010 08:52:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=37922#p37922</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=37891#p37891</link>
			<description><![CDATA[<p>Друзья,&nbsp; здраствуйте)&nbsp; у меня&nbsp; пару вопросов...<br />Нужно сделать такую штуку.<br />у меня&nbsp; локалка и&nbsp; инет...+ стоит&nbsp; прокси, который раздаёт инет в локалку определённым&nbsp; клиентам<br />я&nbsp; &nbsp;качаю&nbsp; &nbsp;постоянно&nbsp; торрентом...так как не всегда&nbsp; клиенты&nbsp; в сети.&nbsp; и вот когда&nbsp; они приходят, то&nbsp; у них инет&nbsp; лагает,&nbsp; так&nbsp; как&nbsp; я&nbsp; забираю себе&nbsp; всю&nbsp; скорость...<br />так&nbsp; вот&nbsp; мне б&nbsp; такую&nbsp; тему&nbsp; замутить, чтоб&nbsp; &nbsp;при&nbsp; &nbsp;положительном&nbsp; пинге до них&nbsp; скорость&nbsp; у торрента ограничивалась.<br />помогите пжл.</p>]]></description>
			<author><![CDATA[null@example.com (smy)]]></author>
			<pubDate>Thu, 22 Jul 2010 10:15:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=37891#p37891</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=36277#p36277</link>
			<description><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>strServiceName = &quot;xxx 10.0.553&quot;</p></blockquote></div><p>Спасибо Вам огромное! Все работает!</p>]]></description>
			<author><![CDATA[null@example.com (nyevgen)]]></author>
			<pubDate>Wed, 02 Jun 2010 06:33:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=36277#p36277</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=36263#p36263</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Я так понял что Вы сделали наоборот, т.е. вторая машина запускается и служба останавливается?!</p></blockquote></div><p>Нет.<br /></p><div class="codebox"><pre><code>…
strServiceName = &quot;xxx 10.0.553&quot;
…
&#039; Если не удалось найти имя/адрес или статус пинга отличен от нуля, то…
If IsNull(objSWbemObjectEx.StatusCode) Or objSWbemObjectEx.StatusCode &lt;&gt; 0 Then
    &#039; Получаем объект указанной службы…
    With objSWbemServicesEx.Get(&quot;Win32_Service.Name=&#039;&quot; &amp; strServiceName &amp; &quot;&#039;&quot;)
        &#039; Если указанная служба уже не остановлена, то…
        If .State &lt;&gt; &quot;Stopped&quot; Then
            &#039; …останавливаем её.
            .StopService
        End If
    End With
…</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Tue, 01 Jun 2010 17:38:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=36263#p36263</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=36262#p36262</link>
			<description><![CDATA[<p>Я потом немного поправил на </p><div class="quotebox"><blockquote><p>&quot;Нужно чтоб служба запускалась когда вторая машина включается и наоборот.&quot;</p></blockquote></div><p>- извените, пожалуйста за невнимательность.</p><p>Я так понял что Вы сделали наоборот, т.е. вторая машина запускается и служба останавливается?! Значит, если я поменяю местами <strong>Running</strong> и <strong>Stopped</strong>, а также <strong>StartService</strong> и <strong>StopService</strong> соответственно - получится то, что мне нужно? Я правильно понял? И еще, название службы выглядит так &quot;xxx 10.0.553&quot; - для скрипта &quot;пробел&quot; не страшен?</p><p>Помогите мне пожалуйста, я уже замучался искать что-то подобное, а в скриптах я не силен.<br />Огромное спасибо за скрипт и помощь!</p>]]></description>
			<author><![CDATA[null@example.com (nyevgen)]]></author>
			<pubDate>Tue, 01 Jun 2010 16:24:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=36262#p36262</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: В случае успешного пинга выполнить действие]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=36261#p36261</link>
			<description><![CDATA[<p>Ага, теперь ясно, что я понял Вас неправильно.</p><p>Но как понимать это — в последнем посте:<br /></p><div class="quotebox"><cite>nyevgen пишет:</cite><blockquote><p>Хочу чтоб служба запускалась когда вторая машина выключена</p></blockquote></div><p>в предыдущем посте:<br /></p><div class="quotebox"><cite>nyevgen пишет:</cite><blockquote><p>в случае успешно пинга запускалась определенная служба на этом же компьютере</p></blockquote></div><p>Судя по всему, правильным всё же следует считать первое техзадание <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p><p>Попробуйте примерно так:<br /></p><div class="codebox"><pre><code>Option Explicit

Dim objSWbemServicesEx, collSWbemObjectSet, objSWbemObjectEx

Dim strAddress
Dim strServiceName


strAddress     = &quot;localhost&quot;
strServiceName = &quot;Messenger&quot;

Set objSWbemServicesEx = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)

Do
    Set collSWbemObjectSet = objSWbemServicesEx.ExecQuery(&quot;SELECT * FROM Win32_PingStatus WHERE Address = &#039;&quot; &amp; strAddress &amp; &quot;&#039;&quot;)
    
    For Each objSWbemObjectEx In collSWbemObjectSet
        If IsNull(objSWbemObjectEx.StatusCode) Or objSWbemObjectEx.StatusCode &lt;&gt; 0 Then
            With objSWbemServicesEx.Get(&quot;Win32_Service.Name=&#039;&quot; &amp; strServiceName &amp; &quot;&#039;&quot;)
                If .State &lt;&gt; &quot;Stopped&quot; Then
                    .StopService
                End If
            End With
        Else
            With objSWbemServicesEx.Get(&quot;Win32_Service.Name=&#039;&quot; &amp; strServiceName &amp; &quot;&#039;&quot;)
                If .State &lt;&gt; &quot;Running&quot; Then
                    .StartService
                End If
            End With
        End If
        
        Exit For
    Next
    
    WScript.Sleep 30 * 1000
Loop

Set collSWbemObjectSet = Nothing
Set objSWbemServicesEx = Nothing

WScript.Quit 0</code></pre></div><p>«strAddress», «strServiceName» — используйте свои данные. Опрос производится каждые 30 секунд. Прервать работу скрипта можно только извне.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Tue, 01 Jun 2010 15:52:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=36261#p36261</guid>
		</item>
	</channel>
</rss>
