<?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=10587&amp;type=atom" />
	<updated>2022-12-21T09:04:00Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10587</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156097#p156097" />
			<content type="html"><![CDATA[<p><strong>viviancels</strong>, ознакомьтесь, пожалуйста, с <a href="https://forum.script-coding.com/misc.php?action=rules">Правилами</a>, отредактируйте свой пост. Обратите внимание на оформление <a href="https://forum.script-coding.com/misc.php?action=rules#links-formatting">ссылок</a>.<br />Также прочитайте внимательно <a href="https://forum.script-coding.com/viewtopic.php?pid=155139#p155139">этот</a> пост.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-12-21T09:04:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156097#p156097</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156096#p156096" />
			<content type="html"><![CDATA[<p>Здравствуйте. Почему-то, не редактируется буфер.<br /></p><div class="codebox"><pre><code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases
; #Warn  ; Enable warnings to assist with detecting common errors.
; SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
; SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance Force
^vk43::
Clipboard :=
Sleep 150
Send ^{vk43}
Sleep 150
Clipwait
Clipboard := RegExReplace(Clipboard, &quot;m`a)^(.*)$\n.*,\s(.*)$&quot;, &quot;$2 - $1&quot;)
return</code></pre></div><p>Текст: </p><div class="codebox"><pre><code>Awakening

En-Core, Malyarovsky Maxim, Nikita</code></pre></div><p>Результат должен быть: </p><div class="codebox"><pre><code>Nikita - Awakening</code></pre></div><p>Здесь ошибки вроде нет:<br /><a href="https://regex101.com/r/MeOefY/1">https://regex101.com/r/MeOefY/1</a></p><p><strong>UPD.</strong> Понял, в чем ошибка. Нужно добавить опцию <strong>s</strong> точка - перенос строки):<br /></p><div class="codebox"><pre><code>RegExReplace(Clipboard, &quot;ms`a)^(.*)$\n.*,\s(.*)$&quot;, &quot;$2 - $1&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[viviancels]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42788</uri>
			</author>
			<updated>2022-12-21T07:18:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156096#p156096</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93689#p93689" />
			<content type="html"><![CDATA[<p>Проще собрать все названия в один массив. Если [в скобках] стоит 1, (в примере у Wiki и Google), то 2ая строка будет вырезана.<br /></p><div class="codebox"><pre><code>#Persistent
Sites := {&quot;Яндекс&quot;: [&quot;Это взято с сайта Яндекс&quot;]
        ,&quot;Google&quot;: [&quot;Это взято с сайта Google&quot;, 1]
        ,&quot;Википедия&quot;: [&quot;Это взято с сайта Wiki&quot;,1]
        ,&quot;Серый форум&quot;: &quot;Это взято с сайта script-coding&quot;}
return
OnClipboardChange:
   IfWinNotActive ahk_class MozillaWindowClass
   return
   site := &quot;&quot;
   WinGetTitle, Title, A
   for k,v in Sites 
      If InStr(Title, k) {
         site := v[1]
         if (v[2]=1)
            ClipBoard := RegexReplace(ClipBoard, &quot;s)\R.*?(?=(\R|$))&quot;,,,1)
         Break
      }
If (site != &quot;&quot;)
   FileAppend, %Clipboard%`n%site%`n`n----------------------`n, G:\My Text File.txt
   Sleep 300
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-04-28T14:39:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93689#p93689</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93683#p93683" />
			<content type="html"><![CDATA[<p>Наверное можно и регексами:<br /></p><div class="codebox"><pre><code>f11::
msgbox % RegexReplace(ClipBoard, &quot;s)\R.*?(?=(\R|$))&quot;,,,1)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-28T12:14:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93683#p93683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93679#p93679" />
			<content type="html"><![CDATA[<p>Работает!<br />А можно в этот код в Else if InStr дописать код при котором (естественно в зависимости от title) будет удаляться 2ая строка в копируемом тексте?</p><p>Начинать надо с Loop, parse, clipboard, `n, `r ?</p>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-28T10:26:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93679#p93679</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93675#p93675" />
			<content type="html"><![CDATA[<p>Ну так и будет:<br /></p><div class="codebox"><pre><code>If InStr(title, &quot;Яндекс&quot;)
   site := &quot;Это взято с сайта Яндекс&quot;
Else if InStr(title, &quot;Google&quot;)
   site := &quot;Это взято с сайта Google&quot;
Else if InStr(title, &quot;Wiki&quot;)
   site := &quot;Это взято с сайта Wiki&quot;
Else if InStr(title, &quot;script-coding&quot;)
   site := &quot;Это взято с сайта script-coding&quot;
Else
   site := &quot;&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-28T08:20:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93675#p93675</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93674#p93674" />
			<content type="html"><![CDATA[<p>это я сразу понял и применил. вопрос стоит иначе: как мне размножить этот код на 5-7-8-158 сайтов?<br />то есть к примеру этот код нужно применить к гугль, яндекс, википедия, ютуб, форум скрипт кодинг, то как будет выглядеть код?</p>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-28T07:45:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93674#p93674</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93672#p93672" />
			<content type="html"><![CDATA[<p>Дублируете эти секции:<br /></p><div class="codebox"><pre><code>Else if InStr(title, &quot;Google&quot;)
   site := &quot;Это взято с сайта Google&quot;</code></pre></div><p>Вместо &quot;Google&quot; вписываете отличительный признак страницы, который получаете через AHKSPY.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-27T23:55:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93672#p93672</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93669#p93669" />
			<content type="html"><![CDATA[<p>http://www.script-coding.com/AutoHotkey/IfInString.html<br />прочитал, но так и не понял, а как в этот код добавить еще множество сайтов, помимо гугля и яндекса?</p>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-27T22:35:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93669#p93669</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93668#p93668" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Я подправил 14 код.</p></blockquote></div><p>вот так работает:<br /></p><div class="codebox"><pre><code>#Persistent
return

OnClipboardChange:
IfWinNotActive ahk_class MozillaWindowClass
   return
WinGetTitle, Title, A
If InStr(title, &quot;Яндекс&quot;)
   site := &quot;Это взято с сайта Яндекс&quot;
Else if InStr(title, &quot;Google&quot;)
   site := &quot;Это взято с сайта Google&quot;
Else
   site := &quot;&quot;
If (site != &quot;&quot;)
FileAppend, %Clipboard%`n%site%`n`n----------------------`n, G:\My Text File.txt
return</code></pre></div><p>Спасибо, <strong>Malcev</strong>!</p>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-27T22:02:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93668#p93668</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93667#p93667" />
			<content type="html"><![CDATA[<p>Я подправил 14 код.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-27T21:53:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93667#p93667</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93666#p93666" />
			<content type="html"><![CDATA[<p>с msgbox работает, а вот с FileAppend не хочет. Что не так?:</p><div class="codebox"><pre><code>F4::
#Persistent
return

OnClipboardChange:
IfWinNotActive ahk_class MozillaWindowClass
   return
WinGetTitle, Title, A
If InStr(title, &quot;Яндекс&quot;)
   site := &quot;Это взято с сайта Яндекс&quot;
Else if InStr(title, &quot;Google&quot;)
   site := &quot;Это взято с сайта Google&quot;
Else
   site := &quot;&quot;
If (site != &quot;&quot;)
FileAppend, %Clipboard% `n site`n`n----------------------`n, G:\My Text File.txt
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-27T21:51:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93666#p93666</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93663#p93663" />
			<content type="html"><![CDATA[<p>Например так:<br /></p><div class="codebox"><pre><code>#Persistent
return

OnClipboardChange:
If !WinActive(&quot;ahk_class MozillaWindowClass&quot;) or toggle
{
   toggle := &quot;&quot;
   return
}
toggle := 1
WinGetTitle, Title, A
If InStr(title, &quot;Яндекс&quot;)
   site := &quot;Это взято с сайта Яндекс&quot;
Else if InStr(title, &quot;Google&quot;)
   site := &quot;Это взято с сайта Google&quot;
Else
   site := &quot;&quot;
If (site != &quot;&quot;)
   ClipBoard .= &quot;`r`n&quot; site
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-27T21:26:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93663#p93663</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93660#p93660" />
			<content type="html"><![CDATA[<p>Продолжаю про буфер обмена.<br />Вопрос такой: если я копирую текст с разных сайтов, то можно ли сделать соответствующую индивидуальную приписку в конце текста, которая зависит от того с какого сайта я это скопировал?<br />Например:</p><p>блаблабла<br />Это взято с сайта google ;приписка</p><p>блаблабла<br />Это взято с сайта яндекс ;приписка</p><br /><p>_______<br />браузер мозилла</p>]]></content>
			<author>
				<name><![CDATA[busyava]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33010</uri>
			</author>
			<updated>2015-04-27T19:59:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93660#p93660</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Буфер обмена, замена текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93464#p93464" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>&quot;Заголовок с информацией&quot; - это условно, может быть и другой заголовок.</p></blockquote></div><p>Не заметил. Тогда можно так:<br /></p><div class="codebox"><pre><code>f1::
RegexMatch(ClipBoard, &quot;s)(?:.*?[\n\r]+){5}(.*)Дмитрий\.&quot;, match)
msgbox % Clipboard := match1 &quot;С уважением, Дмитрий. Прочитано.&quot;
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-17T23:14:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93464#p93464</id>
		</entry>
</feed>
