<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Функция "Очистка Диска" в Win 7]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10877&amp;type=atom" />
	<updated>2015-08-19T10:10:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10877</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96621#p96621" />
			<content type="html"><![CDATA[<p>А ты про это... но когда парк более 20 компов + разные ОС + миграция... просто я уже много раз прокалывался, т.к. на сервере стартует BackUp, даёт сигнал по всем компам, ждёт, делает резервное копирование, а потом выясняется, что где то не та ОС и не так сработала очистка.</p><p>Если дома, то можно через <strong>/sageset:n</strong> и <strong>/sagerun:n</strong>, а вот на работе косяки получаются - постоянно приходится проверять, что у кого поменялось. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-19T10:10:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96621#p96621</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96619#p96619" />
			<content type="html"><![CDATA[<p>Так serzh82saratov написал в 14 посту:<br /></p><div class="quotebox"><blockquote><p>И далее просто запускать с сохранёнными настройками</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-08-19T10:01:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96619#p96619</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96617#p96617" />
			<content type="html"><![CDATA[<p>Можно и так, что будет эквивалентно скрипту, только куда заносить, что бы он срабатывал по внешнему сигналу, а не по расписанию, а?<br />Просто я не знаю.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-19T07:23:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96617#p96617</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96614#p96614" />
			<content type="html"><![CDATA[<p>Так а в чем проблема?<br />Зеаносишь в реестр:<br /></p><div class="codebox"><pre><code>run cleanmgr.exe /d X: /sageset:n</code></pre></div><p>И он сохраняет настройки для нужного тебе диска (в sagerun диск указывать не надо поэтому и пишут, что Ключ /d не совместим с ключом /sagerun:./d ).</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-08-19T03:10:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96614#p96614</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96592#p96592" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Пробовал на системном диске, не заметил, тогда не вариант.</p></blockquote></div><p> Да можно написать, но придётся создавать много профилей для ключа <strong>/sagerun</strong>, а для одного компа достаточно использовать этот ключ.</p><p><a href="https://support.microsoft.com/ru-ru/kb/315246">Служба поддержки Майкрософт (cleanmgr.exe)</a> </p><div class="quotebox"><blockquote><p>Средство очистки диска поддерживает следующие параметры командной строки.</p><p>&nbsp; &nbsp; /d driveletter. Выбор диска для очистки.</p><p>&nbsp; &nbsp; Примечание. Параметр /d игнорируется, если задан параметр /sagerun: n.</p></blockquote></div><p> Вот, по сути из за чего возникла необходимость написания скрипта.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T20:03:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96592#p96592</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96591#p96591" />
			<content type="html"><![CDATA[<p>Пробовал на системном диске, не заметил, тогда не вариант.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-18T19:24:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96591#p96591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96590#p96590" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Одно уточнение. Ключ <strong>/d </strong>не совместим с ключом <strong>/sagerun:</strong>.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T19:07:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96590#p96590</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96589#p96589" />
			<content type="html"><![CDATA[<p>Есть ключи:<br /></p><div class="quotebox"><blockquote><p>Syntax<br />&nbsp; &nbsp; &nbsp;CLEANMGR option</p><p>Options<br />&nbsp; &nbsp; &nbsp; &nbsp;/d driveletter: Select the drive that you want Disk Cleanup to clean.</p><p>&nbsp; &nbsp; &nbsp; &nbsp;/sageset:n&nbsp; &nbsp; &nbsp; Display the Disk Cleanup Settings dialog box and create<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a registry key to store the settings you select.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The n value is stored in the registry and allows you to<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;specify different tasks for Disk Cleanup to run.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;n can be any integer from 0 to 65535.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Specify the %systemroot% drive to see all the available options.</p><p>&nbsp; &nbsp; &nbsp; /sagerun:n&nbsp; &nbsp; &nbsp; &nbsp;Run task &#039;n&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;All drives in the computer will be enumerated, and the<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;selected profile will be run against each drive. </p><p>&nbsp; &nbsp; Only one of the 3 options above can be run at a time</p><p>&nbsp; &nbsp; &nbsp; /TUNEUP:n&nbsp; &nbsp; &nbsp; &nbsp; Run sageset + sagerun for the same n</p><p>&nbsp; &nbsp; &nbsp; /LOWDISK&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Run with the default settings.</p><p>&nbsp; &nbsp; &nbsp; /VERYLOWDISK&nbsp; &nbsp; &nbsp;Run with the default settings, no user prompts.</p><p>&nbsp; &nbsp; &nbsp; /SETUP&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Undocumented<br />&nbsp; &nbsp; &nbsp; /Help&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Undocumented<br />&nbsp; &nbsp; &nbsp; /Usage&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Undocumented<br />&nbsp; &nbsp; &nbsp; /?&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Display help</p></blockquote></div><p>Если один раз запустить:</p><div class="codebox"><pre><code>run cleanmgr.exe /sageset: 1</code></pre></div><p>Поставить нужные отметки, нажать ок для сохранения настроек в реестр под номером 1.</p><p>И далее просто запускать с сохранёнными настройками:</p><div class="codebox"><pre><code>run cleanmgr.exe /d C: /sagerun: 1</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-18T17:56:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96589#p96589</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96587#p96587" />
			<content type="html"><![CDATA[<p>Ну да, вот проверка OS - может надо написать. </p><div class="codebox"><pre><code>SetTitleMatchMode 2
run %windir%\system32\cleanmgr.exe /d %Disc%:</code></pre></div><p> или </p><div class="codebox"><pre><code>SetTitleMatchMode 2
run %windir%\SysWOW64\cleanmgr.exe /d %Disc%:</code></pre></div><p> Но после компиляции поможет ли это - я не уверен, надо проверить.</p><p>P.S. Проверил - не помогает, запускает 32-х разрядную версию, если файл 32-x разрядный. <br />Ладно сделаем 3 файла, это не принципиально, а админка тут не причём, запускал с разных профилей... хотя боюсь что упустил, что на всех компах это профиль админский.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T16:41:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96587#p96587</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96586#p96586" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Indomito пишет:</cite><blockquote><p>P.S. Надо в скрипт вставить проверку OS на разрядность...</p></blockquote></div><p>Она есть в скрипте <em>A_IsUnicode</em>, но проверяло админку.</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-08-18T16:27:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96586#p96586</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96585#p96585" />
			<content type="html"><![CDATA[<p>Не помогает, &quot;-2&quot; пункта по сравнению с консолью и самое главное не видит/не доходит до очистки обновлений.<br />Я и компилировал и так запускал, может нужно использовать другой bin в компиляции? <br />Например ANSI или по умолчанию?</p><p><strong>Ёкарный-бабай!!!</strong><br />У меня OS Windows 7 x64 - откомпилировал используя <strong>Unicode 64-bit.bin</strong> и всё заработало... да Windows это нечто. lol</p><p>P.S. Надо в скрипт вставить проверку OS на разрядность... вроде в AHK есть такая переменная + батник и два ЕХЕ-файла, т.е. не батник, а один стартовый, который запускает или x32 или x64 от типа разрядности OS.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T15:54:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96585#p96585</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96584#p96584" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Check := &quot;1|3&quot;
Disc := &quot;C&quot;

ShellExecute := A_IsUnicode ? &quot;shell32\ShellExecute&quot;:&quot;shell32\ShellExecuteA&quot;  
if not A_IsAdmin
{
      If A_IsCompiled
         DllCall(ShellExecute, uint, 0, str, &quot;RunAs&quot;, str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
      Else
         DllCall(ShellExecute, uint, 0, str, &quot;RunAs&quot;, str, A_AhkPath, str, &quot;&quot;&quot;&quot; . A_ScriptFullPath . &quot;&quot;&quot;&quot; . A_Space . params, str, A_WorkingDir, int, 1)
      ExitApp
}

SetTitleMatchMode 2
run %windir%\system32\cleanmgr.exe /d %Disc%:
WinWait % &quot; (&quot; Disc &quot;:&quot; &quot;) ahk_exe cleanmgr.exe&quot;
hwnd := WinExist(&quot; (&quot; Disc &quot;:&quot; &quot;) ahk_exe cleanmgr.exe&quot;)
ControlGet hwndctrl, Hwnd , ,SysListView321, % &quot;ahk_id &quot; hwnd
ControlGet, LVItems, List, ,,ahk_id %hwndctrl%
ControlSend,, {Down}, ahk_id %hwndctrl%
Loop, parse,LVItems,`n
    {
    SendMessage, 0x102C, A_Index - 1, 0x2000,, ahk_id %hwndctrl% ; LVM_GETITEMSTATE
    if ErrorLevel
        ControlSend,, {Space}, ahk_id %hwndctrl%
    if (A_Index ~= &quot;^(&quot; Check &quot;)$&quot;) or !Check
        ControlSend,, {Space}, ahk_id %hwndctrl%
    ControlSend,, {Down}, ahk_id %hwndctrl%
    }
    
ControlSend,, {Enter}, ahk_id %hwnd%
sleep 100
Send {Enter}
</code></pre></div><p>Вот запуск с админкой + косяки с галочками исправил.</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-08-18T15:37:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96584#p96584</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96582#p96582" />
			<content type="html"><![CDATA[<p>Так... нашёл ещё один прикол, но с чем он связан я не понял.</p><p>При обычной очистке - 12 пунктов.<br />При программной всего 5 пунктов.</p><p>Может нужен <em>&quot;Запуск от имени администратора&quot;</em>?</p><p><strong>UPD</strong></p><p>Перепробовал всё... не помогает.</p><p>Блин, забыл - Запуск из ком.процессора, это последнее что я не проверил.</p><p>Всё - не понимаю что не так, т.е. скрыты пункты которые можно очистить.</p><p>bat-файл выдаёт тоже самое, т.е. скрывает пункты, только запуск <strong>CMD.exe -&gt; cleanmgr.exe /d c:</strong> показывает все пункты.</p>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T14:46:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96582#p96582</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96581#p96581" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Check := &quot;1|2&quot;
Disc := &quot;E&quot;

SetTitleMatchMode 2
run %windir%\system32\cleanmgr.exe /d %Disc%:
WinWait % &quot; (&quot; Disc &quot;:&quot; &quot;) ahk_exe cleanmgr.exe&quot;
hwnd := WinExist(&quot; (&quot; Disc &quot;:&quot; &quot;) ahk_exe cleanmgr.exe&quot;)
ControlGet hwndctrl, Hwnd , ,SysListView321, % &quot;ahk_id &quot; hwnd
ControlGet, LVItems, List, ,,ahk_id %hwndctrl%
ControlSend,, {Down}, ahk_id %hwndctrl%
Loop, parse,LVItems,`n
    {
    SendMessage, 0x102C, A_Index - 1, 0x2000,, ahk_id %hwndctrl% ; LVM_GETITEMSTATE
    if ErrorLevel
        ControlSend,, {Space}, ahk_id %hwndctrl%
    if (A_Index ~= &quot;^&quot; Check &quot;$&quot;) or !Check
        ControlSend,, {Space}, ahk_id %hwndctrl%
    ControlSend,, {Down}, ahk_id %hwndctrl%
    }

ControlSend,, {Enter}, ahk_id %hwnd%
sleep 100
Send {Enter}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-08-18T14:37:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96581#p96581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Функция "Очистка Диска" в Win 7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96580#p96580" />
			<content type="html"><![CDATA[<p>Так...</p><p>Написал. </p><div class="codebox"><pre><code>Check := &quot;1|4|5&quot;

SetTitleMatchMode 2
run %windir%\system32\cleanmgr.exe /d C:
WinWait Очистка диска  (C:) ahk_exe cleanmgr.exe</code></pre></div><p> Выбрались все пункты, что ты не учёл... пытаюсь разобраться.</p><p>И концовка не срабатывает, т.е. не нажатия на ОК. </p><div class="codebox"><pre><code>ControlSend,, {Enter}, ahk_id %hwnd%
sleep 100
Send {Enter}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Indomito]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27285</uri>
			</author>
			<updated>2015-08-18T14:24:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96580#p96580</id>
		</entry>
</feed>
