<?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=12493&amp;type=atom" />
	<updated>2017-02-23T18:21:32Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12493</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сохранение многострочных данных в ini-файл]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=113138#p113138" />
			<content type="html"><![CDATA[<p>Функции от <strong>Malcev</strong> без использования автозамены. Строки раскладываются по параметрам внутри секции ini-файла.</p><div class="codebox"><pre><code>
Win_Counts_1 =
(
http://worldoftanks.ru Home - ROBLOX
ok.ru
)

MyIniWrite(Win_Counts_1, &quot;Filename.ini&quot;, &quot;Section&quot;, &quot;Key&quot;)
MyIniRead(OutputVar, &quot;Filename.ini&quot;, &quot;Section&quot;, &quot;Key&quot;, &quot;MyError&quot;)
MsgBox, % OutputVar
Return

MyIniWrite(Value, Filename, Section, Key)
{
   Loop, Parse, value, `r`n
      IniWrite, %A_LoopField%, %Filename%, %Section%, %A_Index%|%Key%
}


MyIniRead(ByRef OutputVar, Filename, Section, Key, ByRef Default)
{
   loop
   {
      IniRead, Value, %Filename%, %Section%, %A_Index%|%Key%, %Default%
      If (Value = Default)
         break
      If A_Index = 1
         OutputVar := value 
      else
         OutputVar .= &quot;`n&quot; value
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-02-23T18:21:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=113138#p113138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Сохранение многострочных данных в ini-файл]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=113137#p113137" />
			<content type="html"><![CDATA[<p>Две функции позволяют сохранять в ini-файл и считывать из него данные, содержащие несколько строк. <br /></p><div class="codebox"><pre><code>MyIniWrite(Value, Filename, Section, Key){
StringReplace, Value, Value, `n, &lt;linefeed&gt;, All
IniWrite, %Value%, %Filename%, %Section%, %Key%
}

MyIniRead(ByRef OutputVar, Filename, Section, Key, ByRef Default){
IniRead,  OutputVar, %Filename%, %Section%, %Key%, %Default%
StringReplace, OutputVar, OutputVar, &lt;linefeed&gt;, `n, All
}</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Пример использования</div><div class="fancy_spoiler"><div class="codebox"><pre><code>Win_Counts_1 =
(
Строка 1
Строка 2
Строка 3
)

MyIniWrite(Win_Counts_1, &quot;Filename.ini&quot;, &quot;Section&quot;, &quot;Key&quot;)
MyIniRead(OutputVar, &quot;Filename.ini&quot;, &quot;Section&quot;, &quot;Key&quot;, &quot;MyError&quot;)
MsgBox, % OutputVar
Return

MyIniWrite(Value, Filename, Section, Key){
StringReplace, Value, Value, `n, &lt;linefeed&gt;, All
IniWrite, %Value%, %Filename%, %Section%, %Key%
}

MyIniRead(ByRef OutputVar, Filename, Section, Key, ByRef Default){
IniRead,  OutputVar, %Filename%, %Section%, %Key%, %Default%
StringReplace, OutputVar, OutputVar, &lt;linefeed&gt;, `n, All
}</code></pre></div></div></div><p><a href="http://forum.script-coding.com/viewtopic.php?id=12474&amp;p=2">Связанная тема</a></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-02-23T18:19:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=113137#p113137</id>
		</entry>
</feed>
