<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Команда ControlClick]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5063&amp;type=atom" />
	<updated>2016-02-19T02:59:26Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5063</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101220#p101220" />
			<content type="html"><![CDATA[<p>Ну, раз с ними глючит, значит правильнее без них. Именно для работы этого скрипта в нужных программах, а не вообще.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-02-19T02:59:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101220#p101220</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101219#p101219" />
			<content type="html"><![CDATA[<p>Код из 2 поста у меня работает в блокноте и при закомментированных:<br /></p><div class="codebox"><pre><code>; PostMessage, 0x201, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONDOWN 
; PostMessage, 0x202, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONUP </code></pre></div><p>Если же их раскомментировать и использовать в Adobe Premiere, то посылается иногда 3 клика вместо 2.<br />Может быть двойной клик правильней посылать без WM_LBUTTONDOWN WM_LBUTTONUP?<br />Хотя майкрософт пишет:<br /></p><div class="quotebox"><blockquote><p>Double-clicking the left mouse button actually generates a sequence of four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-02-19T00:51:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101219#p101219</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40665#p40665" />
			<content type="html"><![CDATA[<p>Так вот как надо... Попробовал, заработало, спасибо:). А можно ли заставить эту команду работать не по координатам, а как-то иначе?:) Как-нибудь заставить находить место ссылки по тексту на ней?</p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-21T07:51:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40665#p40665</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40658#p40658" />
			<content type="html"><![CDATA[<p>Тот код из 2 поста остается неизменным, а ту строку, что дал YMP в посте #5 написать перед всем этим кодом из поста #2.<br />Я попробовал, но у меня почему-то не делает двойной клик, точнее не кликает вообще.</p>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2010-10-20T19:54:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40658#p40658</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40657#p40657" />
			<content type="html"><![CDATA[<p>Ах, нет.:(<br />Тогда получается код будет такой:<br /></p><div class="codebox"><pre><code>ControlClick2(57, 115, &quot;Список GSM в ремонте - Windows Internet Explorer&quot;)
{ 
  hwnd:=ControlFromPoint(X, Y, WinTitle, WinText, cX, cY 
                             , ExcludeTitle, ExcludeText) 
  PostMessage, 0x201, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONDOWN 
  PostMessage, 0x202, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONUP 
  PostMessage, 0x203, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONDBLCLCK 
  PostMessage, 0x202, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONUP 
} 

; Retrieves the control at the specified point. 
; X         [in]    X-coordinate relative to the top-left of the window. 
; Y         [in]    Y-coordinate relative to the top-left of the window. 
; WinTitle  [in]    Title of the window whose controls will be searched. 
; WinText   [in] 
; cX        [out]   X-coordinate relative to the top-left of the control. 
; cY        [out]   Y-coordinate relative to the top-left of the control. 
; ExcludeTitle [in] 
; ExcludeText  [in] 
; Return Value:     The hwnd of the control if found, otherwise the hwnd of the window. 
ControlFromPoint(X, Y, WinTitle=&quot;&quot;, WinText=&quot;&quot;, ByRef cX=&quot;&quot;, ByRef cY=&quot;&quot;, ExcludeTitle=&quot;&quot;, ExcludeText=&quot;&quot;) 
{ 
    static EnumChildFindPointProc=0 
    if !EnumChildFindPointProc 
        EnumChildFindPointProc := RegisterCallback(&quot;EnumChildFindPoint&quot;,&quot;Fast&quot;) 
    
    if !(target_window := WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText)) 
        return false 
    
    VarSetCapacity(rect, 16) 
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,target_window,&quot;uint&quot;,&amp;rect) 
    VarSetCapacity(pah, 36, 0) 
    NumPut(X + NumGet(rect,0,&quot;int&quot;), pah,0,&quot;int&quot;) 
    NumPut(Y + NumGet(rect,4,&quot;int&quot;), pah,4,&quot;int&quot;) 
    DllCall(&quot;EnumChildWindows&quot;,&quot;uint&quot;,target_window,&quot;uint&quot;,EnumChildFindPointProc,&quot;uint&quot;,&amp;pah) 
    control_window := NumGet(pah,24) ? NumGet(pah,24) : target_window 
    DllCall(&quot;ScreenToClient&quot;,&quot;uint&quot;,control_window,&quot;uint&quot;,&amp;pah) 
    cX:=NumGet(pah,0,&quot;int&quot;), cY:=NumGet(pah,4,&quot;int&quot;) 
    return control_window 
} 

; Ported from AutoHotkey::script2.cpp::EnumChildFindPoint() 
EnumChildFindPoint(aWnd, lParam) 
{ 
    if !DllCall(&quot;IsWindowVisible&quot;,&quot;uint&quot;,aWnd) 
        return true 
    VarSetCapacity(rect, 16) 
    if !DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,aWnd,&quot;uint&quot;,&amp;rect) 
        return true 
    pt_x:=NumGet(lParam+0,0,&quot;int&quot;), pt_y:=NumGet(lParam+0,4,&quot;int&quot;) 
    rect_left:=NumGet(rect,0,&quot;int&quot;), rect_right:=NumGet(rect,8,&quot;int&quot;) 
    rect_top:=NumGet(rect,4,&quot;int&quot;), rect_bottom:=NumGet(rect,12,&quot;int&quot;) 
    if (pt_x &gt;= rect_left &amp;&amp; pt_x &lt;= rect_right &amp;&amp; pt_y &gt;= rect_top &amp;&amp; pt_y &lt;= rect_bottom) 
    { 
        center_x := rect_left + (rect_right - rect_left) / 2 
        center_y := rect_top + (rect_bottom - rect_top) / 2 
        distance := Sqrt((pt_x-center_x)**2 + (pt_y-center_y)**2) 
        update_it := !NumGet(lParam+24) 
        if (!update_it) 
        { 
            rect_found_left:=NumGet(lParam+8,0,&quot;int&quot;), rect_found_right:=NumGet(lParam+8,8,&quot;int&quot;) 
            rect_found_top:=NumGet(lParam+8,4,&quot;int&quot;), rect_found_bottom:=NumGet(lParam+8,12,&quot;int&quot;) 
            if (rect_left &gt;= rect_found_left &amp;&amp; rect_right &lt;= rect_found_right 
                &amp;&amp; rect_top &gt;= rect_found_top &amp;&amp; rect_bottom &lt;= rect_found_bottom) 
                update_it := true 
            else if (distance &lt; NumGet(lParam+28,0,&quot;double&quot;) 
                &amp;&amp; (rect_found_left &lt; rect_left || rect_found_right &gt; rect_right 
                 || rect_found_top &lt; rect_top || rect_found_bottom &gt; rect_bottom)) 
                 update_it := true 
        } 
        if (update_it) 
        { 
            NumPut(aWnd, lParam+24) 
            DllCall(&quot;RtlMoveMemory&quot;,&quot;uint&quot;,lParam+8,&quot;uint&quot;,&amp;rect,&quot;uint&quot;,16) 
            NumPut(distance, lParam+28, 0, &quot;double&quot;) 
        } 
    } 
    return true 
}</code></pre></div><p>Но тогда ошибка уже такая:<br /><span class="postimg"><img src="http://i016.radikal.ru/1010/69/5ba007748960.jpg" alt="http://i016.radikal.ru/1010/69/5ba007748960.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-20T19:42:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40657#p40657</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40654#p40654" />
			<content type="html"><![CDATA[<p>А сами функции в скрипт вставил? Те, что в посте <a href="http://forum.script-coding.com/viewtopic.php?pid=40635#p40635">#2</a>.</p>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2010-10-20T19:20:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40654#p40654</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40652#p40652" />
			<content type="html"><![CDATA[<p>Извините, AHK выдаёт.<br /><span class="postimg"><img src="http://s58.radikal.ru/i162/1010/62/e37d14fb286f.png" alt="http://s58.radikal.ru/i162/1010/62/e37d14fb286f.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-20T18:40:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40652#p40652</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40651#p40651" />
			<content type="html"><![CDATA[<p>Кто выдаёт и какую ошибку? Я же не телепат всё-таки.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2010-10-20T18:30:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40651#p40651</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40650#p40650" />
			<content type="html"><![CDATA[<p>Как я понимаю, для клика по координатам 100, 215 в браузере на определённой страничке надо делать так:<br /></p><div class="codebox"><pre><code>ControlClick2(57, 115, &quot;Страничка - Windows Internet Explorer&quot;)</code></pre></div><p>Вот только почему-то выдаёт ошибку:(.</p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-20T18:18:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40650#p40650</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40645#p40645" />
			<content type="html"><![CDATA[<p>Вызвать функцию ControlClick2, указав нужные Вам координаты и целевое окно. Координаты относительно этого окна.<br /></p><div class="codebox"><pre><code>ControlClick2(57, 115, &quot;ahk_class Notepad&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2010-10-20T17:58:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40645#p40645</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40639#p40639" />
			<content type="html"><![CDATA[<p>Нужно просто открыть эту ссылку, при условии, что она открывается только двойным щелчком.<br />InFlames, не открывается.:|<br />To YMP, не совсем понял, как это применять?:)</p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-20T16:48:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40639#p40639</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40637#p40637" />
			<content type="html"><![CDATA[<p>А после выделения ссылки если нажать Ентер, она не открывается?</p>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2010-10-20T16:18:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40637#p40637</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40635#p40635" />
			<content type="html"><![CDATA[<p>Не совсем понял. Если нужен двойной щелчок (а не два отдельных), то ControlClick его не умеет делать. Вот тут это обсуждалось: <a href="http://www.autohotkey.com/forum/topic16826.html">ControlClick fails to perform a double click in the Pos mode</a>. Там же был найден обходной путь, оформленный в виде функции ControlClick2, производящей двойной щелчок по координатам. Две функции под ней тоже нужны, она их использует.<br /></p><div class="codebox"><pre><code>ControlClick2(X, Y, WinTitle=&quot;&quot;, WinText=&quot;&quot;, ExcludeTitle=&quot;&quot;, ExcludeText=&quot;&quot;) 
{ 
  hwnd:=ControlFromPoint(X, Y, WinTitle, WinText, cX, cY 
                             , ExcludeTitle, ExcludeText) 
  PostMessage, 0x201, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONDOWN 
  PostMessage, 0x202, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONUP 
  PostMessage, 0x203, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONDBLCLCK 
  PostMessage, 0x202, 0, cX&amp;0xFFFF | cY&lt;&lt;16,, ahk_id %hwnd% ; WM_LBUTTONUP 
} 

; Retrieves the control at the specified point. 
; X         [in]    X-coordinate relative to the top-left of the window. 
; Y         [in]    Y-coordinate relative to the top-left of the window. 
; WinTitle  [in]    Title of the window whose controls will be searched. 
; WinText   [in] 
; cX        [out]   X-coordinate relative to the top-left of the control. 
; cY        [out]   Y-coordinate relative to the top-left of the control. 
; ExcludeTitle [in] 
; ExcludeText  [in] 
; Return Value:     The hwnd of the control if found, otherwise the hwnd of the window. 
ControlFromPoint(X, Y, WinTitle=&quot;&quot;, WinText=&quot;&quot;, ByRef cX=&quot;&quot;, ByRef cY=&quot;&quot;, ExcludeTitle=&quot;&quot;, ExcludeText=&quot;&quot;) 
{ 
    static EnumChildFindPointProc=0 
    if !EnumChildFindPointProc 
        EnumChildFindPointProc := RegisterCallback(&quot;EnumChildFindPoint&quot;,&quot;Fast&quot;) 
    
    if !(target_window := WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText)) 
        return false 
    
    VarSetCapacity(rect, 16) 
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,target_window,&quot;uint&quot;,&amp;rect) 
    VarSetCapacity(pah, 36, 0) 
    NumPut(X + NumGet(rect,0,&quot;int&quot;), pah,0,&quot;int&quot;) 
    NumPut(Y + NumGet(rect,4,&quot;int&quot;), pah,4,&quot;int&quot;) 
    DllCall(&quot;EnumChildWindows&quot;,&quot;uint&quot;,target_window,&quot;uint&quot;,EnumChildFindPointProc,&quot;uint&quot;,&amp;pah) 
    control_window := NumGet(pah,24) ? NumGet(pah,24) : target_window 
    DllCall(&quot;ScreenToClient&quot;,&quot;uint&quot;,control_window,&quot;uint&quot;,&amp;pah) 
    cX:=NumGet(pah,0,&quot;int&quot;), cY:=NumGet(pah,4,&quot;int&quot;) 
    return control_window 
} 

; Ported from AutoHotkey::script2.cpp::EnumChildFindPoint() 
EnumChildFindPoint(aWnd, lParam) 
{ 
    if !DllCall(&quot;IsWindowVisible&quot;,&quot;uint&quot;,aWnd) 
        return true 
    VarSetCapacity(rect, 16) 
    if !DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,aWnd,&quot;uint&quot;,&amp;rect) 
        return true 
    pt_x:=NumGet(lParam+0,0,&quot;int&quot;), pt_y:=NumGet(lParam+0,4,&quot;int&quot;) 
    rect_left:=NumGet(rect,0,&quot;int&quot;), rect_right:=NumGet(rect,8,&quot;int&quot;) 
    rect_top:=NumGet(rect,4,&quot;int&quot;), rect_bottom:=NumGet(rect,12,&quot;int&quot;) 
    if (pt_x &gt;= rect_left &amp;&amp; pt_x &lt;= rect_right &amp;&amp; pt_y &gt;= rect_top &amp;&amp; pt_y &lt;= rect_bottom) 
    { 
        center_x := rect_left + (rect_right - rect_left) / 2 
        center_y := rect_top + (rect_bottom - rect_top) / 2 
        distance := Sqrt((pt_x-center_x)**2 + (pt_y-center_y)**2) 
        update_it := !NumGet(lParam+24) 
        if (!update_it) 
        { 
            rect_found_left:=NumGet(lParam+8,0,&quot;int&quot;), rect_found_right:=NumGet(lParam+8,8,&quot;int&quot;) 
            rect_found_top:=NumGet(lParam+8,4,&quot;int&quot;), rect_found_bottom:=NumGet(lParam+8,12,&quot;int&quot;) 
            if (rect_left &gt;= rect_found_left &amp;&amp; rect_right &lt;= rect_found_right 
                &amp;&amp; rect_top &gt;= rect_found_top &amp;&amp; rect_bottom &lt;= rect_found_bottom) 
                update_it := true 
            else if (distance &lt; NumGet(lParam+28,0,&quot;double&quot;) 
                &amp;&amp; (rect_found_left &lt; rect_left || rect_found_right &gt; rect_right 
                 || rect_found_top &lt; rect_top || rect_found_bottom &gt; rect_bottom)) 
                 update_it := true 
        } 
        if (update_it) 
        { 
            NumPut(aWnd, lParam+24) 
            DllCall(&quot;RtlMoveMemory&quot;,&quot;uint&quot;,lParam+8,&quot;uint&quot;,&amp;rect,&quot;uint&quot;,16) 
            NumPut(distance, lParam+28, 0, &quot;double&quot;) 
        } 
    } 
    return true 
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2010-10-20T16:06:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40635#p40635</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Команда ControlClick]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=40633#p40633" />
			<content type="html"><![CDATA[<p>Возникла проблема с командой ControlClick. При отправке 2ух кликов в Интернет эксплорер командой, происходит только выделение ссылки(1). Как сделать так, что бы при посылке кликов открывалась ссылка, а не просто выделялась?(При ручном нажатии на ссылку-она открывается в новом окне)<br />Скриншот прилагается:<br /><span class="postimg"><img src="http://s49.radikal.ru/i125/1010/82/1fe5f307a2fe.jpg" alt="http://s49.radikal.ru/i125/1010/82/1fe5f307a2fe.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[Skare]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26172</uri>
			</author>
			<updated>2010-10-20T15:00:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=40633#p40633</id>
		</entry>
</feed>
