AutoHotkey Community

It is currently May 27th, 2012, 12:32 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Rocker gestures
PostPosted: June 21st, 2005, 9:08 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 21st, 2005, 10:02 am 
Offline

Joined: June 6th, 2005, 11:35 pm
Posts: 179
Location: Northern Virginia
A IfWinActive, Windows Explorer command may help... iono would it?

_________________
_AiK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 21st, 2005, 10:52 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 21st, 2005, 12:10 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2005, 7:44 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2005, 9:34 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2005, 5:35 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 24th, 2005, 4:13 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: This rocks!
PostPosted: June 27th, 2005, 4:34 pm 
For now I got the ultimate answer, which really rocks :D

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.


Report this post
Top
  
Reply with quote  
 Post subject: Re: This rocks!
PostPosted: June 27th, 2005, 11:38 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2008, 4:37 am 
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}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2008, 3:15 am 
Offline

Joined: April 22nd, 2007, 11:52 am
Posts: 33
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2009, 5:30 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 25th, 2010, 2:50 pm 
Offline

Joined: March 29th, 2010, 11:27 pm
Posts: 9
Here is my solution for using both rocker gestures LButton-RButton and RBurron-LButton to close the current tab:

Code:
; ROCKER GESTURES FOR FIREFOX
~LButton & RButton::
SetTitleMatchMode, 2
IfWinActive, Mozilla Firefox
{
   Send ^{F4}
}
return

~RButton & LButton::
SetTitleMatchMode, 2
IfWinActive, Mozilla Firefox
{
   Send ^{F4}
   LButtonReleased := 0
   Loop 1000
   {
      GetKeyState, state, LButton, P
      if state = U
         LButtonReleased := 1
      else if state = D
      {
         if LButtonReleased = 1
         {
            Send ^{F4}
            LButtonReleased := 0
         }
      }
      GetKeyState, state, RButton, P
      if state = U
      {
         Send {ESC}
         return
      }
   Sleep, 10
   }
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 25th, 2010, 7:26 pm 
Offline

Joined: March 29th, 2010, 11:27 pm
Posts: 9
slight change to the script

Code:
; ROCKER GESTURES FOR FIREFOX
~LButton & RButton::
SetTitleMatchMode, 2
IfWinActive, Mozilla Firefox
{
   Send ^{F4}
}
return

~RButton & LButton::
SetTitleMatchMode, 2
IfWinActive, Mozilla Firefox
{
   Send ^{F4}
   LButtonReleased := 0
   Loop 400
   {
      GetKeyState, state, LButton, P
      if state = U
         LButtonReleased := 1
      else if state = D
      {
         if LButtonReleased = 1
         {
            Send ^{F4}
            LButtonReleased := 0
         }
      }
      GetKeyState, state, RButton, P
      if state = U
      {
         Sleep, 25
         Send {ESC}
         return
      }
   Sleep, 25
   }
}
return


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, Exabot [Bot], Google Feedfetcher, jrav and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group