TC opens closes and reopens new tab on middle mousebutton
Moderators: Hacker, petermad, Stefan2, white
- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
TC opens closes and reopens new tab on middle mousebutton
TC opens closes and reopens new tab on a click with middle mousebutton when it is inactive.
Steps to reproduce:
1) open more than 1 tab (register) in one panel
2) activate another program (for example Notepad)
3) without explicitly activating TC click with the middle mouse button on the rightmost tab.
-> TC will close this tab (intended) but it will also clone the tab to the left.
Steps to reproduce:
1) open more than 1 tab (register) in one panel
2) activate another program (for example Notepad)
3) without explicitly activating TC click with the middle mouse button on the rightmost tab.
-> TC will close this tab (intended) but it will also clone the tab to the left.
- fenix_productions
- Power Member
- Posts: 1979
- Joined: 2005-08-07, 13:23 UTC
- Location: Poland
- Contact:
- ghisler(Author)
- Site Admin
- Posts: 50541
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Sorry, cannot reproduce. 
The tab closes and stays closed here.

The tab closes and stays closed here.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
See movie here:
http://www.drivehq.com/file/df.aspx/publish/SamuelPlentz/Dateien/Middleclick.avi
More than 1 tab is important. Also closing the rightmost.
http://www.drivehq.com/file/df.aspx/publish/SamuelPlentz/Dateien/Middleclick.avi
More than 1 tab is important. Also closing the rightmost.
I cannot repruduce this bug either - not with my usual ini nor with a clean ini file.
I am using Windows standard HID mouse driver with a Microsoft wireless mouse,
I am using Windows standard HID mouse driver with a Microsoft wireless mouse,
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- Boofo
- Power Member
- Posts: 1431
- Joined: 2003-02-11, 00:29 UTC
- Location: Des Moines, IA (USA)
- Contact:
I cannoit reproduce it either. I have a Micorsoft scroll wheel mouse with the wheel set as double-click and it works like it is supposed to for me.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden
How do I un-overwrite all my data?
User of Total Commander
#60471 Single user license
How do I un-overwrite all my data?
User of Total Commander
#60471 Single user license
- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
I need to get ashamed now. 
You need the current ButtonBar eXtended to reproduce. I wrote a "MouseTool.ahk" for it, which is causing that.
It is used to be able to use the middle mouse button to execute different commands in the Toolbar. (Toolbar eXtended still works with ctrl, alt, shift without the tool running.)
So its up to me to fix this bug.
I will report here when I fixed it.
fenix_productions I assume you also use my Buttonbar eXtended with MouseTool.
PS: The only thing Christian can do here is to include multiple commands per button (upon different modifiers / mousebuttons) into TC.

You need the current ButtonBar eXtended to reproduce. I wrote a "MouseTool.ahk" for it, which is causing that.
It is used to be able to use the middle mouse button to execute different commands in the Toolbar. (Toolbar eXtended still works with ctrl, alt, shift without the tool running.)
So its up to me to fix this bug.

fenix_productions I assume you also use my Buttonbar eXtended with MouseTool.
PS: The only thing Christian can do here is to include multiple commands per button (upon different modifiers / mousebuttons) into TC.

- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
This is strange.
Normally MouseTool catches the MiddleMouseButton events and replaces them with other MiddleMouseButton events. (if the events are catched above the ButtonBar MouseTool sends LeftMouseButton events)
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.
As a workaround I removed this line:
Any comments or suggestions are welcome!
This is the new code of "MouseTool.ahk":
Normally MouseTool catches the MiddleMouseButton events and replaces them with other MiddleMouseButton events. (if the events are catched above the ButtonBar MouseTool sends LeftMouseButton events)
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.
As a workaround I removed this line:
Code: Select all
#ifWinActive ahk_class TTOTAL_CMD
This is the new code of "MouseTool.ahk":
Code: Select all
; "MouseTool" for "ButtonBar eXtended" for Total Commander
; Version: 1.2
; Freeware by Samuel Plentz - www.SamuelPlentz.de.vu
#NoTrayIcon
#SingleInstance FORCE
SetBatchLines -1
; read values from ini
MB1=0
IniRead,MB2 ,ButtonBar eXtended.ini,MouseTool,UseMouseButton2,0
IniRead,MB3 ,ButtonBar eXtended.ini,MouseTool,UseMouseButton3,1
IniRead,MB4 ,ButtonBar eXtended.ini,MouseTool,UseMouseButton4,1
IniRead,MB5 ,ButtonBar eXtended.ini,MouseTool,UseMouseButton5,1
IniRead,ShowIcon,ButtonBar eXtended.ini,MouseTool,ShowIcon ,1
if(ShowIcon!="0"){
menu,tray,Icon
menu,tray,Tip,"MouseTool" for "ButtonBar eXtended"
}
; create the redirect keys
#ifWinActive ahk_class TTOTAL_CMD
$LButton:: RedirectClick(1)
$RButton:: RedirectClick(2)
$MButton:: RedirectClick(3)
$XButton1::RedirectClick(4)
$XButton2::RedirectClick(5)
#ifWinActive
; simulates a normal mouseclick on click with mouse2 - mouse5 on the buttonbar
RedirectClick(Number)
{
global
if((MB%Number%!="0") && (OverButtonBar())){
ClearMutex()
SetMutex(Number)
PressMouseButton(1,0)
WaitForKey(Number)
PressMouseButton(1,1)
}else{
ClearMutex()
PressMouseButton(Number,0)
WaitForKey(Number)
PressMouseButton(Number,1)
}
return
}
; checks if the mouse actually is over the buttonbar or not
OverButtonBar()
{
if(WinActive("ahk_class TTOTAL_CMD")){
MouseGetPos,,,,Control
if(Control=="TButtonBar1"){
return 1
}
}
return 0
}
; waits for mousekey release
WaitForKey(Number)
{
if(Number==1){
KeyWait,LButton
}else if(Number==2){
KeyWait,RButton
}else if(Number==3){
KeyWait,MButton
}else if(Number==4){
KeyWait,XButton1
}else if(Number==5){
KeyWait,XButton2
}
}
; simulates mouseclick
PressMouseButton(Number,up)
{
if(Number==1 && up==0){
Click down L
}else if(Number==1 && up==1){
Click up L
}else if(Number==2 && up==0){
Click down R
}else if(Number==2 && up==1){
Click up R
}else if(Number==3 && up==0){
Click down M
}else if(Number==3 && up==1){
Click up M
}else if(Number==4 && up==0){
Click down X1
}else if(Number==4 && up==1){
Click up X1
}else if(Number==5 && up==0){
Click down X2
}else if(Number==5 && up==1){
Click up X2
}
}
; create a mutex to notify "ButtonBar eXtended.exe" what MouseButton has been pressed
SetMutex(Number)
{
global
Mutex%Number% := DllCall("kernel32\CreateMutexA",Long,"0&",Int,"1",Str,"BBX_" . Number)
}
; close previous mutexes
ClearMutex()
{
global
if(Mutex2!=""){
DllCall("CloseHandle","UInt",Mutex2)
Mutex2=
}
if(Mutex3!=""){
DllCall("CloseHandle","UInt",Mutex3)
Mutex3=
}
if(Mutex4!=""){
DllCall("CloseHandle","UInt",Mutex4)
Mutex4=
}
if(Mutex5!=""){
DllCall("CloseHandle","UInt",Mutex5)
Mutex5=
}
}
Last edited by Samuel on 2009-09-06, 15:32 UTC, edited 1 time in total.
Should be moved to "Total Commander (English)" or "TC7.5 Behaviour which will not be changed"
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Why don't you change the code before triggering?
I'm not sure if TButtonBar1 can have other numbers or not, thus the RegExMatch instead of a direct == comparison.
I'm not sure if TButtonBar1 can have other numbers or not, thus the RegExMatch instead of a direct == comparison.
Code: Select all
#ifWinActive ahk_class TTOTAL_CMD
{
MouseGetPos, ,,,aControl
if( RegExMatch(aControl, "^TButtonBar") )
{
/* HotKeyDefinitions here */
}
}
return
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Except ... you're wrong
Or more relevant to your purposes:
Code: Select all
Do_WinFunction(key)
{
MouseGetPos, ,,,aControl
if( aControl == "TButtonBar1" )
{
MsgBox, Win+%key%
}
else
{
Send, #%key%
}
return
}
#ifWinActive ahk_class TTOTAL_CMD
{
$#r::Do_WinFunction("r")
}
return
Code: Select all
Do_MouseAction()
{
MouseGetPos, ,,,aControl
if( aControl == "TButtonBar1" )
{
if( GetKeyState("Shift") == 1 )
{
MsgBox, ExtendedButtonBar Shift
}
else
if( GetKeyState("Ctrl") == 1 )
{
MsgBox, ExtendedButtonBar Ctrl
}
;etc
}
else
{
Click Down
KeyWait LButton
Click Up
}
return
}
#ifWinActive ahk_class TTOTAL_CMD
{
$Lbutton::Do_MouseAction()
}
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
And this is incorrect too, here's my AHK script for MButton: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.
Code: Select all
$Mbutton::
{
MinMaxClose := WM_NCHITTEST()
if( RegExMatch(MinMaxClose, "^(MINBUTTON|MAXBUTTON|CLOSE)$" ))
{
Send, {MButton}
return
}
ControlGetFocus, aControl, ahk_class TTOTAL_CMD
if( RegExMatch(aControl, "TMyListBox(1|2)")
&& !GetKeyState("Shift") )
{
;; TC ALIAS: CTRL+DEL = em_recycle
;; em_recycle = recycle.exe %S
Send, ^{Delete}
/*
Send, {Delete}
WinWait, ahk_class #32770
ControlClick, &Yes
*/
return
}
else
if( WinActive("ahk_class SDL_app") )
{
Click, Down Middle
KeyWait, Mbutton
Click, Up Middle
}
else
if( WinActive("ahk_class OpWindow") )
{
if( GetKeyState("Ctrl") == 1 )
{
Send, {.} ; STOP & OpKey: ^{.}
return
}
else
Send, {Delete}
}
else
Send, {Delete}
return
}