<?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=17797&amp;type=atom" />
	<updated>2023-05-16T21:03:28Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17797</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158294#p158294" />
			<content type="html"><![CDATA[<p>Кому интересно, по ссылке сравнение оригинала страницы - со страницей, измененной ком объектом:</p><p><a href="https://disk.yandex.ru/d/l9idCq4OI5ortg">https://disk.yandex.ru/d/l9idCq4OI5ortg</a>.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T21:03:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158294#p158294</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158291#p158291" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>john_dease пишет:</cite><blockquote><p>Решение есть в виде предварительных замен.</p></blockquote></div><p>Состоит в том, чтобы сначала пропустить всё содержимое исходной переменной через ком объект, чтобы внеслись все изменения согласно его формату, а потом всё остальное.<br /></p><div class="codebox"><pre><code>var2 =
(
&lt;div class=&quot;pre&quot;&gt;
&lt;span&gt;&lt;a href=&quot;&quot; title=&quot;&quot;&gt;&lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;&lt;div&gt;&lt;/div&gt;
)

(oHTML := ComObjCreate(&quot;HTMLFile&quot;)).write(var2)

Loop % (all := oHTML.all).length 
{
    this := all[A_Index-1]
    Text := this.outerHTML ;outerHTML/innerText
    ClassName := this.ClassName
    TagName := this.TagName
    
    If (TagName = &quot;html&quot;) {
       var2 := RegExReplace(Text, &quot;s)^&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;(.*)&lt;/body&gt;&lt;/html&gt;$&quot;, &quot;$1&quot;)
    }
}
msgbox new var2:`n`n%var2%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T20:52:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158291#p158291</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158287#p158287" />
			<content type="html"><![CDATA[<p>Решение есть в виде предварительных замен. Но мне хотелось убедиться, что есть настройка для ComObjCreate(&quot;HTMLFile&quot;) не менять теги.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T19:00:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158287#p158287</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158286#p158286" />
			<content type="html"><![CDATA[<p>Решайте задачу другим способом.<br />Вы ж не первый день занимаетесь парсингом хтмл.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-05-16T18:55:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158286#p158286</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158285#p158285" />
			<content type="html"><![CDATA[<p>Но там другая ситуация: в цикле вычленяется тег &lt;div class=&quot;pre&quot;&gt;.*?&lt;/div&gt;. Казалось бы, содержимое внутри этого тега должно быть идентичным исходной переменной. Но оказывается, что туда вносятся изменения - href и title меняются местами.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T18:53:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158285#p158285</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158284#p158284" />
			<content type="html"><![CDATA[<p>Конечно вносятся.<br /></p><div class="codebox"><pre><code>document := ComObjCreate(&quot;HTMLFile&quot;)
document.write(&quot;a&quot;)
msgbox % document.documentElement.outerHTML</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-05-16T18:47:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158284#p158284</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158281#p158281" />
			<content type="html"><![CDATA[<p>Другие способы перебора связанных тегов, мне неизвестны. А то что вносятся изменения вы подтверждаете? У вас так же меняется изначальная переменная в цикле? То есть, объект работающий с HTML - переставляет элементы внутри тегов.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T18:29:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158281#p158281</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158280#p158280" />
			<content type="html"><![CDATA[<p>Без разницы.<br />Ищите другие способы.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-05-16T18:25:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158280#p158280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158279#p158279" />
			<content type="html"><![CDATA[<p>Наверно имелся в виду innerText? Но он не подходит, так как берет текст без тегов.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T18:17:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158279#p158279</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158278#p158278" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>john_dease пишет:</cite><blockquote><p>текст в переменной меняется</p></blockquote></div><p>При чем тут текст в переменной?<br />В dom текст нужно получать с помощью свойства outerText, например.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-05-16T18:14:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158278#p158278</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158277#p158277" />
			<content type="html"><![CDATA[<p>1) В результате работы кода из первого сообщения текст меняется (текст в переменной меняется с «HREF=&quot;&quot; title=&quot;&quot;» на «title=&quot;&quot; href=&quot;&quot;»). Или только у меня так?<br />2) Я и не использовал регулярки, а простую замену: полученный тег из перебора - обернуть угловыми скобками («%Text%» на «&lt;&lt;&lt;&lt;%Text%&gt;&gt;&gt;&gt;»).</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T18:12:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158277#p158277</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158275#p158275" />
			<content type="html"><![CDATA[<p>1) С чего вы взяли что меняется текст?<br />2) Если решили парсить через dom, то используйте его методы, а не регулярку.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-05-16T18:02:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158275#p158275</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158273#p158273" />
			<content type="html"><![CDATA[<p>Правильно понимаю, что с тем что в ком объекте меняется текст, ничего нельзя поделать?</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T17:36:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158273#p158273</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158270#p158270" />
			<content type="html"><![CDATA[<p>Наверняка проблема до него - но инициатором все равно является ком объект, который изменяет изначальную переменную.</p>]]></content>
			<author>
				<name><![CDATA[john_dease]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42972</uri>
			</author>
			<updated>2023-05-16T16:15:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158270#p158270</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена многострочного текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=158269#p158269" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Я как раз спросил, почему вы думаете, что проблема в цикле, и проверяли ли вы до него.</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-05-16T16:14:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=158269#p158269</id>
		</entry>
</feed>
