| View previous topic :: View next topic |
| Author |
Message |
jak
Joined: 28 Feb 2006 Posts: 93
|
Posted: Tue Feb 28, 2006 9:02 am Post subject: Right mouse button added functionality- Doubleclick it! |
|
|
Hi everyone,
I created a simple but I think very functional little script. It allows you to add extra functionality to your RIGHT mouse button.
a) Double click with it to bring up the function of your choice. We all double click with the left button. why not with the right too? I used it to click a link to open it into a new IE window and minimize it.
b) Press and hold. Hold down your right mouse button for 1 sec for yet another function. I use it to open a new compose window in my email.
If you just click it once as usual, you get the right mouse menu as usual.
Here it is (edit as you like): Its part of my autohotkey.ini file.
| Code: | Rbutton::
;
;it gives you half a second to either complete the double click
;or to complete the press-and-hold cycle. If neither happens
;you get a normal single click response.
;
keywait, rbutton, t0.5
if errorlevel = 1
{
;
;This registers a 'press-n-hold' on the right mouse button.
;ADD YOUR FUNCTIONS HERE, for instance
;you could do a control-n to open a new IE window, as below
;
send, ^n
return
}
else
keywait, rbutton, d, t0.5
if errorlevel = 0
{
;
;this registers a 'double click' on the right mouse button.
;add your functions here, for instance I use it below
;to do a shift-left click which opens a link in its own window
;
send, +{lbutton}
return
}
else
;
;if neither of the above heppen, send a regular single click
;
mouseclick, right
return |
Thats it! Nice functionality that extends the usefulness of the mouse while surfing the web...
Jak |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Feb 28, 2006 11:32 am Post subject: |
|
|
Thank you for sharing.
PS.: you should use the CODE tags around your script. It will be easier to read, keeping the right indentations. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
AHKPNH
Joined: 17 Feb 2006 Posts: 35
|
Posted: Wed Mar 01, 2006 10:26 pm Post subject: |
|
|
Very Nice, thank you.....
I use it for (copy and paste)
By holding down right button, i copy.
By double clicking right button, i paste.
NICE!!!!  |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Thu Mar 02, 2006 1:41 am Post subject: |
|
|
| Unfortunately, even with perfect implementation, right press-and-hold interferes with the right-drag function, but as it is, even right-double-click prevents right-dragging, which was very useful, when creating shortcuts, zipping files, etc. |
|
| Back to top |
|
 |
shimanov
Joined: 25 Sep 2005 Posts: 612
|
Posted: Thu Mar 02, 2006 7:15 am Post subject: |
|
|
modes of operation:
* single-click detected when release occurs in less than 200 ms
* double-click detected when second press occurs in less than 200 ms
* drag detected when press and mouse coordinate differential occurs
* hold detected when press duration exceeds 300 ms
| Code: | RightButton?double_click@threshold = 200
RightButton?hold@threshold := RightButton?double_click@threshold+100
return
RButton::
if ( A_TickCount-RightButton?double_click@threshold < RightButton@mark ) ; double-click detected
{
SetTimer, timer_RightButton, off
MsgBox, right-button double-click detected
return
}
RightButton@mark := A_TickCount
MouseGetPos, m_x1, m_y1
SetTimer, timer_RightButton, 10
return
timer_RightButton:
if ( A_TickCount-RightButton@mark >= RightButton?hold@threshold ) ; hold detected
{
SetTimer, timer_RightButton, off
MsgBox, right-button hold detected
}
else if ( A_TickCount-RightButton@mark >= RightButton?double_click@threshold
and !GetKeyState( "RButton", "P" ) ) ; single-click detected
{
SetTimer, timer_RightButton, off
Send, {RButton}
}
else
{
MouseGetPos, m_x2, m_y2
if ( m_x1 "," m_y1 != m_x2 "," m_y2 ) ; drag detected
{
SetTimer, timer_RightButton, off
Send, {RButton down}
KeyWait, RButton
Send, {RButton up}
}
}
return |
|
|
| Back to top |
|
 |
