<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15544&amp;type=atom" />
	<updated>2020-07-26T17:04:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15544</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141130#p141130" />
			<content type="html"><![CDATA[<p>Спасибо большое.<br />Все заработало.</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-26T17:04:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141130#p141130</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141126#p141126" />
			<content type="html"><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>FileRead, fileContent, MyFile.txt
while RegExMatch(fileContent, &quot;`amiO)((?:^:.+$\R?)+)\R(^[a-z]:\\.+$)&quot;, m, m ? m.Pos + m.Len : 1) {
   Loop, parse, % m[1], `n, `r
      Hotstring(A_LoopField, Func(&quot;RunFile&quot;).Bind(m[2]))
}
Return

RunFile(filePath) {
   Run, % filePath
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-26T16:03:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141126#p141126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141114#p141114" />
			<content type="html"><![CDATA[<p>Подскажите, а нельзя ли как-нибудь распознавать данные в txt вот в таком виде (с разделителем в виде строки):</p><p>:*X:Первая команда!<br />:*X:Команда первая!<br />F:\каталог файлов\3 5v.au3</p><p>:*X:Запустить программу2!<br />F:\каталог файлов\741.au3</p><p>(Чтобы не писать - рядом с однотипными командами - один и тот же адрес.)</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-26T12:57:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141114#p141114</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141113#p141113" />
			<content type="html"><![CDATA[<p>Спасибо.<br />Все работает.</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-26T12:44:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141113#p141113</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141054#p141054" />
			<content type="html"><![CDATA[<p>Можно, тогда так:<br /></p><div class="codebox"><pre><code>FileRead, fileContent, MyFile.txt
while RegExMatch(fileContent, &quot;`amO)^(.+)\|(.+)$&quot;, m, m ? m.Pos + m.Len : 1)
   Hotstring(m[1], Func(&quot;RunFile&quot;).Bind(m[2]))
Return

RunFile(filePath) {
   Run, % filePath
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-25T23:47:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141054#p141054</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141051#p141051" />
			<content type="html"><![CDATA[<p>А может быть можно как-нибудь, перенести в txt не команду, а только путь к исполняемому файлу (который нужно запустить) ?</p><p>Чтобы вот такой вид текста был в txt:<br />:*X:Первая команда!|F:\каталог файлов\3 5v.au3<br />:*X:Команда первая!|F:\каталог файлов\3 5v.au3<br />:*X:Запустить программу2!|F:\каталог файлов\741.au3</p><p>В коде по-прежнему будет присутствовать команда Run <br />А адрес приставленный в коде - к Run - чтобы брался из txt</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-25T21:30:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141051#p141051</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141033#p141033" />
			<content type="html"><![CDATA[<p>Понятно</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-25T13:30:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141033#p141033</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141020#p141020" />
			<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>2020-07-25T12:20:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141020#p141020</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141017#p141017" />
			<content type="html"><![CDATA[<p>Ясно, спасибо.</p><p>Но это - только ключевые слова.<br />Команды Action1 и Action1 -&nbsp; по-прежнему находятся внутри скрипта, а не в том же самом txt<br />Я имею ввиду саму команду ( MsgBox, % A_ThisFunc ), а не ссылку на нее - Action1.</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-25T12:09:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141017#p141017</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141010#p141010" />
			<content type="html"><![CDATA[<p>Сам скрипт должен так выглядеть:<br /></p><div class="codebox"><pre><code>FileRead, fileContent, MyFile.txt
while RegExMatch(fileContent, &quot;`amO)^(.+)\|(.+)$&quot;, m, m ? m.Pos + m.Len : 1)
   Hotstring(m[1], m[2])
Return

Action1() {
   MsgBox, % A_ThisFunc
}

Action2() {
   MsgBox, % A_ThisFunc
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-25T11:21:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141010#p141010</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141009#p141009" />
			<content type="html"><![CDATA[<p>Пишите ту часть, что в моём скрипте в начале, в файл:<br /></p><div class="codebox"><pre><code>:*X:Первая команда!|Action1
:*X:Команда первая!|Action1
:*X:Запустить программу2!|Action2</code></pre></div><p>В скрипте читайте содержимое файла в переменную fileContent.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-25T11:16:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141009#p141009</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141008#p141008" />
			<content type="html"><![CDATA[<p>Я в самом первом сообщении именно об этом и спрашивал.</p><p>У меня есть простой классический код ahk.<br />Он реагирует на последовательность нажатий клавиш на клавиатуре.<br />Если вводится конкретное слово, то скрипт немедленно выполняет какую-то команду.</p><p>Но неудобно вводить множество команд - внутрь этого кода.<br />Подскажите, как заставить скрипт искать нужные слова - внутри файла txt, где записаны команды ?<br />То есть, чтобы работал так же, но слова-команды хранились бы отдельно - внутри файла txt.</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-25T11:12:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141008#p141008</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140997#p140997" />
			<content type="html"><![CDATA[<p>То, что fileContent — пишите в файле. В скрипте используйте <em>FileRead, fileContent, MyFile.txt</em>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-25T10:43:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140997#p140997</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140995#p140995" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Здесь не написать много команд и не разбить их на категории.<br />Как взять эти команды из txt файла ?</p>]]></content>
			<author>
				<name><![CDATA[plank1433]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40962</uri>
			</author>
			<updated>2020-07-25T10:41:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140995#p140995</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как реагировать на нужные слова - внутри файла txt]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140986#p140986" />
			<content type="html"><![CDATA[<p>Можно использовать такой принцип:<br /></p><div class="codebox"><pre><code>fileContent =
(
:*X:Первая команда!|Action1
:*X:Команда первая!|Action1
:*X:Запустить программу2!|Action2
)
while RegExMatch(fileContent, &quot;`amO)^(.+)\|(.+)$&quot;, m, m ? m.Pos + m.Len : 1)
   Hotstring(m[1], m[2])
Return

Action1() {
   MsgBox, % A_ThisFunc
}

Action2() {
   MsgBox, % A_ThisFunc
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-25T10:15:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140986#p140986</id>
		</entry>
</feed>
