- Full TC's favorites menu
- If called inside active dialog (save, open, browse):
- if path is choosen, change the path IN dialog
- if plugin is choosen, start or activate TC and switch to the plugin
- If called on ANY active window that is NOT the dialog activate or open TC
- If called on TC, redirect to TCs own dialog to be able to see configuration enteries
Soon:
- Add current source and target
- Add submenu with environement variables which point to valid paths
- Add submenu with system folders: My Computer, Control Panel, Recycle Been
- Refresh menu on every call to reflect recent changes inside TC
Setup
Edit path to ini and executable and set cm_DirectoryHotlist & cm_editpath to hotkeys you use.
If you want to handle more dialogs like Open/Save put desired keywords in Dialogs variable.
Please report bugs if you find them.
;============================ SETUP ================================== tcExe = %COMMANDER_PATH%\TotalCmd.exe tcIni = %COMMANDER_PATH%\wincmd.ini cm_DirectoryHotlist = !1 cm_editpath =^{F2} cm_CopySrcPathToClip = ^+!{F3} ;for future cm_CopyTrgPathToClip = ^+!{F4} ;for future dialogs = Open,Save,Browse,Find ;====================================================================== Menu tray, icon, %SystemRoot%\System32\shell32.dll, 44 SetKeyDelay, -1 g_sub_cnt = 0 g_mnu_cnt = 0 CreateFullMenu() ;------------------------------------------------------------------------ ;------------------------------------------------------------------------ ^w:: ;handle Total COmmander; call its own menu IfWinActive ahk_class TTOTAL_CMD { Send %cm_DirectoryHotlist% return } Menu, sub1, show, A_CaretX, A_CaretY return ;------------------------------------------------------------------------- CreateMenu() { local separator, cmd_cnt, submenu_id, sub_num separator := false cmd_cnt = 0 g_sub_cnt += 1 sub_num = %g_sub_cnt% submenu_id = sub%sub_num% Loop { ;read next menu item g_mnu_cnt += 1 IniRead, mnu, %tcIni%, DirMenu, menu%g_mnu_cnt%, & IniRead, cmd, %tcIni%, DirMenu, cmd%g_mnu_cnt% if (mnu = "&") break ;is it separator ? if (mnu = "-") { if ( separator = true ) continue separator := true Menu, %submenu_id%, add cmd_cnt += 1 continue } ;not a separator, determine what is it from next 2 charachters StringMid, c1, mnu, 1, 1 StringMid, c2, mnu, 2, 1 ; "--" exit condition (end of submenu), return this menu to the caller if (c2 = "-") return %submenu_id% ; "-....." submenu, create it if (c1 = "-") { StringMid, name, mnu, 2, 100 Menu, %submenu_id%, add, %name%, % ":" . CreateMenu() cmd_cnt += 1 continue } Menu, %submenu_id%, add, %mnu%, MenuHandler cmd_cnt += 1 command%sub_num%_%cmd_cnt% := cmd separator := false } } ;----------- MenuHandler: j := A_ThisMenuItemPos if (A_ThisMenu = "sub1") j -= 0 ;substruct custom items here (for future) StringReplace i, A_ThisMenu, sub, keys := % command%i%_%j% ; cd \\\plugin - call total commander unconditionaly ; cd path - send keys if dialog else call TC StringMid keys, keys, 4 StringGetPos tmp, keys, \\\ if (tmp != -1) openTC(keys) else { WinGetActiveTitle active_title if active_title contains %dialogs% { SendInput %keys%{ENTER} return } openTC(keys) } return ;-------------------------------------------------------------------------- OpenTc(keys) { global if not WinExist("ahk_class TTOTAL_CMD") { Run %tcExe% WinWait, ahk_class TTOTAL_CMD } WinActivate ahk_class TTOTAL_CMD Send %cm_editpath% SendRaw, %keys% Send, {ENTER} } ;-------------------------------------------------------------------------- CreateFullMenu() { global ; to do - add left and right panel ifWinExist ahk_class TTOTAL_CMD1 { ControlSend ,,%cm_CopySrcPathToClip% Menu sub1, add, %clipboard% , FullMenuHandler ControlSend ,,%cm_CopyTrgPathToClip% Menu sub1, add, %clipboard% , FullMenuHandler Menu sub1, add } CreateMenu() } FullMenuHandler: ; to do return