kapege.de
Joined: 07 Feb 2005 Posts: 186 Location: Munich, Germany
|
Posted: Thu Mar 02, 2006 10:22 am Post subject: |
|
|
I know there's anywhere in the registry the doubleclick time. Does somebody knows where? It could replace the 200 ms.  _________________ Peter
Wisenheiming for beginners: KaPeGe (German only, sorry) |
|
| Back to top |
|
 |
shimanov
Joined: 25 Sep 2005 Posts: 612
|
Posted: Thu Mar 02, 2006 10:45 am Post subject: |
|
|
Try:
| Code: | | DllCall( "GetDoubleClickTime" ) |
|
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Mar 02, 2006 11:32 am Post subject: |
|
|
It is surprising it isn't in the SysGet list...
(Microsoft is to blame, not Chris! ) _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
MrB Guest
|
Posted: Thu Mar 02, 2006 11:36 am Post subject: |
|
|
Doesn't seem to work. Right clicking once frist time after reloading the script, a "right button hold" is detected. Afterwards, even if I click only once, a double click is detected. Same if I hold: a double click is detected.
If I change RightButton?double_click@threshold to 800, it doesnt change the behaviour. |
|
| Back to top |
|
 |
shimanov
Joined: 25 Sep 2005 Posts: 612
|
Posted: Thu Mar 02, 2006 4:45 pm Post subject: |
|
|
| MrB wrote: | | Right clicking once frist time after reloading the script, a "right button hold" is detected. Afterwards, even if I click only once, a double click is detected. Same if I hold: a double click is detected. |
I cannot reproduce this behavior.
What version of Windows and AHk are you using? |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Thu Mar 02, 2006 8:18 pm Post subject: |
|
|
If you only want to use double right-click, it is much simpler. I use the following script to pop up a menu with my personal data I have to enter often into fields on Web forms, but you can use it for anything else. It does not affect right-dragging. | Code: | ~RButton::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500) {
Sleep 200 ; wait for right-click menu, fine tune for your PC
Send {Esc} ; close it
MsgBox OK ; your double-right-click action here
}
Return |
|
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 03, 2006 5:49 pm Post subject: |
|
|
@shimanov
Windows XP SP2, AHK 1.0.42.03, specifically downloaded the latest version to try. No luck though. |
|
| Back to top |
|
 |
shimanov
Joined: 25 Sep 2005 Posts: 612
|
Posted: Fri Mar 03, 2006 10:12 pm Post subject: |
|
|
| Anonymous wrote: | @shimanov
Windows XP SP2, AHK 1.0.42.03, specifically downloaded the latest version to try. No luck though. |
Since I cannot reproduce the behavior you have described, it may be a system specific issue.
If you would like to continue our investigation, please register and send me a private message. Describe your experiments (in detail), and their outcomes. |
|
| Back to top |
|
 |
selioneru
Joined: 19 Feb 2006 Posts: 8
|
Posted: Fri Mar 10, 2006 1:08 am Post subject: Dear MrB |
|
|
| i had the same problem you had. Did you put the script in the ini file? if so try making the script run separate as a single script i hope it does the trick! |
|
| Back to top |
|
 |
jak
Joined: 28 Feb 2006 Posts: 93
|
Posted: Fri Mar 17, 2006 11:47 pm Post subject: wow |
|
|
wow, I didnt expect to see much of a response to this little script - Needless to say I'm very happy that some folks found it useful!
I thnk all mice should be shipping with right-click customization options built into the mouse's software!
AHKPNH: copy-paste - NICE!
Regarding LASZLO's note about interference with right-drag function; I never thought of that since I never use right-drag! I'm guessing most people dont use right-drag... But for those that do, SHIMANOV's script is pretty brilliant! I havent tried it but it looks fine to me... |
|
| Back to top |
|
 |
|