TC opens closes and reopens new tab on middle mousebutton

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

Sorry to say that but this code does not work:

Code: Select all

#ifWinActive ahk_class TTOTAL_CMD
{
 MouseGetPos, ,,,aControl
 if( RegExMatch(aControl, "^TButtonBar") )
 {
  /* HotKeyDefinitions here */
  #r::msgbox,abc
 }
}
return
Windowskey+r will also trigger when the mouse is not above the toolbar. This is what I mean with nesting them.
The only way to nest hotkeys is the compiler directive "#ifWinActive" - I used this already but it gave problems.
Balderstrom wrote:
Samuel wrote:This is strange.
But AutoHotkey apparently can't replace a MiddleMouseButtonUp event, if it doesn't know of the according MiddleMouseButtonDown event. Instead both events (the one from the user and the one created by MouseTool) are seen by Total Commander.
And this is incorrect too, here's my AHK script for MButton:
...
You are not right on this one too. Your script doesn't use the MiddleMouseButtonUp event. So it cant prove my statement wrong.

But your script shows a nice solution (KeyWait) for my problem. Using something like:

Code: Select all

#IfWinActive ahk_class TTOTAL_CMD
$Mbutton:: 
 Click, Down Middle
 KeyWait, Mbutton
 Click, Up Middle
return
#IfWinActive
...doesnt show the behavior of the bug. Thank you.

PS: Hopefully this does not have other side effects.
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

I updated Buttonbar eXtended with the new MouseTool. (I also fixed another bug in the MouseTool.)

I also updated my previous (long) post with the code I finally use now.

Thx again.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I was trying to help by pointing out your misconceptions. Next time I'll save my time.
* AHK can detect and send Middle up/down events. And determine what state the key is in. As well as what state any of the normal mouse buttons are in.
* AHK can do different actions depending on where the mouse is at any given time, i.e. which control the mouse is over.

Granted my first snippet was non-functioning, so I posted fully working code in the second post. Which shows the MiddleMouse button doing BOTH of the above statements:
1) It does a normal Middle click when the mouse is over an application's Min/Max/Close buttons.
2) a middleMouse click down (HOLD) and click up when the Viewer2 application is running
3) CTRL+DELETE when the mouse is over TC's FileLists
Else send Delete.
I also showed exactly how you can make your code only run when the mouse is over the ButtonBar:
MouseTrigger:: DoFunction()
By encapsulating the contents of DoFunction in:
ControlGetFocus, aControl, ahk_class TTOTAL_CMD
if( aControl == "TButtonBar1" )
{
/* extendedButtonBarStuff */
}
Maybe you don't like being told you're wrong, I know I don't. But at least I'll admit when I am wrong. :twisted:
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

I didn't want neither to prove you wrong nor to insult you. But actually I did. A big sorry about that.
-> I am wrong about that.

I think the reason were some misconceptions.
* AHK can detect and send Middle up/down events. And determine what state the key is in. As well as what state any of the normal mouse buttons are in.
Your suggestions (which work actually great) didn't fitted into my imaginations of how the solution should look like. So I responded inappropriate, Sorry.
* AHK can do different actions depending on where the mouse is at any given time, i.e. which control the mouse is over.
This was something I already knew. (and coded like this) This was the reason why it made me respond angry.
Sorry about this too.

Fact is you solved my problem, and I am very thankful about that.
Hope you are not angry with me anymore.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

*GrIN* Fair enough! :-)
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
Post Reply