 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
theclicker Guest
|
Posted: Sat Jun 03, 2006 2:17 am Post subject: Count a doubleclick |
|
|
Program:
If double left click on mouse:
do this:
Messed upcode: I'm trying to get a handle on this so i know its wrong , but tested it if lbuttondown is under 1 and it out puts the sendplay.
#z::
Loop
{
LButtonDown := GetKeyState("LButton","P")
if LButtonDown > 1
sendplay hi
return
} |
|
| Back to top |
|
 |
Moderator!
Joined: 24 May 2006 Posts: 25
|
Posted: Sat Jun 03, 2006 6:55 am Post subject: |
|
|
following code will detect a double-click:
| Code: | ~LButton::
Loop {
LButtonDown := GetKeyState("LButton","P")
If (!LButtonDown)
Break
}
WaitTime:=DllCall("GetDoubleClickTime")/1000
KeyWait, LButton, D T%WaitTime%
If errorlevel=0
GoSub, Routine
Return
Routine:
Tooltip, Double click detected!,,,20
Sleep 1000
Tooltip,,,,20
Return |
Last edited by Moderator! on Mon Jun 05, 2006 10:10 pm; edited 1 time in total |
|
| Back to top |
|
 |
TheClicker Guest
|
Posted: Sun Jun 04, 2006 8:43 am Post subject: Ty sir |
|
|
While searching through forums I as able to get this which is what i wanted but your code is actually cleaner, i like the keywait function better then timer even though they do same thing, ^^ Ty again!
| Code: | ~LButton::
if counter >= 0
{
counter++
return
}
counter = 0
setTimer,keywait, 250
return
keywait:
setTimer,keywait,off
if counter = 1 ;
{
sendplay {F1}
}
counter = -1
return |
|
|
| Back to top |
|
 |
Moderator!
Joined: 24 May 2006 Posts: 25
|
Posted: Mon Jun 05, 2006 10:12 pm Post subject: Re: Ty sir |
|
|
| TheClicker wrote: | | your code is actually cleaner, i like the keywait function better then timer even though they do same thing, ^^ Ty again! |
thanks
i've updated the code
take a look _________________
 |
|
| Back to top |
|
 |
unsmart3d
Joined: 21 Mar 2006 Posts: 5 Location: Lexington, KY
|
Posted: Thu Oct 12, 2006 7:28 pm Post subject: Count a doubleclick |
|
|
I really like this code! I was wondering how I could implement this into a GUI I am creating. I am using double-clicks (and would rather use triple-clicks) to highlight information in a web browser. I think I want a progress box message to pop up after the designated button is pressed and give the go-to for a double click. Once the double click takes place, the GUI can send a CTRL + C to copy the highlighted text and use a GUIControl to change the edit box to that current information. Then the progress changes to the next field that needs to be copied and the same steps repeated. Is this something possible?
Please provide feedback!
Thanks,
~Jeff
"The trouble with jogging is that, by the time you realize you're not in shape for it, it's too far to walk back." |
|
| Back to top |
|
 |
TOTAL
Joined: 26 Sep 2007 Posts: 43
|
Posted: Sat Mar 29, 2008 12:51 am Post subject: |
|
|
hi
The code works great, but how to make double click "natural" function in a program to get replaced REPLACED by a function of your choice?
Thanks
T |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 553 Location: MN, USA
|
|
| Back to top |
|
 |
TOTAL
Joined: 26 Sep 2007 Posts: 43
|
Posted: Sat Mar 29, 2008 2:33 am Post subject: |
|
|
Thanks Jaco
I have adapted the code.
| Code: | LButton::
if counter >= 0
{
counter++
return
}
counter = 0
setTimer,keywait, 250
return
keywait:
setTimer,keywait,off
if counter = 1 ;
{
MouseClick, left, 141, 40
Sleep, 100
Send, {DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{RIGHT}{ENTER}
return
}
counter = -1
send {LButton}
return
|
the string of commands triggered by doubleclick works properly. I have also made single click function normally. The code is placed in a conditional, so that it gets triggered only in the prog I want.
All works until the first doubleclick, that is, first single clicks work normally, first double works properly and since then neither single click nor double click work anymore, until restarting the .ahk file.
right click, not covered by the cript work ok, though.
What culd be the reason? |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 553 Location: MN, USA
|
Posted: Sat Mar 29, 2008 2:58 pm Post subject: |
|
|
Personally, I think both of the scripts at the beginning of this topic are poor. I would use the method Lexikos shows in the thread I linked to before. _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
TOTAL
Joined: 26 Sep 2007 Posts: 43
|
Posted: Sat Mar 29, 2008 9:45 pm Post subject: |
|
|
Here we go. I have adapted Lexicos's code for mouse click
| Code: | ~LButton::
KeyWait, LButton ; wait for click to be released
KeyWait, LButton, D T0.2 ; and pressed again within 0.2 seconds
if ErrorLevel ; timed-out (only a single press)
return
else
sleep 10000
MouseClick, left, 141, 40
Sleep, 100
Send, {DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{RIGHT}{ENTER}
return |
the long pause is there to prove if the condition is met. It is, but the double click does not get bypassed, which I expected from using ~ symbol.
With ctrl insteaf, all works fine, but I insist upon click because in the programs double click triggers a function which disturbs a lot. |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 553 Location: MN, USA
|
Posted: Sat Mar 29, 2008 11:54 pm Post subject: |
|
|
| TOTAL wrote: | | the double click does not get bypassed, which I expected from using ~ symbol. |
You can read about the ~ modifier on the Hotkeys page. Recall that I previously advised you to remove it. _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|