UserMenuAnalyzer

Title UserMenuAnalyzer
File Name UserMenuAnalyzer.txt
Description Retrieve information about user menus from [User] and [DirMenu] sections of TC's configuration
Author Vochomurka
Parameters ("user")
Plugins Called ini
Icon
Version 1.0
Updated on 02.03.15
args Sec
static Config = env("WINDIR") ++ "\wincmd.ini"
static CR = esc(?+\n+, ?+\+)
static Tab = esc(?+\t+, ?+\+)

local i, Value, OpenSM, CloseSM, Separator, Temp, cd, param, Target, Nest, MaxNest

for(i = 1; i <= 200; i++)
	Temp = "menu" ++ i
	if(ini.check_exists(Config, Sec, Temp) != 3) do
		break
	else
		Value = ini.get(Config, Sec, Temp)
		if(Value == "-") do
			Separator++
			jump NotMenu
		endif
		if(Value[0, 1] == "--") do
			CloseSM++
			Nest--
			jump NotMenu
		endif
		if(Value[0] == "-") do
			OpenSM++
			Nest++
			MaxNest = max(Nest, MaxNest)
			jump NotMenu
		endif
	endif
@NotMenu
	Temp = "cmd" ++ i
	if(ini.check_exists(Config, Sec, Temp) == 3 && slice(ini.get(Config, Sec, Temp), 3) == "cd ")
		cd++

	if(ini.check_exists(Config, Sec, "path" ++ i) == 3)
		Target++

endfor

Temp = "Section:" ++ Tab ++ Tab ++ Sec ++ CR ++ "Items:" ++ Tab ++ Tab ++ (i - 1) ++ CR
Temp ++= "Submenu starts:" ++ Tab ++ OpenSM ++ CR ++ "Submenu ends:" ++ Tab ++ CloseSM ++ CR
Temp ++= "Max. Nesting:"  ++ Tab ++ MaxNest ++ CR ++ "'cd' Commands:" ++ Tab ++ cd ++ CR
Temp ++= "Separators:" ++ Tab++ Separator ++ CR ++ "Target paths:" ++ Tab ++ Target

messagebox("ok info", Temp, "UserMenuAnalyzer Script")

if(Sec.case("lower") == "user")
	.UserMenuAnalyzer("DirMenu")

Comments:

The script execution gives the message box similar to this one:

Three first numbers are of greatest interest. The very first is a total number of [user] menu items that can not exceed 200. If your number is close to it, you should "clean up" your menu or reorganise it.

Second and third numbers must be equal. They show hao many submenus are opened, and closed, respectively.

Remaining numbers are mainly for the curiousity or reference purposes.

After pressing OK the similar information about the [DirMenu] is provided.


All Scripts Total Commander TotalCmd.net PowerPro