<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Как задать SendMessage при активности определенного окна?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10960&amp;type=atom" />
	<updated>2015-09-20T12:57:41Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10960</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97582#p97582" />
			<content type="html"><![CDATA[<p>Мозг перестает работать, даже если поменять местами правое и левое полушарие.<br />Как мне кажется, органы обособлены друг от друга, но выходит, что не так.</p><p><span style="color: grey">Если вы хотите размещать хоткеи в любом месте, оформите их в виде ф-ии: End::func(), либо в одну строку в вашем случае.</span></p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2015-09-20T12:57:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97582#p97582</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97571#p97571" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>нужно вставить в скрипт грамотно.</p></blockquote></div><p>Скрипт перестает работать, даже если перед ним есть только одна горячая клавиша для другого действия:<br /></p><div class="codebox"><pre><code>    SetTitleMatchMode 2
    DetectHiddenWindows On
    SendMode Input
    SetKeyDelay -1

END::
Reload
return

    { ; AutoSwitch Input Method
        #Persistent
    Global list := {&quot;AIMP3.exe&quot;:&quot;ru&quot;, &quot;SciTE.exe&quot;:&quot;en&quot;}

    SetWinEventHook(EVENT_SYSTEM_FOREGROUND := 0x0003, EVENT_SYSTEM_FOREGROUND, 0, RegisterCallback(&quot;HookProc&quot;, &quot;F&quot;), 0, 0, 0) 

    HookProc(hWinEventHook, event, hwnd)  { 
        WinGet, Process, ProcessName, ahk_id %hwnd%
        If (list.haskey(Process))  { 
            ControlGetFocus, CtrlFocus, ahk_id %hwnd%
            PostMessage, WM_INPUTLANGCHANGEREQUEST := 0x50, , {&quot;en&quot;:0x409,&quot;ru&quot;:0x419}[list[Process]], %CtrlFocus%, ahk_id %hwnd%
        } 
}

    SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)  {
       Return DllCall(&quot;SetWinEventHook&quot;, UInt, eventMin , UInt, eventMax , Ptr, hmodWinEventProc
                , Ptr, lpfnWinEventProc , UInt, idProcess , UInt, idThread, UInt, dwFlags, Ptr)
    }
    }
    { ~^+C:: ; Google Search
        SendMessage, 0x50, , 0x4090409, , A
        IfWinNotActive, Vegas Pro 13.0
            {
                SendInput, ^c
                Sleep 50
                Run, http://www.google.com/search?q=%clipboard%
            }
        return
    }</code></pre></div><p>Как мне кажется, действия обособлены друг от друга, но выходит, что не так.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-09-19T06:37:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97571#p97571</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97558#p97558" />
			<content type="html"><![CDATA[<p>Проще, чем там, варианта нет, просто нужно вставить в скрипт грамотно, так, чтобы первая часть кода (создание массива и вызов функции) выполнилась, т. е. до первого <em>Return</em>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-09-18T14:24:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97558#p97558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97557#p97557" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, т.е. вариант, указанный в первом посте не должен работать ни при каких условиях, кроме как по нажатию заданной горячей клавиши?</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-09-18T14:23:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97557#p97557</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97554#p97554" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, да, но он у меня работает лишь после запуска отдельным файлом. А по сути, мне эта функция нужна прежде всего для одной программы, поэтому, хотел бы осуществить ее в уже существующем скрипте простым SendMessage, который отлично срабатывает по горячей клавише, а вот по активации целевого окна, почему-то не срабатывает.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-09-18T14:01:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97554#p97554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97553#p97553" />
			<content type="html"><![CDATA[<p>Так <a href="http://forum.script-coding.com/viewtopic.php?pid=97285#p97285">здесь</a> же ответили, вроде?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-09-18T13:55:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97553#p97553</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97552#p97552" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
    SetTitleMatchMode 2
    DetectHiddenWindows On
    SendMode Input
    SetKeyDelay -1

   #IfWinActive, ahk_exe skype.exe
        Loop
            {
                SendMessage, 0x50, , 0x4090409, , A
            }
   return
</code></pre></div><p>Не знаю, все ли правильно, но такой вариант у меня, к сожалению, не сработал.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-09-18T12:53:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97552#p97552</id>
		</entry>
</feed>
