<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17167&amp;type=atom" />
	<updated>2022-06-09T13:54:34Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17167</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153501#p153501" />
			<content type="html"><![CDATA[<p>Шедевр, еще раз спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T13:54:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153501#p153501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153500#p153500" />
			<content type="html"><![CDATA[<p>Ну или чтобы регулярка попроще была, то можно так:<br /></p><div class="codebox"><pre><code>filePath := A_Desktop . &quot;\test.ini&quot; ; указать правильный путь
section := &quot;Trash&quot;
key := &quot;Path&quot;
IniRead, pairs, % filePath, % section
m := &quot;&quot;
while RegExMatch(pairs, &quot;`amiO)^&quot; . key . &quot;=\K\V+&quot;, m, m ? m.Pos + m.Len : 1)
   MsgBox, % m[0]</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-06-09T13:41:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153500#p153500</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153499#p153499" />
			<content type="html"><![CDATA[<p>Спасибо большое, работает, еще предстоит разобрать все строки, чтоб понять), особенно RegExMatch.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T13:36:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153499#p153499</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153498#p153498" />
			<content type="html"><![CDATA[<p>Этот код читает секцию целиком, но и вместе с ключами, а мне не нужно чтоб он читал &quot;path=&quot; все что после нужно читать и передавать.<br /></p><div class="codebox"><pre><code>IniRead, OutputVarSection, Filename, Section</code></pre></div><p>Тут regex нужно использовать?</p><p>UPD: поздно написал), сейчас попробую, спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T13:31:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153498#p153498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153497#p153497" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Чтобы прочитать секцию целиком, есть команда</p></blockquote></div><p>Хотя, если файл нестандартный, я бы лучше читал регуляркой. Предположим есть ini:<br /></p><div class="codebox"><pre><code>[Files]
Path=C:\test0.txt
Path=D:\test0.exe
[Trash]
Path=C:\test.txt
Path=D:\test.exe
[Sect]
Path=C:\test2.txt
Path=D:\test2.exe</code></pre></div><p>Ключи Path из секции Trash можно прочитать так:<br /></p><div class="codebox"><pre><code>filePath := A_Desktop . &quot;\test.ini&quot; ; указать правильный путь
section := &quot;Trash&quot;
key := &quot;Path&quot;
FileRead, text, % filePath
m := &quot;&quot;
while RegExMatch(text, &quot;isO)(?:(?:^|\R)\[&quot; . section . &quot;]|(?!^)\G)(?:(?!\R\[|\s*$).)*?\K\R&quot; . key . &quot;=(\V+)&quot;, m, m ? m.Pos + m.Len : 1)
   MsgBox, % m[1]</code></pre></div><p>Как удалить прочитанные пути, надеюсь, догадаетесь.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-06-09T13:30:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153497#p153497</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153496#p153496" />
			<content type="html"><![CDATA[<p>Можно, пожалуйста пример, чтения и удаление всех файлов в ключах, path1=/path2=и т.д.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T13:21:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153496#p153496</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153495#p153495" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Logonius пишет:</cite><blockquote><p>Не может быть?</p></blockquote></div><p>Создать такую секцию можно, но обычно так <a href="https://window-10.ru/ini-fajly-chto-jeto/#:~:text=%D0%9E%D0%B4%D0%B8%D0%BD%D0%B0%D0%BA%D0%BE%D0%B2%D1%8B%D0%B5%20%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B">не делается</a>. Во всяком случае, это будет нестандартный ini-файл.<br />Чтобы прочитать секцию целиком, есть команда<br /></p><div class="codebox"><pre><code>IniRead, OutputVarSection, Filename, Section</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-06-09T12:57:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153495#p153495</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153494#p153494" />
			<content type="html"><![CDATA[<p>Вот пример кода, только для txt.</p><div class="codebox"><pre><code>
Loop, read, 1.txt
{
    Loop, parse, A_LoopReadLine, %A_Tab%
    {
        FileDelete, %A_LoopReadLine%
    }
}
</code></pre></div><p>Как сделать то же самое, только чтоб читал ini и только одну, всю секцию &quot;Trash&quot; и все ключи которые там (пути к файлам), удалил.<br />Потом будут другие секции там же, их потом по другому нужно прочитать и сделать другие действия с файлами.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T12:48:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153494#p153494</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153493#p153493" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong></p><p>То есть вот так &gt;&gt;&gt;</p><p>[Trash]<br />Path=1<br />Path=2</p><p>Не может быть?</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T12:38:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153493#p153493</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153492#p153492" />
			<content type="html"><![CDATA[<p>А что вы понимаете под «типом» ключа? Если это название ключа, то в одной секции стандартного ini-файла не может быть нескольких ключей с одинаковым названием.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-06-09T12:35:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153492#p153492</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Чтение одной секции всех одинаковых ключей в ini файле]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153491#p153491" />
			<content type="html"><![CDATA[<p>Привет.<br />Как прочитать в одной секции все ключи одного типа &quot;Path&quot;<br />Цель, чтоб при чтении ini файла, удалялись файлы, которые прописаны в ключах &quot;Path&quot; в секции, например &quot;Trash&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Logonius]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42542</uri>
			</author>
			<updated>2022-06-09T12:30:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153491#p153491</id>
		</entry>
</feed>
