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
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.
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.
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.
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.
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.
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?
|