<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Работа с diskpart]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9299&amp;type=atom" />
	<updated>2014-02-25T18:51:17Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9299</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с diskpart]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80374#p80374" />
			<content type="html"><![CDATA[<p>Разобрался.<br /></p><div class="codebox"><pre><code>#NoTrayIcon
loop
{
   Runwait, %comspec% /c echo list volume | diskpart.exe | clip, , hide
   diskpart := Clipboard
   Loop, Parse, diskpart, `n, `r
   {
      If (instr(A_LoopField, &quot;Failed&quot;) || instr(A_LoopField, &quot;At Risk&quot;))
      {
         errors = 1
         StringMid, disk, A_LoopField, 16, 1
         break
      }
   }
   If errors = 1
   {
      Menu, Tray, Icon
      Gui,+AlwaysOnTop
      Gui, -MinimizeBox -MaximizeBox
      Gui, Font, s80, Times New Roman
      Gui, Add, Text,, Problema s Raid: %disk%
      Gui, Show,, RaidError
      Gui, +LastFound
      OnMessage(0x112, &quot;WM_SYSCOMMAND&quot;)
      Return
   }
   sleep, 3600000
}

WM_SYSCOMMAND(wParam)
{
   if (A_Gui = 1 &amp;&amp; wParam = 0xF060) ; SC_CLOSE
      return 0
} </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-02-25T18:51:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80374#p80374</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Работа с diskpart]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80368#p80368" />
			<content type="html"><![CDATA[<p>Написал скриптик, который проверяет состояние Рейда на основе diskpart.<br />В hdd1.txt я прописываю list volume.<br />А из hdd2.txt парсю результат.<br />Возможно ли <strong>легким способом</strong> обойтись без создания этих файлов?<br />То есть, передать list volume в diskpart и скопировать в буфер обмена результат.<br /></p><div class="codebox"><pre><code>#NoTrayIcon
loop
{
   FileDelete, C:\hdd1.txt
   FileDelete, C:\hdd2.txt
   FileAppend, list volume, C:\hdd1.txt
   Runwait, %comspec% /c &quot;&quot;DISKPART.exe&quot; &quot;/s&quot; &quot;C:\hdd1.txt&quot; &gt; &quot;C:\hdd2.txt&quot;&quot;, , hide
   Loop, read,  C:\hdd2.txt
   {
      If (instr(A_LoopReadLine, &quot;Failed&quot;) || instr(A_LoopReadLine, &quot;At Risk&quot;))
      {
         errors = 1
         StringMid, disk, A_LoopReadLine, 16, 1
         break
      }
   }
   FileDelete, C:\hdd1.txt
   FileDelete, C:\hdd2.txt
   If errors = 1
   {
      Menu, Tray, Icon
      Gui,+AlwaysOnTop
      Gui, -MinimizeBox -MaximizeBox
      Gui, Font, s80, Times New Roman
      Gui, Add, Text,, Problema s Raid: %disk%
      Gui, Show,, RaidError
      Gui, +LastFound
      OnMessage(0x112, &quot;WM_SYSCOMMAND&quot;)
      Return
   }
   sleep, 3600000
}

WM_SYSCOMMAND(wParam)
{
   if (A_Gui = 1 &amp;&amp; wParam = 0xF060) ; SC_CLOSE
      return 0
} </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2014-02-25T11:03:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80368#p80368</id>
		</entry>
</feed>
