Page 1 of 2

Tab wheel scroll functionality.

Posted: 2009-10-11, 13:05 UTC
by HAL 9000
Hi!
There is a nice addon for Firefox called "Tab wheel scroll" which does the following: when you mouseover tab-bar and scroll your mouse's wheel - it lists tabs.

Kind people from the russian forum helped me with that by writing a nice script for AutoHotkey, that does what I've asked. But it needs to be run everytime I run Total Commander. In fact I can write a *.bat-script that will run both of them and use this *.bat script just as a shortcut, but I would like to have the functionality of that script be integrated it in the Total Commander.
As there is no souce code available - maybe you could compile special version for me? :)
Or regard it just as a feature request.

p.s.: script code:

Code: Select all

; AutoHotkey script
; www.autohotkey.com

#SingleInstance force

#IfWinActive ahk_class TTOTAL_CMD

WheelUp::
WheelDown::
  MouseGetPos,,,, ControlClass
    Send, % "^" (A_ThisHotkey = "WheelUp" ? "+" : "") "{TAB}"
  Else, Send, % "{" A_ThisHotkey "}"
Return 

Posted: 2009-10-12, 10:21 UTC
by HAL 9000
is this forum dead? Why everybody keeps ignoring my request? :(

Posted: 2009-10-12, 11:26 UTC
by Samuel
Is the forum dead just because not all requests / topics are not answered within 24 hours?

Why you edited the code of the script? The previous version looked ok. Now you cant even run it. (There is no if for the else)

Making custom versions for each and every user is not the way Christian works. If a feature is requested by many users (and if he likes it) he will probably add it. Otherwise you must use third party tools like AutoHotkey to write workarounds. This tools could easily be put into the system autostart. So you dont need to write batches etc.

BTW: I dont need this feature.

Posted: 2009-10-12, 11:46 UTC
by Balderstrom
Yeah I already have CTRL+Scroll mapped to pageUp/PageDn if the mouse pointer is over the File List, and SHIFT+Scroll to Up/Down (when over the File List).

Indiscriminately changing between tabs like that would pollute the History (Alt+Down).

I don't see Christian adding every little tweak that is possible with AHK either, since the usage of it is usually a fairly specific need/want. Thankfully he has written TC in such a way that the Controls have distinct names so we can use things like AHK to do very specific things all depending on which Control the mouse is hovering over at that moment.

Granted many ppl have an aversion to using these interesting tools and scripts and would prefer it to be integrated in [insert-app-of-choice-here]. Except that almost never happens.

Posted: 2009-10-13, 12:18 UTC
by HAL 9000
Balderstorm, Okay, just thought maybe ppl would like this request, cause all of the good progs I know that have tabbed system - they have tab wheel scroll (either built-in or by addon).
Okay, maybe it won't be implemented, I can't ask that much from free closed-source software, like Total Commander, and I feel pretty comfort by using AHK-scripts that can add the lacked functionality to some progs, but I still would like to get an answer from the main dev.

Samuel, this script works well for me, no problems on the script side.
And yes, I thought that main dev could at least take a short look at my request (there are not really many of the request, so it's possible) and drop a short "no, sorry, it won't be ever implemented" or something like this.

Posted: 2009-10-13, 13:03 UTC
by Samuel
The script itself may work, but the script in the first topic seems to be broken. (I remember some more lines there including some Russian description)

Christian Ghisler (the only developer) seems to be on a vacation, because he didnt answered anything for a week now. (AFAIK)

Posted: 2009-10-13, 15:44 UTC
by HAL 9000

Code: Select all

#SingleInstance force

#IfWinActive ahk_class TTOTAL_CMD

WheelUp::
WheelDown::
  MouseGetPos,,,, ControlClass
  ; Strange but as for me ( ahk 1.0.48.05 + tc 7.50a )
  ; tab control is defined as TMyPanel not TMyTabControl
  ; so uncomment the following string and comment the one next to it if it's not working
  ; If RegExMatch(ControlClass, "TMyTabControl[12]")
  If RegExMatch(ControlClass, "TMyPanel[47]")
    Send, % "^" (A_ThisHotkey = "WheelDown" ? "+" : "") "{TAB}"
  Else, Send, % "{" A_ThisHotkey "}"
Return

Posted: 2009-10-13, 16:37 UTC
by Samuel
TMyPanel[47] doesnt work here, but TMyPanel[69] does. (TC 7.5a)

Code: Select all

#SingleInstance force

#IfWinActive ahk_class TTOTAL_CMD

WheelUp::
WheelDown::
  MouseGetPos,,,, ControlClass
  ; Strange but as for me ( ahk 1.0.48.05 + tc 7.50a )
  ; tab control is defined as TMyPanel not TMyTabControl
  ; so uncomment the following string and comment the one next to it if it's not working
  ; If RegExMatch(ControlClass, "TMyTabControl[12]")
  If RegExMatch(ControlClass, "TMyPanel[69]")
    Send, % "^" (A_ThisHotkey = "WheelDown" ? "+" : "") "{TAB}"
  Else, Send, % "{" A_ThisHotkey "}"
Return

Posted: 2009-10-13, 17:31 UTC
by Balderstrom
@ Samuel, I thought I had figured out the pattern
But as I move the mouse across tabs on the Left/Right pane, the control changes between
TMyTabControl1 + TMyPanel4 (left side) and
TMyTabControl2 + TMyPanel7 (right side).

So they are both actually valid, all depending on what area of the Tabs the mouse happens to be.

Posted: 2009-10-13, 19:29 UTC
by HAL 9000
final (as for now) version of this script is

Code: Select all

#SingleInstance force
Run, TOTALCMD.EXE

WinWait, ahk_class TTOTAL_CMD

SetTimer, CheckTC, On

WheelUp::
WheelDown::
  MouseGetPos, MouseX, MouseY, WinID, ControlNN, 1
  WinGetClass, WinClass, % "ahk_id " WinID

  If (WinClass = "TTOTAL_CMD" && RegExMatch(ControlNN, "TMyTabControl[12]"))
  { PostMessage, 1075, % TC_Cmd := "400" (ControlNN = "TMyTabControl1" ? "1" : "2"), 0,, % "ahk_class " WinClass
    PostMessage, 1075, % TC_Cmd := "300" (A_ThisHotkey = "WheelDown" ? "5" : "6"), 0,, % "ahk_class " WinClass
  }

  Else, PostMessage 0x20A, ((A_ThisHotKey="WheelUp")-.5)*A_EventInfo*(120<<17),(MouseY<<16)|MouseX, % ControlNN, % "ahk_id " WinID
Return

CheckTC:
  Process, Exist, TOTALCMD.EXE
  If !ErrorLevel
    ExitApp
Return 
But it activates the panel if it's inactive and you scroll tabs.

Posted: 2009-10-20, 14:51 UTC
by HAL 9000
Christian Ghisler is still on the vacation?
EDIT: no, there is an answer from him to some another thread dated 15'th of October, so he just ignores some topics, that's bad :(

Posted: 2009-10-20, 15:37 UTC
by MVV
HAL 9000 wrote:But it activates the panel if it's inactive and you scroll tabs.
Modify script to check if panel is active. If not, restore focus onto another panel after scrolling.

Posted: 2009-10-20, 18:21 UTC
by Balderstrom
Anyways, here's how I would do it:

Code: Select all

#InstallMouseHook
#SingleInstance, Force 
SetBatchLInes, -1
SendMode Input

TCTabScroll( key, panelCheck, pane1, pane2 )
{
	cmd := (key == "WheelUp" ? 3006 : 3005)
	if( panelCheck )
	{
		PostMessage, 0x433, pane1
		PostMessage, 0x433, cmd
		PostMessage, 0x433, pane2
	}
	else
		PostMessage, 0x433, cmd
return
}

#ifWinActive, ahk_class TTOTAL_CMD
{
	WheelDown::
	WheelUp::
	{
		ControlGetFocus, aControl, ahk_class TTOTAL_CMD
		MouseGetPos, ,,, mControl

		if( aControl == "TInEdit1" && A_ThisHotKey="WheelDown") 
			Send, {Enter}
		else
		if( mControl == "TMyTabControl2" || mControl == "TMyPanel7" )	; RIGHT
			TCTabScroll( A_ThisHotkey, (aControl != "TMyListBox1"), 4002, 4001 )
		else
		if( mControl == "TMyTabControl1" || mControl == "TMyPanel4" )	; LEFT
			TCTabScroll( A_ThisHotkey, (aControl != "TMyListBox2"), 4001, 4002 )
		else
			Send, {%A_ThisHotkey%}
	return
	}
return
}

This has an additional thing I added for myself, when doing in-place rename you are forced to hit "enter" to confirm. This line, allows you to just WheelDown to confirm an in-place rename.
if( aControl == "TInEdit1" && A_ThisHotKey="WheelDown")
Send, {Enter}
else
Take that out if you dislike it.

It's a little less compact (of course, it is more functional as well) than the original code, but I prefer readability over obscure function.

EDIT: Was a small error in the TMyListBox#'s

Posted: 2009-10-21, 12:28 UTC
by Stance
I want to thank everyone for the effort! :)

Posted: 2009-10-21, 19:17 UTC
by HAL 9000
Balderstrom, thx a lot! :D
I'm so happy now! thank you, thank you! :D