<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK v2: список сайтов из txt в json для Amnezia]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=18549&amp;type=atom" />
	<updated>2026-02-13T15:03:25Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=18549</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163080#p163080" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>haridev пишет:</cite><blockquote><p>Узнал про \V+, про &quot;вертикальный пробел&quot;</p></blockquote></div><p>Если что, \V — это как раз <em>всё, кроме</em> вертикального пробела, вертикальный пробел это \v.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2026-02-13T15:03:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163080#p163080</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163077#p163077" />
			<content type="html"><![CDATA[<p>Отлично! Узнал про \V+, про &quot;вертикальный пробел&quot;.<br />Добавил кавычки для имени сайта:<br /></p><div class="codebox"><pre><code>if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try FileDelete sitesJson
i := &#039;`s`s&#039;
s := Trim(FileRead(sites, &#039;`n&#039;), &#039;`n`t`s&#039;)
s := RegExReplace(s, &#039;\V+&#039;, i . &#039;{`n&#039; . i . i . &#039;&quot;hostname&quot;: &quot;$0&quot;`n&#039; . i . &#039;},&#039;)
s := &#039;[`n&#039; . RTrim(s, &#039;,&#039;) . &#039;`n]&#039;
FileAppend s, sitesJson</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-13T08:26:26Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163077#p163077</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163074#p163074" />
			<content type="html"><![CDATA[<p>Проще так:<br /></p><div class="codebox"><pre><code>if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try FileDelete sitesJson
i := &#039;`s`s&#039;
s := Trim(FileRead(sites, &#039;`n&#039;), &#039;`n`t`s&#039;)
s := RegExReplace(s, &#039;\V+&#039;, i . &#039;{`n&#039; . i . i . &#039;&quot;hostname&quot;: $0`n&#039; . i . &#039;},&#039;)
s := &#039;[`n&#039; . RTrim(s, &#039;,&#039;) . &#039;`n]&#039;
FileAppend s, sitesJson</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2026-02-13T00:20:17Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163074#p163074</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163072#p163072" />
			<content type="html"><![CDATA[<p>Так, примерно?<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try	FileDelete sitesJson
indent := &#039;`s`s&#039;, indent2 := indent . indent
s := RTrim(FileRead(sites, &#039;`n&#039;), &#039;`n`s`t&#039;)
s := RegExReplace(s, &#039;`n&#039;, &#039;&quot;`n&#039; . indent . &#039;},`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039;)
s := (&#039;[`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039;) . s . (&#039;&quot;`n&#039; . indent . &#039;}`n]&#039;)
FileAppend s, sitesJson
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-12T09:58:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163072#p163072</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163071#p163071" />
			<content type="html"><![CDATA[<p>Не следует много действий упаковывать в одну строку. Такое трудно читать и невозможно отлаживать.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2026-02-12T09:08:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163071#p163071</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163070#p163070" />
			<content type="html"><![CDATA[<p>Так, наверно<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try	FileDelete sitesJson
indent := &#039;`s`s&#039;, indent2 := indent . indent
FileAppend &#039;[`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039; . RegExReplace(RTrim(FileRead(sites, &#039;`n&#039;), &#039;`n`s`t&#039;), &#039;`n&#039;, &#039;&quot;`n&#039; . indent . &#039;},`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039;) . &#039;&quot;`n&#039; . indent . &#039;}`n]&#039;, sitesJson
ExitApp</code></pre></div><p>или так<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try	FileDelete sitesJson
indent := &#039;`s`s&#039;, indent2 := indent . indent
FileAppend &#039;[`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039;
. RegExReplace(RTrim(FileRead(sites, &#039;`n&#039;), &#039;`n`s`t&#039;)
	, &#039;`n&#039;, &#039;&quot;`n&#039; . indent . &#039;},`n&#039; . indent . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039;) . &#039;&quot;`n&#039; . indent . &#039;}`n]&#039;
, sitesJson
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-12T07:25:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163070#p163070</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163069#p163069" />
			<content type="html"><![CDATA[<p>Явных ошибок нет, но построчное чтение файла здесь не оптимально. Лучше считать весь текст сразу и сделать изменения через регулярку в один проход. Библиотека LightJson в данном случае не нужна.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2026-02-11T22:39:06Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163069#p163069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163068#p163068" />
			<content type="html"><![CDATA[<p>Особо вопроса нет. Думал, может кто ошибки укажет или предложит лучший вариант.<br />Вот ещё вариант<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
#Include &lt;LightJson&gt;
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
json := &#039;&#039;
Loop Read sites
	json .= (A_Index = 1 ? &#039;[&#039; : &#039;,&#039;) . &#039;{&quot;hostname&quot;:&quot;&#039; . A_LoopReadLine . &#039;&quot;}&#039;
json .= &#039;]&#039;
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
try	FileDelete sitesJson
FileAppend LightJson.Beautify(json, &#039;    &#039;), sitesJson
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-11T22:16:10Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163068#p163068</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163067#p163067" />
			<content type="html"><![CDATA[<p>А в чём вопрос-то?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2026-02-11T21:31:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163067#p163067</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163066#p163066" />
			<content type="html"><![CDATA[<p>ещё поправил<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
indent1 := &#039;`s`s&#039;, indent2 := indent1 . indent1
try	FileDelete sitesJson
Loop Read sites, sitesJson
	FileAppend (A_Index = 1 ? &#039;[`n&#039; : &#039;,`n&#039;) . indent1 . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039; . A_LoopReadLine . &#039;&quot;`n&#039; . indent1 . &#039;}&#039;
FileAppend &#039;`n]&#039;, sitesJson
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-11T20:43:58Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163066#p163066</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163065#p163065" />
			<content type="html"><![CDATA[<p>Подправил<br /></p><div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := SubStr(sites, 1, -3) . &#039;json&#039;
indent1 := A_Space . A_Space
indent2 := indent1 . indent1
if FileExist(sitesJson)
	FileDelete sitesJson
Loop Read sites, sitesJson
	FileAppend (A_Index = 1 ? &#039;[`n&#039; : &#039;,`n&#039;) . indent1 . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039; . A_LoopReadLine . &#039;&quot;`n&#039; . indent1 . &#039;}&#039;
FileAppend &#039;`n]&#039;, sitesJson
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-11T17:21:50Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163065#p163065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK v2: список сайтов из txt в json для Amnezia]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=163064#p163064" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>; список сайтов из txt в json для Amnezia
if !sites := FileSelect(1,, &#039;Список сайтов&#039;, &#039;Documents (*.txt)&#039;)
	ExitApp
sitesJson := StrReplace(sites, &#039;.txt&#039;, &#039;.json&#039;,, &amp;OutputVarCount)
if OutputVarCount != 1 {
	MsgBox &#039;Недопустимое имя входного файла&#039;
	ExitApp
}
indent1 := A_Space . A_Space
indent2 := indent1 . indent1
FileDelete sitesJson
Loop Read sites, sitesJson
	FileAppend (A_Index = 1 ? &#039;[`n&#039; : &#039;,`n&#039;) . indent1 . &#039;{`n&#039; . indent2 . &#039;&quot;hostname&quot;: &quot;&#039; . A_LoopReadLine . &#039;&quot;`n&#039; . indent1 . &#039;}&#039;
FileAppend &#039;`n]&#039;, sitesJson
ExitApp</code></pre></div><p>Для замечаний.</p>]]></content>
			<author>
				<name><![CDATA[haridev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=45040</uri>
			</author>
			<updated>2026-02-11T15:31:21Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=163064#p163064</id>
		</entry>
</feed>
