Home
Download
Screenshots

Wiki
Plugins
Translations
Developers
Donate

Forums/Help
Contact Us

StrokeIt

Is it possible to execute action by pressing left then right mouse button?

Posted by Serge 
It works perfectly when you first press the right mouse button and while holding it, press the left. But is it possible to do it the other way around?
Re: Is it possible to execute action by pressing left then right mouse button?
October 28, 2011 02:52AM
Hi Serge!

Not yet and I don't know if it'll ever be. But you can achieve the same effect using AutoHotkey. If you describe your goal we can help you create the script.
All right, thank you for the hint. I'll try to do it with ahk.
I tried and failed :)
I want to close the Explorer windows with left-right mouse click.

This script works but disables the left button completely, as soon as Explorer is active (naturally)

#IfWinActive ahk_class CabinetWClass
LButton & RButton::Send !{F4}

but weirdly enough this script

#IfWinActive ahk_class CabinetWClass
~LButton & RButton::Send !{F4}

closes the Explorer window only if I double-click left then single-click right.
This should work:
#IfWinActive ahk_class CabinetWClass 
~LButton & RButton::PostMessage, 0x10
Sending messages is often more reliable than sending hotkeys, 0x10 is the message WM_CLOSE.
Re: Is it possible to execute action by pressing left then right mouse button?
November 02, 2011 03:07AM
Or use a more "elegant" approach :P This on below should close the active window (WinTitle set to A and other 3 params omitted). Basically, it sends a close message to a window but is more "user readable" and it has one advantage to using Post. It can operate on a groups windows as well. Just in case you need to close them all. It requires the definition of the group, of course.
#IfWinActive ahk_class CabinetWClass 
~LButton & RButton::WinClose, A
"~" is used to let the button/key through. that is, being able to work on its own.
Thanks, gemisigo. But for some strange reason, just as my original script both of yours act the same: they only close the window only if I double-click left then single-click right. I have StrokeIt enabled and set to close Explorer with right-left click. To make sure it does not interfere, I shut it down, but no change.
Re: Is it possible to execute action by pressing left then right mouse button?
November 03, 2011 04:15AM
What do you mean by "double-click left then single click right"? The scripts only differ in the method they achieve their goal but both should work by clicking and holding down left mouse button and then clicking the right mouse button. This should trigger the action in AHK. After it is done the order of releasing mouse buttons is irrelevant.
That's why I say it's weird. Just like my original script, your scripts only work if there is a left click followed immediately by another left click and then right click. Simply clicking left (holding or no holding) and clicking right does not close the window. Also of note: there is no shell menu appearing on the right click (when preceded by the left click), meaning that the right button is affected (disabled) by the script.
Releasing the buttons is irrelevant indeed, cos the window closes at the moment of the right click.
Re: Is it possible to execute action by pressing left then right mouse button?
November 03, 2011 10:59AM
Weird, indeed. I tried the script and it works as expected (no double click needed and the context menu shown upon right click). Besides, there is nothing in the script that would disable right click.
Are there any other scripts runnig simultaneously? Or 3rd part mouse gesture/driver running in the background (like StrokeIt, SetPoint, JustGestures, etc.) that could interfere?
I shut down StrokeIt, no change. There are a couple of ahk scripts, but they only activate in Excel and have no mouse buttons involved. I shut them down too, anyway. There is also FireGestures, but it work in Firefox only. I disabled FireGestures and shut down Firefox. No way.
Right click is only disabled when left button is pressed (and held). The mouse is a regular mouse with two buttons and wheel.
Re: Is it possible to execute action by pressing left then right mouse button?
November 03, 2011 11:45AM
Er... I'm very sorry, but it seems that I didn't understand you. Of course it is disabled when the left button is pressed and held.
~LButton & RButton::
means that its action will be triggered when the left mouse button is held down and the right mouse button is clicked. In other words it will be triggered when both mouse buttons are pressed at the same time with the left one being the first to be pressed. It also lets them function properly when clicked independently or pressing the right one first. It was your definition to "execute action by pressing left then right mouse button", wasn't it? Or did you mean pressing and releasing left button and then pressing (and releasing) the right one?
Everything exactly as you say. Of course the right button is disabled and it should be. I mentioned it to show that the script works partially. If it didn't work at at, then after left click, it would show the menu on right click. But it doesn't, meaning, that left-right click is engaged in the script. Except the window is not closed.
Re: Is it possible to execute action by pressing left then right mouse button?
November 03, 2011 03:40PM
I see. I still don't know why does it not work as it should. What it your operating system and AHK version?
WinXP SP3, ahk_L, 1.1.04.1
It's even more mysterious - it closes PDF viewer and Word just like it should, with left-right click. With Excel it depends: it the mouse is over the topmost bar, it closes it perfectly, if it's over the spreadsheet area, then if by hitting Left you get into Edit cell mode, then you need left-right to follow immediately, simple right either produces nothing (if I use Send!{F4} command), or there appears a window like I never seen before in my years of working with excel. It says: Cannot quit Microsoft Office Excel. This happens if I use PostMessage, 0x10 command. Interesting, huh?
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 25 plus 22?
Message: