F2

Title Local Menu
File Name F2.txt
Description Open local menu, if any
Authors Gregory and Vochomurka
Parameters -
Plugins Called win, file
Icon
Version 3.0
Updated on 08.06.2009

local hwnd = win.handle("c=TTOTAL_CMD")
local Panel = ifelse(tc.active(hwnd) == "left", 1, 2)
local List = win.childhandlelist(hwnd, "c=TPathPanel")
local Path = win.gettext(word(List, Panel))
Path = file.folder(Path)

for (length(Path) > 1)
	Panel = Path ++ "/_local.bar" 
	if (validpath(Panel)) do 
		do("path_to_TCmenu\TCmenu.exe", Panel)
		quit 
	else 
		Path = file.folder(Path)
	endif 
endfor

win.sendmessage(hwnd, 0x400+51, 540, 0)

Comments:

Attention! This script does not work in Total Commander 7.5 pb1 and pb2!

This script for Total Commander 7.0 and older.

What is a local menu? It's a file with the _local.bar name having the same format as any other Total Commander button bar. Why use local menu? For special project or job associated with a specific directory and its subdirectories. By invoking the local menu you could run applications specific for this project, change directories, execute scripts, open files... In short, local menu serves the same purpose as a usual button bar. But its peculiarity is that it is used with a specific directory only.

In Norton Commander, precursor of Total Commander, local menus are invoked by the F2 hotkey. Before I developed my script I hadn't used the F2 key, and to execute the cm_RereadSource command I used the Ctrl+R hotkey or the corresponding button. But the script can be adapted to the double function at pressing the F2 key. To do so, I defined F2 as an application-dependent by means of PowerPro (yes, it has the said function).

If you were not the Norton Commander's user in your time, you probably have no habit to invoke the local menu by pressing F2. In such a case just delete the line

win.sendmessage(hwnd, 0x400+51, 540, 0)
To display the local menu both utilities: TCmenu or TCToolbar, can be used.
Main Page Total Commander PowerPro