Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ControlClick fails to perform a double click in the Pos mode


  • Please log in to reply
21 replies to this topic
engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
ControlClick2 is a function (as posted above). You need to add the function to your script, then call it just like any other function.

[code=auto:0]
ControlClick2(parameter, parameter, parameter....)
[code=auto:0]

YMP
  • Members
  • 424 posts
  • Last active: Apr 05 2012 01:18 AM
  • Joined: 23 Dec 2006
Lexikos, what do you think about adding a double-click option to ControlClick? For example, "2" for two single clicks and "-2" for a double click? Sometimes people ask for it.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
I think the default behaviour should be changed to resemble what actually happens when a user clicks repeatedly, but there's a small chance it could break something so I'll probably implement your idea.

Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates a sequence of four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP.
Source: WM_LBUTTONDBLCLK Message



Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Thanks a lot Lexikos for this function, I used it a lot this year.
I really want this function in ahk build :) and a ControlMove too

or maybe more generic:
ControlMouse, messageorfeature, X, Y, WinTitle, WinText, ExcludeTitle, ExcludeText

an example for that work in a flash apps with IE9 (free mouse for user but need a non-minimized window , so at background)
ControlClick2(X, Y, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="") 
{ 
  hwnd:=ControlFromPoint(X, Y, WinTitle, WinText, cX, cY 
                             , ExcludeTitle, ExcludeText)
  PostMessage, 0x200, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd%
sleep 100 ; need a delay for a flash menu , and a double mouse move message (maybe that need a compare)
  PostMessage, 0x200, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd%
  PostMessage, 0x201, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd%
  PostMessage, 0x202, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd%
}

edit: about double click user can always do a click*2 for compatibility...
at middle of this doc
<!-- m -->http://msdn.microsof...y/ms645601.aspx<!-- m -->
"You annoy me, therefore I exist."

Elbard
  • Members
  • 13 posts
  • Last active: Jan 22 2016 11:23 AM
  • Joined: 28 May 2013

Really thank you for the functions!



T_Lube
  • Members
  • 640 posts
  • Last active: Sep 09 2016 02:19 AM
  • Joined: 16 Oct 2014

you asking for a simple answer when you just need to look at the format of a function in AHK. Simply "ControlClick2(X, Y, Title)". Copy paste the script above at the top of your script or in what ever #include file you are using. This is actually quite brilliant and makes things a lot easier for newbies. You just need to understand a function to use it without understanding all the amazing code underlying it.



Goblinman
  • Members
  • 1 posts
  • Last active: May 07 2015 06:39 PM
  • Joined: 05 Feb 2015

you asking for a simple answer when you just need to look at the format of a function in AHK. Simply "ControlClick2(X, Y, Title)". Copy paste the script above at the top of your script or in what ever #include file you are using. This is actually quite brilliant and makes things a lot easier for newbies. You just need to understand a function to use it without understanding all the amazing code underlying it.

 

The question I have is the X,Y you pass through to the ControlClick2(X,Y,Title) is that in the same format as in the orginal ControlClick, i.e x856 y315 Title, or would it just be the numbers of the cordinates, i.e 856 315 Title.