<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Переменная в тексте файла]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=12645</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12645&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Переменная в тексте файла».]]></description>
		<lastBuildDate>Sat, 29 Apr 2017 19:37:54 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115518#p115518</link>
			<description><![CDATA[<p>Объясните мне, чем не устраивает нормальный подход?<br /></p><div class="codebox"><pre><code>a:=&quot;знаки процента и гравис надо экранировать&quot;, b:=&quot;а кавычки &quot;&quot; не надо&quot;
x =
(
Тут разный текст
; %a% ``n 50`% `n
&quot; %b% &quot;&quot;
)
MsgBox % x</code></pre></div><p>Шаблон - есть, переменные - есть,<br />единственное что надо сделать — <br />1) в тексте перед использованием заменить все &quot;`&quot; на &quot;``&quot; и &quot;%&quot; на &quot;`%&quot;.<br />2) перед текстом вставить две строки ( &quot;x =&quot; и &quot;(&quot; ) и после текста одну строку со скобкой.<br />Зачем изголяться с RegEx?</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sat, 29 Apr 2017 19:37:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115518#p115518</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115516#p115516</link>
			<description><![CDATA[<p>Исправил.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 29 Apr 2017 19:03:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115516#p115516</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115512#p115512</link>
			<description><![CDATA[<p>Знак вопроса и квадратные скобки там лишние.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:55:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115512#p115512</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115511#p115511</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, да, действительно.<br /></p><div class="codebox"><pre><code>var := &quot;общего&quot;
text := &quot;это равно 20%, а то — 50% от %var% количества&quot;
Pos := 1, match := &quot;&quot;
While Pos := RegExMatch(text, &quot;s)(*UCP)%([\w#@$\x80-\x{10ffff}]{1,253})%&quot;, match, Pos)
{
   text := RegexReplace(text, match, %match1%,,1, Pos)
   Pos += StrLen(%match1%)
}
msgbox % text</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:47:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115511#p115511</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115510#p115510</link>
			<description><![CDATA[<p>Про &quot;#IncludeAgain&quot; даже не слышал. Вполне подходит, спасибо.<br />Надеюсь какая-то дополнительная нагрузка на память при большом количестве повторов не появляется?</p>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:42:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115510#p115510</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115509#p115509</link>
			<description><![CDATA[<p>stealzy, текст-шаблон, в котором есть специальные вставки для замены их значений. Хотелось увидеть какое-то универсальное решение. Но я вижу, что это сложнее чем мне казалось даже для профессионалов.<br />&nbsp; &nbsp;В принципе можно заранее проверять текст и заменять символы, которые могут помешать. И, для решения моей текущей задачи, можно откинуть существование варианта текстов с неизвестными заранее именами переменных.</p>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:40:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115509#p115509</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115508#p115508</link>
			<description><![CDATA[<p>Что значит &quot;изменить потом&quot;? Вы хотели задать переменные и затем подставить их в текст.<br /></p><div class="codebox"><pre><code>var1 := &quot;aaa&quot;
var2 := &quot;bbb&quot;
#Include 1.txt
MsgBox, %MyText%

var1 := &quot;111&quot;
var2 := &quot;222&quot;
#IncludeAgain 1.txt
MsgBox, %MyText%</code></pre></div><p>Так что ли?</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:34:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115508#p115508</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115507#p115507</link>
			<description><![CDATA[<p>Спасибо, рассмотрю 6 внимательней.</p><p>С &quot;include&quot; из 5 тоже не всё просто. Изменить значение потом нельзя.<br /></p><div class="codebox"><pre><code>var1 := &quot;aaa&quot;
var2 := &quot;bbb&quot;

#Include 1.txt
MsgBox, %MyText%

var1 := &quot;111&quot;
var2 := &quot;222&quot;

MsgBox, %MyText%</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:27:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115507#p115507</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115504#p115504</link>
			<description><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Тогда используйте код из 6 поста</p></blockquote></div><p>Я бы не стал. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>var := &quot;b&quot;
text := &quot;это равно 20%, а то — 50% от общего количества&quot;
Pos := 1, match := &quot;&quot;
While Pos := RegExMatch(text, &quot;s)%(.*?)%&quot;, match, Pos)
{
   text := RegexReplace(text, match, %match1%,,1, Pos)
   Pos += StrLen(%match1%)
}
msgbox % text</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 29 Apr 2017 18:22:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115504#p115504</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115502#p115502</link>
			<description><![CDATA[<div class="quotebox"><cite>Foma пишет:</cite><blockquote><p> А если заранее неизвестны имена всех переменных в тексте?</p></blockquote></div><p>Тогда используйте код из 6 поста.<br />Он заменяет все куски в тексте, обрамленные процентами на их значение.<br /></p><div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p> Если текст, то в нем не должно быть названий переменных.</p></blockquote></div><p>Вы же не знаете откуда этот текст берется.<br />Например, он может браться с веб-страницы, после чего с ним по какой-либо причине нужно проделать эти манипуляции.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 29 Apr 2017 17:55:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115502#p115502</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115501#p115501</link>
			<description><![CDATA[<p><strong>Foma</strong>, вы определитесь уже, у вас текст или код. Если текст, то в нем не должно быть названий переменных.<br />Если код, обращайтесь как с кодом. То что тут сейчас наворотили выглядит жутко.<br /></p><div class="codebox"><pre><code>a := &quot;Начало текста &quot;, b := 2*21, c := &quot;, еще текст.&quot;
d =
(
Много
строк
...
)
MsgBox % s := a b c &quot;`n&quot; d</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sat, 29 Apr 2017 17:34:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115501#p115501</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115500#p115500</link>
			<description><![CDATA[<p>Сделал.<br />Malcev, интересно получилось. А если заранее неизвестны имена всех переменных в тексте?</p>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sat, 29 Apr 2017 17:11:25 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115500#p115500</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115495#p115495</link>
			<description><![CDATA[<p><span style="color: green"><strong>Foma</strong>, расставьте точки в предложениях:<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=110043#p110043">http://forum.script-coding.com/viewtopi … 43#p110043</a>,<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=110533#p110533">http://forum.script-coding.com/viewtopi … 33#p110533</a>,<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=115490#p115490">http://forum.script-coding.com/viewtopi … 90#p115490</a>.</span></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 29 Apr 2017 16:18:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115495#p115495</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115492#p115492</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, если конкретно только переменную var нужно заменить, то проще.<br />Но если уж говорить о простоте, то так ешё проще и быстрее:<br /></p><div class="codebox"><pre><code>var = 777
var1 =
(
111 %var% 222
)
MsgBox, % var1 := StrReplace(var1, &quot;%var%&quot;, var)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 29 Apr 2017 15:57:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115492#p115492</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменная в тексте файла]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=115490#p115490</link>
			<description><![CDATA[<p>Так <br /></p><div class="codebox"><pre><code>:= RegExReplace(var1, &quot;%var%&quot;, var)</code></pre></div><p>можно опустить.</p>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sat, 29 Apr 2017 15:41:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=115490#p115490</guid>
		</item>
	</channel>
</rss>
