<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Проверка интернет соединения]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=10595&amp;type=atom" />
	<updated>2019-01-17T07:35:17Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=10595</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=131321#p131321" />
			<content type="html"><![CDATA[<p>Предлагаю другой пример<br /></p><div class="codebox"><pre><code>result	:=  ComObjCreate(&quot;WScript.Shell&quot;).Exec(&quot;cmd.exe /q /c chcp 65001 &amp;&amp; ping ya.ru -n 1&quot;).StdOut.ReadAll()</code></pre></div><p>дальше можно выщемить только цифру time или TTL, чтобы в дальнейшем сравнивать/обрабатывать..., все по русски и без каракуль, можно поставить в цикл и не будет постоянно создаваться файл.<br /></p><div class="codebox"><pre><code>    	Loop, parse, result, `n `r
   	 {
		IfInString, A_LoopField, time= 
		{
			var:=A_LoopField
			StringReplace, var, var, time=, , All
			StringReplace, var, var, ms, , All
			MsgBox, %var%
		}
   	 }
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ms]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39897</uri>
			</author>
			<updated>2019-01-17T07:35:17Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=131321#p131321</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=104644#p104644" />
			<content type="html"><![CDATA[<p>Весь процесс ping будет в буфере и все по русски и без каракуль<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p>clipboard:=<br />RunWait %comspec% /c chcp 65001 &amp;&amp; ping ya.ru -n 1 | cb.exe<br />MsgBox, %clipboard%</p></div></div><p>Еще проще. <br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p>#Persistent<br />RunWait, ping.exe ya.ru -n 1,, Hide UseErrorlevel<br />if Errorlevel=1<br />{<br />	MsgBox, Pinng проходит<br />	;вместо MsgBox мотет быть Run и т.д<br />}</p><p>return</p></div></div>]]></content>
			<author>
				<name><![CDATA[Key]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33940</uri>
			</author>
			<updated>2016-06-03T13:47:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=104644#p104644</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98104#p98104" />
			<content type="html"><![CDATA[<p>Ну а как можно проверить работоспособность прокси, кроме как попробовав применить его? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Никак.</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2015-10-23T00:57:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98104#p98104</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98076#p98076" />
			<content type="html"><![CDATA[<p>Не, это не вариант - еще тормознутей выйдет.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-10-22T00:33:29Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98076#p98076</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98074#p98074" />
			<content type="html"><![CDATA[<p>Через установку прокси и попытку UrlDownloadToFile.</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2015-10-21T22:25:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98074#p98074</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98046#p98046" />
			<content type="html"><![CDATA[<p>А есть ли решения для определения работоспособности прокси, кроме как через WinHttpRequest?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-10-21T01:02:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98046#p98046</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93561#p93561" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><div class="codebox"><pre><code>MsgBox, % DllCall(&quot;Wininet.dll\InternetGetConnectedState&quot;, &quot;Str&quot;, 0x20,&quot;Int&quot;,0)</code></pre></div></blockquote></div><p>Немного странно этой функцией пользуетесь. Надо как-то так:<br /></p><div class="codebox"><pre><code>state := DllCall(&quot;Wininet\InternetGetConnectedState&quot;, IntP, flags, Int, 0)
for k, v in { INTERNET_CONNECTION_CONFIGURED: 0x40
            , INTERNET_CONNECTION_LAN: 0x2
            , INTERNET_CONNECTION_MODEM: 0x1
            , INTERNET_CONNECTION_OFFLINE: 0x20
            , INTERNET_CONNECTION_PROXY: 0x4
            , INTERNET_RAS_INSTALLED: 0x10 }
   if (flags &amp; v)
      list .= k . &quot;`n&quot;
   
MsgBox, % &quot;state = &quot; state &quot;`nflags:`n&quot; Trim(list, &quot;`n&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-23T16:58:51Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93561#p93561</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93557#p93557" />
			<content type="html"><![CDATA[<p>А как по &quot;внутреннему состоянию ОС&quot; можно отличить подключение к интернету от подключения к локальной сети? У меня, например, подключение осуществляется не напрямую, а через локальную сеть провайдера.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-23T14:57:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93557#p93557</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93555#p93555" />
			<content type="html"><![CDATA[<p>Да, есть такой момент, при отключенном от роутера кабеле все равно выводит 1.<br />Все равно как-то не нравится способ с постоянным &quot;пинанием&quot; внешнего адреса, хочется найти способ, как обойтись опросом внутреннего состояния ОС.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-04-23T14:30:43Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93555#p93555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93554#p93554" />
			<content type="html"><![CDATA[<p>Вообще кроме &quot;есть&quot; и &quot;нет&quot; существуют другие состояния. Интернет доступен, но DNS не пашет. Или интернет частично доступен.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2015-04-23T14:26:16Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93554#p93554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93552#p93552" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>У кого-нибуль есть ситуации, когда этот код показывает соединение при фактически неработающем интернете?</p></blockquote></div><p>У меня при подключенном роуте и отключенном от него интернете показывает 1.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-23T13:43:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93552#p93552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93551#p93551" />
			<content type="html"><![CDATA[<p>Смотря, что понимать под &quot;интернетом&quot;. Локальная сеть — тоже &quot;интернет&quot;. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-23T13:42:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93551#p93551</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93550#p93550" />
			<content type="html"><![CDATA[<p>Проверять соединение кажется более надежным, но у меня и так стабильно показывает состояние.<br />Сменил параметр проверки на 0x20 = <a href="https://msdn.microsoft.com/ru-ru/library/windows/desktop/aa384702(v=vs.85).aspx">INTERNET_CONNECTION_OFFLINE</a>.<br />У кого-нибуль есть ситуации, когда этот код показывает соединение при фактически неработающем интернете?<br /></p><div class="codebox"><pre><code>MsgBox, % DllCall(&quot;Wininet.dll\InternetGetConnectedState&quot;, &quot;Str&quot;, 0x20,&quot;Int&quot;,0)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-04-23T13:38:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93550#p93550</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93549#p93549" />
			<content type="html"><![CDATA[<p>Просто пинг отправляет 4 запроса. если вписать 1, то вроде как одинаково.<br /></p><div class="codebox"><pre><code>MsgBox, % DllCall(&quot;Wininet\InternetCheckConnection&quot;, Str, &quot;https://www.microsoft.com/&quot;, UInt, FLAG_ICC_FORCE_CONNECTION := 1, UInt, 0)

RunWait, ping.exe www.microsoft.com -n 1,, Hide UseErrorlevel
MsgBox, % !Errorlevel</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-23T13:23:24Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93549#p93549</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка интернет соединения]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=93548#p93548" />
			<content type="html"><![CDATA[<p>Через <em>InternetCheckConnection</em> вроде быстрее. Если есть соединение, она сразу возвращает true. Для сравнения:<br /></p><div class="codebox"><pre><code>MsgBox, % DllCall(&quot;Wininet\InternetCheckConnection&quot;, Str, &quot;https://www.microsoft.com/&quot;, UInt, FLAG_ICC_FORCE_CONNECTION := 1, UInt, 0)

RunWait, ping.exe www.microsoft.com,, Hide UseErrorlevel
MsgBox, % !Errorlevel</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-23T13:14:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=93548#p93548</id>
		</entry>
</feed>
