<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9271&amp;type=atom" />
	<updated>2014-02-24T13:24:27Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9271</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80353#p80353" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Ну так там вариантов не так много.</p></blockquote></div><div class="codebox"><pre><code>Loop, E:\Новая папка\*.html, , 1
{
   utf := &quot;&quot;
   FileRead, text, % A_LoopFileLongPath
   if RegExMatch(text, &quot;&lt;meta.*?charset=utf-8&quot;&quot;&gt;&quot;) &amp;&amp; utf := 1
      FileRead, text, % &quot;*P65001 &quot; A_LoopFileLongPath
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath, % &quot;CP&quot; . (utf ? &quot;65001&quot; : &quot;1251&quot;)
}</code></pre></div><p>Вот так вроде уже работает...</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-24T13:24:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80353#p80353</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80351#p80351" />
			<content type="html"><![CDATA[<p>Ну так там вариантов не так много.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-24T12:47:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80351#p80351</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80350#p80350" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А работает? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p></blockquote></div><p>Нет (хоть и не показывает ошибку).</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-24T12:33:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80350#p80350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80349#p80349" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Эдвард пишет:</cite><blockquote><p>Так?</p></blockquote></div><p>А работает? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-24T12:28:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80349#p80349</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80348#p80348" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Гляньте в Loop (files &amp; folders).</p></blockquote></div><p>Так?</p><div class="codebox"><pre><code>Loop, E:\Новая папка\*.html, 1
{
   utf := &quot;&quot;
   FileRead, text, % A_LoopFileLongPath
   if RegExMatch(text, &quot;&lt;meta.*?charset=utf-8&quot;&quot;&gt;&quot;) &amp;&amp; utf := 1
      FileRead, text, % &quot;*P65001 &quot; A_LoopFileLongPath
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath, % &quot;CP&quot; . (utf ? &quot;65001&quot; : &quot;1251&quot;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-24T12:26:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80348#p80348</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80347#p80347" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Эдвард пишет:</cite><blockquote><p>А хотелось бы, чтобы распространялась и на все подпапки.</p></blockquote></div><p>Гляньте в Loop (files &amp; folders).</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-24T12:21:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80347#p80347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80345#p80345" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Тогда так можно:...</p></blockquote></div><p>Спасибо за готовое решение. Самому пришлось бы мучиться с этой кодировкой очень долго.</p><p>Но всё же остался один нерешённый нюанс. Команда работает только с той папкой, которая указана в шаблоне имени. А хотелось бы, чтобы распространялась и на все подпапки.</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-24T12:07:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80345#p80345</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80321#p80321" />
			<content type="html"><![CDATA[<p>Тогда так можно:<br /></p><div class="codebox"><pre><code>Loop, E:\Новая папка\*.html
{
   utf := &quot;&quot;
   FileRead, text, % A_LoopFileLongPath
   if RegExMatch(text, &quot;&lt;meta.*?charset=utf-8&quot;&quot;&gt;&quot;) &amp;&amp; utf := 1
      FileRead, text, % &quot;*P65001 &quot; A_LoopFileLongPath
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath, % &quot;CP&quot; . (utf ? &quot;65001&quot; : &quot;1251&quot;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-23T17:39:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80321#p80321</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80320#p80320" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Ради интереса, пришлите через Attachments или через какой-нибудь сервис файл, который с кракозябрами считывается.</p></blockquote></div><p>Вот так выглядит файл в первозданном виде: <a href="http://med-75.narod.ru/34/335.html">http://med-75.narod.ru/34/335.html</a>.</p><p>И вот так – после выполнения команды: <a href="http://med-75.narod.ru/34/335-1.html">http://med-75.narod.ru/34/335-1.html</a>.</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-23T17:00:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80320#p80320</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80298#p80298" />
			<content type="html"><![CDATA[<p>Можно только так, как в справке прописано. Ради интереса, пришлите через Attachments или через какой-нибудь сервис файл, который с кракозябрами считывается.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-23T11:19:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80298#p80298</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80294#p80294" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Нужно посмотреть кодировку исходного файла и, если она не соответствует кодировке используемого интерпретатора, указать её в командах FileRead и FileAppend.</p></blockquote></div><p>Указал:</p><div class="codebox"><pre><code>Loop, E:\Новая папка\*.html
{
   FileRead, text, % A_LoopFileLongPath, UTF-8
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath, UTF-8
}</code></pre></div><p>Только если в теле html-файла имеется &quot;charset=utf-8&quot;, после выполнении команды вся кириллица превращается в кракозябры (при &quot;charset=windows-1251&quot; команда выполняется нормально).</p><p>Отсюда вопрос: можно ли для считывания текста файла в переменную указать универсальную (двойную) кодировку, а для записи только UTF-8?</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-23T10:04:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80294#p80294</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80247#p80247" />
			<content type="html"><![CDATA[<p>Нужно посмотреть кодировку исходного файла и, если она не соответствует кодировке используемого интерпретатора, указать её в командах FileRead и FileAppend.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-21T13:47:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80247#p80247</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80239#p80239" />
			<content type="html"><![CDATA[<p>Странно. Стоило поменять расширение, и код перестал работать:</p><div class="codebox"><pre><code>Loop, E:\Новая папка\*.html
{
   FileRead, text, % A_LoopFileLongPath
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath
}</code></pre></div><p>Опять чего-то не учёл (возможно, дело в кодировке)...</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-21T10:31:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80239#p80239</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80234#p80234" />
			<content type="html"><![CDATA[<p>Большое спасибо. Заработало!</p>]]></content>
			<author>
				<name><![CDATA[Эдвард]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27032</uri>
			</author>
			<updated>2014-02-21T08:04:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80234#p80234</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пакетное удаление текста в строке по заданному шаблону]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80225#p80225" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Loop, E:\Новая папка\*.txt
{
   FileRead, text, % A_LoopFileLongPath
   FileDelete, % A_LoopFileLongPath
   text := RegExReplace(text, &quot;Вредная и опасная&quot;)
   FileAppend, % text, % A_LoopFileLongPath
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-02-20T21:58:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80225#p80225</id>
		</entry>
</feed>
