AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rocker gestures

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
dantown
Guest





PostPosted: Tue Jun 21, 2005 8:08 am    Post subject: Rocker gestures Reply with quote

Hallo,

holding the left mouse button and clicking the right one and vice versa is called a rocker gesture. It's available in Maxthon and other browsers. I'd like to implement this in Windows Explorer. Unfortunately,
Code:
RButton & LButton::send !{left}
LButton & RButton::send !{right}
does work but hinders any single left/right click system-wide. What have I done wrong?

Daniel
Back to top
AiKscroll



Joined: 06 Jun 2005
Posts: 179
Location: Northern Virginia

PostPosted: Tue Jun 21, 2005 9:02 am    Post subject: Reply with quote

A IfWinActive, Windows Explorer command may help... iono would it?
_________________
_AiK
Back to top
View user's profile Send private message AIM Address
dantown
Guest





PostPosted: Tue Jun 21, 2005 9:52 am    Post subject: Reply with quote

True, I'll have to check if Windows Explorer has focus. Nevertheless, even in Explorer I can't select anything with a left or right click.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10667

PostPosted: Tue Jun 21, 2005 11:10 am    Post subject: Reply with quote

Try adding a tilde in front of each hotkey. That allows the first button to pass through to the system normally:

~RButton & LButton::send !{left}
~LButton & RButton::send !{right}

The second one might still fail to work because most apps refuse to accept keystrokes while the left mouse button is down (or perhaps this is a built-in behavior for the entire system).

If that is the case, try:
~LButton & RButton::send {LButton Up}!{right}

If that doesn't work, try accomplishing the second hotkey's action via MouseClick, ControlClick, or WinMenuSelectItem.
Back to top
View user's profile Send private message Send e-mail
dantown
Guest





PostPosted: Wed Jun 22, 2005 6:44 am    Post subject: Reply with quote

Thanks Chris, your last tip was amazing and works with both mouse click combinations. One problem persists:
Code:
~RButton & LButton::send {RButton Up}!{left}
opens the context menu. Any way to avoid this?
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10667

PostPosted: Wed Jun 22, 2005 8:34 pm    Post subject: Reply with quote

The following seems to work:
Code:
~RButton & LButton::
Send !{left}
KeyWait, RButton  ; Wait for physical release because that is often what shows the menu.
WinWait, ahk_class #32768, , 1  ; Menu's "window" (never active, but it does exist).
if not ErrorLevel  ; Menu found.
   Send {Escape}
return

Maybe there is some other solution involving sending the WM_CANCELMODE to dismiss the menu, but that is a long shot and would take some research.
Back to top
View user's profile Send private message Send e-mail
dantown
Guest





PostPosted: Thu Jun 23, 2005 4:35 pm    Post subject: Reply with quote

Thank you! That works except that I have to move "Send !{left}" right before "return".

It's a shame that the context menu is popping up though. The problem is that the right click is passed on to the system. Another problem is that your code waits until the right mouse button is released which is not the case with the other rocker gesture.

I'm thinking of a routine that takes care of the right click alltogether.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10667

PostPosted: Fri Jun 24, 2005 3:13 am    Post subject: Reply with quote

dantown wrote:
The problem is that the right click is passed on to the system.
I think this could be avoided by removing the tilde prefix from RButton and adding the following additional hotkey:

RButton::MouseClick, right,,,,, U ; Use MouseClick vs. Send to avoid disruption of Ctrl/Alt/Shift keys.

However, the above would prevent right-click-drag from working and might have other side effects.

Quote:
Another problem is that your code waits until the right mouse button is released which is not the case with the other rocker gesture.
Some apps, such as Explorer, display the context menu only upon release of the right mouse button. That's why the KeyWait is in there.
Back to top
View user's profile Send private message Send e-mail
dantown
Guest





PostPosted: Mon Jun 27, 2005 3:34 pm    Post subject: This rocks! Reply with quote

For now I got the ultimate answer, which really rocks Very Happy

In AutoHotkey, define
Code:
~LButton & RButton::send {LButton Up}!{right}


In StrokeIt (http://www.tcbmi.com/strokeit/), add under [Global actions] the command "Back [Rocker right-left]" with the gesture "LBUTTON_DOWN" and hotkey "ALT + LEFT".

This gives you perfect forward/backward rocking featuring right-click dragging without the context menu bug.

Chris, you're doing a wonderful job, but I ask myself why it takes StrokeIt for the right-left click rocker gesture to work perfectly.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10667

PostPosted: Mon Jun 27, 2005 10:38 pm    Post subject: Re: This rocks! Reply with quote

dantown wrote:
...but I ask myself why it takes StrokeIt for the right-left click rocker gesture to work perfectly.
Since mouse buttons already have so many functions, getting them to do more -- especially in combination with other mouse buttons -- is often tricky business. I'm glad you found a solution.
Back to top
View user's profile Send private message Send e-mail
stevo54321
Guest





PostPosted: Mon May 26, 2008 3:37 am    Post subject: Reply with quote

Instead of using the right button i just opted to use the scroll wheel. it's a little more annoying to press, but you don't get the context menu at all... a trade off i guess.

~LButton & MButton::send {LButton Up}!{right}
~MButton & LButton::send {MButton Up}!{left}
Back to top
helpme



Joined: 22 Apr 2007
Posts: 33

PostPosted: Tue Jun 10, 2008 2:15 am    Post subject: Reply with quote

I think I have found one way to get rid of the context windows.

Try the following;
Code:
   
~RButton & LButton::
{
   ;send {RButton Up}!{left}
   SendInput !{Right} ;Alt-right (browse forward)
   Sleep 200 ;delay 200ms      
   SendInput {Escape}
   return
}


The code will send the {Escape} key to remove the context window after waiting for 200ms.

I am feeling rather guilty as I have only been asking questions and benefiting from the Gurus here like a parasite without making useful contributions to this forum.

Hope this post will be of use to fellow AutoHotkey users.
Back to top
View user's profile Send private message
chrisb24
Guest





PostPosted: Sat Jun 06, 2009 4:30 pm    Post subject: Reply with quote

Heres the code to make forward and back not interfering with Firefox mouse gesture for same buttons stroke

Code:
~RButton & ~LButton::

IfWinActive, ahk_class  CabinetWClass
{

   ;send {RButton Up}!{left}
   SendInput !{Left} ;Alt-right (browse forward)
   Sleep 200 ;delay 200ms     
   SendInput {Escape}
   return
}

return

~LButton & ~RButton::
IfWinActive, ahk_class  CabinetWClass
{

   ;send {RButton Up}!{left}
   SendInput !{Right} ;Alt-right (browse forward)
   Sleep 200 ;delay 200ms     
   SendInput {Escape}
   return
}
Return
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group