AutoHotkey and AutoIt3 users: popup TC splitter menu.

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

AutoHotkey and AutoIt3 users: popup TC splitter menu.

Post by *SanskritFritz »

I always am annoyed when something does not work from the keyboard in TC. So I help myself with macros. This one might be of interest.

Shortcut key is Ctrl-G, you can change this in Macro Express.

Code: Select all

DELETED
Last edited by SanskritFritz on 2005-03-27, 14:43 UTC, edited 2 times in total.
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Sorry, it does'nt work :-(
The index of the TPanel control (which is amazingly the splitter) changes at every new start.
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Anyone using AutoHotkey? Try this script, it works now for me:

Code: Select all

;Ctrl-G Total Commander splitter menu
$^g::
	WinGet, sf_sProcessName, ProcessName, A
	If sf_sProcessName = TOTALCMD.EXE
	{
		ControlClick, TPanel2, A,,RIGHT
		Return
	}
	else
	{
		Send, ^g
		Return
	}
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

A slightly shorter and better version (works only good if Ctrl-G is not defined in TC, AFAIK is is not by default):

Code: Select all

; Ctrl-G (Total Commander: splitter menu)
~^g::
	IfWinActive ahk_class TTOTAL_CMD
		ControlClick TPanel2, A,,RIGHT
	Return
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

The AutoIt v3 version:

Code: Select all

; Ctrl-G (Total Commander: splitter menu)
HotKeySet( "^g", "TC_splitter_menu" )
Func TC_splitter_menu()
	HotKeySet( "^g" )
	Send( "^g" )
	HotKeySet( "^g", "TC_splitter_menu" )
	If WinActive( "classname=TTOTAL_CMD" ) Then
		ControlClick( "", "", "TPanel2", "right" )
	EndIf	
EndFunc

While 1
	Sleep(250)
WEnd
I switched to Linux, bye and thanks for all the fish!
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

SanskritFritz wrote:A slightly shorter and better version (works only good if Ctrl-G is not defined in TC, AFAIK is is not by default):

Code: Select all

; Ctrl-G (Total Commander: splitter menu)
~^g::
	IfWinActive ahk_class TTOTAL_CMD
		ControlClick TPanel2, A,,RIGHT
	Return
Must be TPanel1 to work !
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

WinTitleMatchMode was missing in AutoIt3 code:

Code: Select all

; Ctrl-G (Total Commander: splitter menu)
AutoItSetOption("WinTitleMatchMode", 4)
HotKeySet( "^g", "TC_splitter_menu" ) 
Func TC_splitter_menu() 
   HotKeySet( "^g" ) 
   Send( "^g" ) 
   HotKeySet( "^g", "TC_splitter_menu" ) 
   If WinActive( "classname=TTOTAL_CMD" ) Then 
      ControlClick( "", "", "TPanel1", "right" ) 
   EndIf    
EndFunc 

While 1 
   Sleep(250) 
WEnd
Icfu
This account is for sale
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

So is it possible to make one that behaves like cm_Src80Percent (widen CURRENT panel to 80/20)?
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Add line

Code: Select all

ControlSend( "", "", "TPanel1", 8 )
under line with ControlClick.

Icfu
This account is for sale
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

I've given my try.
Maybe it's useful for someone.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

My biggest problem still with that is, that TC changes the index number of TPanel (for me it is mostly 2). I could not figure out yet what it depends on, probably when I open ftp connections, but i'm not sure. This means, the click on TPanel1 does not work reliably :-(
@Ghisler: can you tell us more about it? Or maybe better, please implement a command soon ;-)
I switched to Linux, bye and thanks for all the fish!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, TPanel ist just a Delphi panel, TC does not number them. So when the FTP toolbar is created (a TPanel too), then it probably comes before the left panel (it's above it), and therefore AutoIt gives it a different number...
Author of Total Commander
https://www.ghisler.com
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

So I rewrote the scipt to be more intelligent, that is, it relies on the fact, that TPanel[n] is either the splitter or the ftp toolbar, and the ftp toolbar is probably much wider than the splitter ;-) so I check the width, and if it is less than 16 pixels, it must be the splitter. Now the script works even if TPanel4 is the splitter.

Code: Select all

; Ctrl-G (Total Commander: splitter menu)
~^g::
	if not WinActive( "ahk_class TTOTAL_CMD" )
		Return

	WinGet sf_aControls, ControlList
	Loop Parse, sf_aControls, `n
	{
		StringLeft sf_sTemp, A_LoopField, 6
		if (sf_sTemp = "TPanel")
		{
			ControlGetPos Cx,Cy,Cw,Ch, %A_LoopField%
			if (Cw < 16)
			{
				ControlClick %A_LoopField%, A,,RIGHT
				Break
			}
		}
	}
	Return
EDIT: there was a slight error, which fortunately did not affect the functionality.
Last edited by SanskritFritz on 2005-05-02, 07:44 UTC, edited 1 time in total.
I switched to Linux, bye and thanks for all the fish!
hs2
Junior Member
Junior Member
Posts: 10
Joined: 2005-04-21, 09:38 UTC

Post by *hs2 »

This is independent of TPanels:

Code: Select all

; add. shortcut for TotalCommander: SHIFT-CTRL-g -> Center Splitter
+^g::
  IfWinActive, ahk_class TTOTAL_CMD
  {
    ; 1075=WM_USER+51 - TOTALCMD.INC: cm_50Percent=909;Window separator at 50%
    PostMessage 1075, 3004, 0,, ahk_class TTOTAL_CMD
    return
  }

  Send, +^{g}
return
:) HS2
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

This is not only independent of TPanels but has nothing to do with the task to solve.

Nice try ;)

Icfu
This account is for sale
Post Reply