<?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=14668&amp;type=atom" />
	<updated>2019-03-25T21:12:49Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14668</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133163#p133163" />
			<content type="html"><![CDATA[<p>Notepad++ может сохранять в UTF-8 без BOM. AHK не понимает этой кодировки, должна быть UTF-8 c BOM.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2019-03-25T21:12:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133163#p133163</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133161#p133161" />
			<content type="html"><![CDATA[<p>В notepad есть меню которое отвечает за кодировку файла. Ещё использовать редактор Scite4 но придется его докачать отдельно.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2019-03-25T20:35:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133161#p133161</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133159#p133159" />
			<content type="html"><![CDATA[<p><strong>belyankin12</strong> Нашел проблему. Странным образом скрипты которые создаются правой кнопкой с контекстного меню работают, а вот те которые я сохранил с помощью Notepad++ перестают работать. Наверное&nbsp; Notepad сохраняет скрипт в неверной кодировке.<br />Большое вам спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Military]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38645</uri>
			</author>
			<updated>2019-03-25T20:13:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133159#p133159</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133158#p133158" />
			<content type="html"><![CDATA[<p>Проверьте состояние переменной clipboard, я полагаю у вас там иероглифы одни вместо русских символов. Когда-то сталкивался с этим но все само-собой прошло. В те времена я пользовался <a href="http://forum.script-coding.com/viewtopic.php?id=1073">этим</a>.</p><p>UPD: А, вот освежив в той самой теме память помимо использования этих функций можно просто установить язык в системе по умолчанию русский и тогда должно все работать стандартными методами.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2019-03-25T19:42:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133158#p133158</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133157#p133157" />
			<content type="html"><![CDATA[<p><strong>belyankin12</strong>&nbsp; Попробовал работает.<br /></p><div class="codebox"><pre><code>#IfWinActive ,ahk_exe chrome.exe,

ctrl &amp; LButton:: 
{
	clipboard =
	Send {LButton Down}
	Sleep, 100
	Send {LButton Up}
	Sleep, 100
	Send ^c
	ClipWait, 1
	CopyString  := clipboard

If RegExMatch(CopyString, &quot;(купить|like)&quot;){
	WinActivate, ahk_exe notepad.exe
	WinWaitActive, ahk_exe notepad.exe
	sleep 100
	SendInput, {enter}
	sleep 100
	Send ^v
	sleep 100
	SendInput, {enter}
	}
}
	</code></pre></div><p>но почему-то не хочет искать русские символы. Например когда я указываю&nbsp; <strong>&quot;(хочу|like)&quot; </strong>русские сообщения не обрабатывает, а вот так <strong>&quot;(Synthesis|like)&quot;</strong>работает, но проблема в том что слово &quot;Synthesis&quot; не статическое, оно меняется и за него цепляться нельзя.<br />Возможно проблема с кодировкой, Windows 7 EN</p>]]></content>
			<author>
				<name><![CDATA[Military]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38645</uri>
			</author>
			<updated>2019-03-25T18:23:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133157#p133157</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133153#p133153" />
			<content type="html"><![CDATA[<p>Так вы посмотрите мой пример с циклом. Там вы заносите в массив список всех слов которые хотите найти, а цикл будет проверять есть ли в буфере обмена одно из указанных в массиве слово. Если не хотите с массивом возиться можно воспользоваться RegExMatch - в шаблоне так же можно указать несколько вариантов:<br /></p><div class="codebox"><pre><code>var := &quot;@*** Hi, I&#039;d like to buy your Chaos Orb for my  Exalted Orb in Synthesis.&quot;
var2 := &quot;@*** Здравствуйте, хочу купить у вас Сфера хаоса за Сфера возвышения в лиге Synthesis.&quot;
msgbox, % RegExMatch(var, &quot;(хочу|like)&quot;)
msgbox, % RegExMatch(var2, &quot;(хочу|like)&quot;)</code></pre></div><p>InStr вам в этом деле не поможет, только дублировать.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2019-03-25T16:39:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133153#p133153</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133144#p133144" />
			<content type="html"><![CDATA[<p>C Вашей помощью получился такой скрипт:<br /></p><div class="codebox"><pre><code>#IfWinActive ,ahk_exe chrome.exe,

ctrl &amp; LButton:: 
{
	clipboard =
	Send {LButton Down}
	Sleep, 100
	Send {LButton Up}
	Sleep, 100
	Send ^c
	ClipWait, 1
	CopyString  := clipboard
	CheckWord := &quot;like&quot;

If InStr(CopyString, CheckWord){
	WinActivate, ahk_exe notepad.exe
	WinWaitActive, ahk_exe notepad.exe
	sleep 100
	SendInput, {enter}
	sleep 100
	Send ^v
	sleep 100
	SendInput, {enter}
	}
}</code></pre></div><p>Работает замечательно, но есть одно но, на сайте есть русская версия и английская.<br />Например:<br /><em>@*** Hi, I&#039;d like to buy your Chaos Orb for my&nbsp; Exalted Orb in Synthesis.</em><br />или<br /><em>@*** Здравствуйте, хочу купить у вас Сфера хаоса за Сфера возвышения в лиге Synthesis.</em><br />Возникает задача искать в буфере не только &quot;like&quot;, но и &quot;хочу&quot;.</p><p>Каким образом можно указать в функции InStr() два искомых слова?</p>]]></content>
			<author>
				<name><![CDATA[Military]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38645</uri>
			</author>
			<updated>2019-03-25T16:24:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133144#p133144</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133120#p133120" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, согласен, таким приемом я получаю все, кроме искомого слова, привычка что-ли просто.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2019-03-25T07:03:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133120#p133120</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133109#p133109" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>belyankin12 пишет:</cite><blockquote><div class="codebox"><pre><code>RegExMatch(Clipboard, &quot;(.*)&quot; . Arr[i] . &quot;(.*)&quot;)</code></pre></div></blockquote></div><p>Плохо понимаете RegexMatch. Все &quot;(.*)&quot; лишние.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2019-03-24T20:59:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133109#p133109</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133108#p133108" />
			<content type="html"><![CDATA[<p><a href="https://autohotkey.com/docs/commands/OnClipboardChange.htm">OnClipboardChange</a></p>]]></content>
			<author>
				<name><![CDATA[MandarinKa02]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34409</uri>
			</author>
			<updated>2019-03-24T20:16:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133108#p133108</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133107#p133107" />
			<content type="html"><![CDATA[<p>Я правильно понял задачу: вам нужно дождаться пока в буфере обмена появится определенное слово верно? Запускаете цикл и с помощью instr, regexmatch или contains (что лучше умеете так сказать) проверяете переменную clipboard.<br /></p><div class="codebox"><pre><code>Arr := [&quot;Some words&quot;, &quot;text&quot;]
i := 1
Loop {
    if (Clipboard = Arr[i]) {
        MsgBox, % &quot;Буфер обмена полностью состоит из искомого текста: &quot; Arr[i] &quot;&quot;
        break
    }
    
    if (RegExMatch(Clipboard, &quot;(.*)&quot; . Arr[i] . &quot;(.*)&quot;)) {
        msgbox, % &quot;В буфере обмена находится искомый текст: &quot; Arr[i] &quot;&quot;
        break
    }
    
    i := i = Arr.MaxIndex() ? 1 : i + 1
}</code></pre></div><p>Хотя мне кажется применение таймера будет более грамотным, может более опытные товарищи подскажут лучшую реализацию, но думаю общий принцип вы поняли.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2019-03-24T19:48:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133107#p133107</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Проверка в буфере обмена наличия определенного слова]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133106#p133106" />
			<content type="html"><![CDATA[<p>Есть скрипт:<br /></p><div class="codebox"><pre><code>#IfWinActive ,ahk_exe chrome.exe,
{
ctrl &amp; LButton::
clipboard =
Send {LButton Down}
Sleep, 100
Send {LButton Up}
ClipWait 
WinActivate, ahk_exe notepad.exe
WinWaitActive, ahk_exe notepad.exe
SendInput, {enter}
sleep 100
Send ^v
sleep 100
SendInput, {enter}
return
}</code></pre></div><p>Работает он довольно не плохо. но задача в том чтобы в месте &quot;ClipWait&quot; он продолжал работу когда в буфере обмена будет определенное слово. <br />Копируются при нажатии на определенную кнопку сообщения такого вида:<br /></p><div class="quotebox"><blockquote><p>@Arthas Hi, I&#039;d *like* *to* *buy* *your&quot; 500 Jeweller&#039;s Orb for my 61 Chaos Orb in Synthesis.<br />(В звездочки я взял статические слова которые в любом случае повторяются)</p></blockquote></div><p>Задача как-то пропарсить буфер обмена на наличие одного из слов и только в этом случае продолжить работу.<br />Кто сталкивался с подобными задачами и может помочь прошу указать правильный путь каким образом это лучше осуществить.</p>]]></content>
			<author>
				<name><![CDATA[Military]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38645</uri>
			</author>
			<updated>2019-03-24T19:40:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133106#p133106</id>
		</entry>
</feed>
