<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: определить версию Windows]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=5295</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5295&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: определить версию Windows».]]></description>
		<lastBuildDate>Sun, 26 Dec 2010 17:52:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=43068#p43068</link>
			<description><![CDATA[<p><a href="http://www.autohotkey.com/forum/viewtopic.php?t=8606&amp;postdays=0&amp;postorder=asc&amp;start=0&amp;sid=7ac52f66c762fd2fc9698b736942d931">Есть</a> возможность сохранять вывод из cmd непосредственно в переменную, без создания дополнительных файлов. Немного модифицированный мною вариант:<br /></p><div class="codebox"><pre><code>Output := CMDret_RunReturn(&quot;cmd /c ver&quot;)
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, Output, &quot;Str&quot;, Output)   ; эта строка нужна, если в выводе присутствует кириллица
MsgBox, % Output
Return

CMDret_RunReturn(CMDin)
{
  Global cmdretPID   ; for external abort
  dly := (A_BatchLines &lt;&gt; -1) * 50 ; needs longer delay when Batchlines &lt;&gt; -1

  VarSetCapacity(lpBuffer,1024)
  VarSetCapacity(sui,68, 0)
  VarSetCapacity(pi, 16, 0)
  VarSetCapacity(pa, 12, 0)
  NumPut( 12, pa, 0)
  NumPut( 1,  pa, 8)

  IF (DllCall(&quot;CreatePipe&quot;, &quot;UInt*&quot;,hRead, &quot;UInt*&quot;,hWrite, UInt,&amp;pa, Int,0) &lt;&gt; 0) {
    NumPut(68,    sui, 0 )
    DllCall(&quot;GetStartupInfo&quot;, &quot;UInt&quot;, &amp;sui)
    NumPut(0x101, sui, 44)
    NumPut(0,     sui, 48)
    NumPut(hWrite,sui, 60)
    NumPut(hWrite,sui, 64)

    IF (DllCall(&quot;CreateProcess&quot;,Int,0,Str,CMDin,Int,0,Int,0,Int,1,UInt,0,Int,0,Int,0,UInt,&amp;sui,UInt,&amp;pi)&lt;&gt;0) {
      cmdretPID := NumGet(pi, 8)
      Loop {
        IF DllCall(&quot;PeekNamedPipe&quot;,uint,hRead, uint,0, uint,0, uint,0, &quot;UInt*&quot;,bSize, uint,0) = 0
          break
        Process Exist, %cmdretPID%
        If (ErrorLevel = 0 and bsize = 0)
          break
        If (bsize = 0) {
          Sleep %dly% ; only sleep before early continue
          Continue
        }
        VarSetCapacity(lpBuffer, bSize, 0)
        IF (DllCall(&quot;ReadFile&quot;,UInt,hRead, Str,lpBuffer, Int,bSize, &quot;UInt*&quot;,bRead, Int,0) &gt; 0) {
          IFEqual bRead,0, Continue
          CMDout = %CMDout%%lpBuffer%
          }
      } ; Loop
      cmdretPID =
    } ; IF CreateProcess

    DllCall(&quot;CloseHandle&quot;, UInt, hWrite)
    DllCall(&quot;CloseHandle&quot;, UInt, hRead)
  } ; IF CreatePipe

  Return CMDout
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 26 Dec 2010 17:52:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=43068#p43068</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=43029#p43029</link>
			<description><![CDATA[<p>Это рабочий вариант.<br />Спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Sat, 25 Dec 2010 16:49:01 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=43029#p43029</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=43019#p43019</link>
			<description><![CDATA[<p>Оказывается, cmd записывает в файл два переноса строки, один перед значением, другой после:<br /></p><div class="codebox"><pre><code>RunWait, cmd /c ver &gt; %A_Temp%\ver,, Hide
FileRead, ver, %A_Temp%\ver
FileDelete, %A_Temp%\ver
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, ver, &quot;Str&quot;, ver)
MsgBox, % &quot;[&quot; ver &quot;]&quot;</code></pre></div><p>Попробуй так:<br /></p><div class="codebox"><pre><code>RunWait, cmd /c Ver &gt; %A_Temp%\OsVer,, Hide
FileRead, OsVer, %A_Temp%\OsVer
FileDelete, %A_Temp%\OsVer
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, OsVer, &quot;Str&quot;, OsVer)
ver := RegExReplace(OsVer, &quot;s).*?(\d\.\d).*&quot;, &quot;$1&quot;)
MsgBox, % ver = 5.1 ? &quot;xp&quot; : ver = 6.1 ? &quot;win7&quot; : &quot;другая ОС&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 25 Dec 2010 15:11:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=43019#p43019</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=43003#p43003</link>
			<description><![CDATA[<p><strong>teadrinker</strong><br /></p><div class="codebox"><pre><code>Microsoft Windows [Version 6.1.7600]</code></pre></div><p><strong>ypppu</strong><br />Да, есть.</p>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Sat, 25 Dec 2010 06:33:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=43003#p43003</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=43001#p43001</link>
			<description><![CDATA[<p>А в Windows 7 есть Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe ?</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Fri, 24 Dec 2010 21:29:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=43001#p43001</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42998#p42998</link>
			<description><![CDATA[<p>А у тебя что выдаёт этот скрипт?<br /></p><div class="codebox"><pre><code>RunWait, cmd /c ver &gt; %A_Temp%\ver,, Hide
FileRead, ver, %A_Temp%\ver
FileDelete, %A_Temp%\ver
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, ver, &quot;Str&quot;, ver)
MsgBox, % ver</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2010 19:45:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42998#p42998</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42997#p42997</link>
			<description><![CDATA[<p>В каком виде получается результат? Я так понимаю, что это не число после &quot;Version&quot;, а какой-то текст.<br />Вот такой код показывает, что у меня XP, хотя у меня Win7.<br />Т.е. полученная &quot;6&quot; через RegExReplace не является числом.</p><div class="codebox"><pre><code>RunWait, cmd /c Ver &gt; %A_Temp%\OsVer,, Hide
FileRead, OsVer, %A_Temp%\OsVer
FileDelete, %A_Temp%\OsVer
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, OsVer, &quot;Str&quot;, OsVer)
MsgBox % RegExReplace(OsVer,&quot;.*Version\s(\d).+&quot;,&quot;$1&quot;) = 6 ? &quot;win7&quot; : &quot;xp&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Fri, 24 Dec 2010 19:27:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42997#p42997</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42996#p42996</link>
			<description><![CDATA[<p>Microsoft Windows XP [Версия 5.1.2600]</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:59:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42996#p42996</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42995#p42995</link>
			<description><![CDATA[<p>А вот это уже рабочий вариант. Спасибо.<br />Если не затруднит, напишите, что выдает этот скрипт на WinXP?</p>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:58:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42995#p42995</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42994#p42994</link>
			<description><![CDATA[<div class="quotebox"><cite>InFlames пишет:</cite><blockquote><p>Autohotkey.exe запускается в режиме совместимости с WinXP SP3.</p></blockquote></div><p>В этом, видимо, и проблема.<br />Можно ещё через cmd:<br /></p><div class="codebox"><pre><code>RunWait, cmd /c ver &gt; %A_Temp%\ver,, Hide
FileRead, ver, %A_Temp%\ver
FileDelete, %A_Temp%\ver
DllCall(&quot;OemToChar&quot;, &quot;Str&quot;, ver, &quot;Str&quot;, ver)
MsgBox, % ver</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:53:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42994#p42994</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42993#p42993</link>
			<description><![CDATA[<p>Показывает 5.1.2600.<br />Это WinXP.<br />У меня стоит Win7.<br />Autohotkey.exe запускается в режиме совместимости с WinXP SP3.</p>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:38:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42993#p42993</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42991#p42991</link>
			<description><![CDATA[<div class="quotebox"><cite>InFlames пишет:</cite><blockquote><p><strong>teadrinker</strong>, если запускать ahk на Win7 в режиме совместимости с XP, то покажет, что это XP, а не семерка</p></blockquote></div><p>Не понял, что &quot;покажет&quot;? Ты скрипт по ссылке запускал?<br /></p><div class="codebox"><pre><code>MsgBox % GetOSVersion()

GetOSVersion() {
    VarSetCapacity(v,148), NumPut(148,v)
    DllCall(&quot;GetVersionEx&quot;, &quot;uint&quot;, &amp;v)
    ; Return formatted version string similar to A_AhkVersion.
    ; Assume build number will never be more than 4 characters.
    return    NumGet(v,4) ; major
        . &quot;.&quot; NumGet(v,8) ; minor
        . &quot;.&quot; SubStr(&quot;0000&quot; NumGet(v,12), -3) ; build
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:21:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42991#p42991</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42990#p42990</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, если запускать ahk на Win7 в режиме совместимости с XP, то покажет, что это XP, а не семерка<br />(только сейчас понял: в первом посте я написал, что на семерке показывает, что это ХР, это как раз из-за запуска ahk в режиме совместимости)</p><p><strong>armenxxx1</strong>, мне бы средствами ahk</p><p>Неужели нет простого способа на ahk отличить семерку и XP?</p>]]></description>
			<author><![CDATA[null@example.com (InFlames)]]></author>
			<pubDate>Fri, 24 Dec 2010 18:17:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42990#p42990</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42978#p42978</link>
			<description><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=4573">http://forum.script-coding.com/viewtopic.php?id=4573</a></p>]]></description>
			<author><![CDATA[null@example.com (armenxxx1)]]></author>
			<pubDate>Fri, 24 Dec 2010 14:14:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42978#p42978</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: определить версию Windows]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42974#p42974</link>
			<description><![CDATA[<p><a href="http://www.autohotkey.com/forum/topic49168.html#316426">http://www.autohotkey.com/forum/topic49168.html#316426</a><br />Номера версий <a href="http://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx">здесь</a>.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2010 10:14:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42974#p42974</guid>
		</item>
	</channel>
</rss>
