<?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=6718&amp;type=atom" />
	<updated>2012-01-29T09:38:52Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6718</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Расширение функциональности буфера обмена]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56094#p56094" />
			<content type="html"><![CDATA[<p>Буквально через&nbsp; час после публикации топика наткнулся в документации на прежде не замечаемую метку <strong>OnClipboardChange:</strong>, которая предоставляет ту же функциональность, что и отслеживание <strong>WM_CLIPBOARDUPDATE</strong>. Потому вышеприведенный скрипт ничем не примечателен.</p><div class="codebox"><pre><code>
SendMessage, WM_PASTE     := 0x302,,,%FClassNN%, A
SendMessage, WM_KILLFOCUS := 0x8  ,,,%FClassNN%, A
SendMessage, WM_SETFOCUS  := 0x7  ,,,%FClassNN%, A</code></pre></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-01-29T09:38:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56094#p56094</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Расширение функциональности буфера обмена]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56093#p56093" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>creature.ws пишет:</cite><blockquote><div class="codebox"><pre><code>    SendMessage, 0x302,,,%FClassNN%, A
    SendMessage, 0x8  ,,,%FClassNN%, A
    SendMessage, 0x7  ,,,%FClassNN%, A</code></pre></div></blockquote></div><p>Желательно указывать расшифровку кодов сообщений.<br />Не могу оценить, к сожаленью, у меня ещё XP. У кого 7 — проверьте работоспособность, пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2012-01-29T09:24:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56093#p56093</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Расширение функциональности буфера обмена]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=55886#p55886" />
			<content type="html"><![CDATA[<p>Тема не нова, но возможно кого-либо заинтересует.<br />В наличии скрипт предоставляющий возможность оперировать 4-мя позициями «истории текстового содержимого буфера обмена». <br />Имеется желание добавить к нему «классическую» графическую оболочку вида &quot;traytip window&quot;, но отсутствует необходимый опыт.<br /></p><div class="codebox"><pre><code>
; Windows Vista+
; AHK-L
#SingleInstance Ignore
#KeyHistory 0
#NoEnv
#NoTrayIcon
OnExit, ExitSub
DllCall(&quot;AddClipboardFormatListener&quot;, &quot;Int&quot;, A_ScriptHwnd)
OnMessage(WM_CLIPBOARDUPDATE := 0x031D, &quot;ClipSave&quot;)
clipHistory := []

Esc &amp; F1::
Esc &amp; F2::
Esc &amp; F3::
Esc &amp; F4::
    Clipboard := clipHistory[Index := SubStr(A_ThisHotkey,0)]
    Controlgetfocus, FClassNN, A
    SendMessage, 0x302,,,%FClassNN%, A
    SendMessage, 0x8  ,,,%FClassNN%, A
    SendMessage, 0x7  ,,,%FClassNN%, A
Return

$Esc Up::Send {Blind}{Esc}
Return

ClipSave()
{
    global
    If (clipHistory[Index] = Clipboard)
        Return
    If !newIndex := clipHistory.MaxIndex()+1
        newIndex := 1
    If (newIndex &gt; 4)
        clipHistory.Remove(1), newIndex--
    clipHistory.Insert(newIndex, Clipboard)
    Return
}

ExitSub:
    DllCall(&quot;RemoveClipboardFormatListener&quot;, &quot;Int&quot;, A_ScriptHwnd)
    ExitApp
Return</code></pre></div><p>Вышеприведенный код работоспособен и используется, пример ниже — для затравки <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>#SingleInstance Ignore
#KeyHistory 0
#NoEnv
OnExit, ExitSub
DllCall(&quot;AddClipboardFormatListener&quot;, &quot;Int&quot;, A_ScriptHwnd)
OnMessage(0x031D, &quot;ClipSave&quot;)
OnMessage(0x404, &quot;TrayIconClick&quot;)

maxLines := 10
clipHistory := []
Return

ShowClip:
    If (Row := clipHistory.MaxIndex()) {
        Gui, +AlwaysOnTop +LastFound -Caption +Toolwindow -Resize
        Gui, Font, s8, Verdana
        Gui, Margin, 0, 0
        Gui, Add, ListView, +AltSubmit -Hdr -Multi gLV_Event R%Row%, Clip
        For index, clip in clipHistory
            LV_Add(&quot;&quot;, clip)
        Gui, Show, AutoSize
    }
Return

LV_Event:
    If (A_GuiEvent = &quot;Normal&quot;) {
        Clipboard := clipHistory[Index := A_EventInfo]
        Gui, Destroy
    } Else If (A_GuiEvent == &quot;f&quot;) {
        Gui, Destroy
    }
Return

ExitSub:
    DllCall(&quot;RemoveClipboardFormatListener&quot;, &quot;Int&quot;, A_ScriptHwnd)
    ExitApp
Return

ClipSave()
{
    global
    If (clipHistory[Index] = Clipboard)
        Return
    If !newIndex := clipHistory.MaxIndex()+1
        newIndex := 1
    If (newIndex &gt; maxLines)
        clipHistory.Remove(1), newIndex--
    clipHistory.Insert(newIndex, Clipboard)
    Return
}

TrayIconClick(wParam, lParam)
{
    If (lParam = 0x202) {
        SetTimer, ShowClip, -1
        Return
    }
    If (lParam = 0x207) {
        SetTimer, ExitSub, -1
        Return
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-01-22T09:41:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=55886#p55886</id>
		</entry>
</feed>
